[ 1876544 ] Field group visible when fields are not

- Patch at revision 4356 not working.
This commit is contained in:
Heng Sin Low 2008-02-18 16:16:54 +00:00
parent 9d5cab42ef
commit 5e4f59dea0
1 changed files with 19 additions and 29 deletions

View File

@ -975,48 +975,38 @@ public class GridController extends CPanel
} // all components
// hide empty field group based on the environment
Map<String, CollapsiblePanel> hiddensPanel = new HashMap<String, CollapsiblePanel>();
Set<CollapsiblePanel> visiblePanel = new HashSet<CollapsiblePanel>();
for (int i = 0; i < comps.length; i++) {
Component comp = comps[i];
if (comp instanceof CollapsiblePanel)
{
if (comp.getName() != null && !comp.getName().startsWith("IncludedTab#"))
hiddensPanel.put(comp.getName(), (CollapsiblePanel)comp);
}
else
{
String columnName = comp.getName();
if (columnName != null && columnName.length() > 0) {
GridField mField = m_mTab.getField(columnName);
if (mField != null)
{
String fieldGroup = mField.getFieldGroup();
if (fieldGroup != null && fieldGroup.length() > 0)
if (comp.getName() == null || comp.getName().startsWith("IncludedTab#"))
continue;
else
{
boolean hasVisible = false;
Component[] childs = ((CollapsiblePanel)comp).getCollapsiblePane().getContentPane().getComponents();
for (int j = 0; j < childs.length; j++) {
if (childs[j].isVisible())
{
if (hiddensPanel.containsKey(fieldGroup) && !hiddens.contains(columnName))
String columnName = childs[j].getName();
if (columnName != null && columnName.length() > 0)
{
visiblePanel.add((CollapsiblePanel)hiddensPanel.remove(fieldGroup));
GridField mField = m_mTab.getField(columnName);
if (mField != null)
{
hasVisible = true;
break;
}
}
}
}
}
if (comp.isVisible() != hasVisible)
comp.setVisible(hasVisible);
}
}
}
for (CollapsiblePanel panel : hiddensPanel.values())
{
if (panel.isVisible())
panel.setVisible(false);
}
for (CollapsiblePanel panel : visiblePanel)
{
if (!panel.isVisible())
panel.setVisible(true);
}
//
log.config(m_mTab.toString() + " - fini - "