diff --git a/client/src/org/compiere/apps/StatusBar.java b/client/src/org/compiere/apps/StatusBar.java index 2107e4acf2..e0257b467f 100644 --- a/client/src/org/compiere/apps/StatusBar.java +++ b/client/src/org/compiere/apps/StatusBar.java @@ -86,7 +86,7 @@ public class StatusBar extends CPanel statusDB.addMouseListener(new StatusBar_mouseAdapter(this)); this.setLayout(mainLayout); infoLine.setFont(AdempierePLAF.getFont_Label()); - infoLine.setBorder(BorderFactory.createRaisedBevelBorder()); + infoLine.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary2())); infoLine.setHorizontalAlignment(SwingConstants.CENTER); infoLine.setHorizontalTextPosition(SwingConstants.CENTER); infoLine.setText("info"); diff --git a/client/src/org/compiere/grid/GridController.java b/client/src/org/compiere/grid/GridController.java index fb6f20f741..3d5421d460 100644 --- a/client/src/org/compiere/grid/GridController.java +++ b/client/src/org/compiere/grid/GridController.java @@ -28,6 +28,7 @@ import javax.swing.event.*; import javax.swing.table.*; import org.adempiere.plaf.AdempiereLookAndFeel; +import org.adempiere.plaf.AdempierePLAF; import org.compiere.apps.*; import org.compiere.grid.ed.*; import org.compiere.grid.tree.*; @@ -311,6 +312,10 @@ public class GridController extends CPanel //FR [ 1757088 ] vPanel = new VPanel(mTab.getName(), m_WindowNo); vPanel.putClientProperty(AdempiereLookAndFeel.HIDE_IF_ONE_TAB, Boolean.TRUE); + if (this.isDetailGrid()) + { + vPanel.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getPrimary2())); + } vPane.getViewport().add(xPanel, null); xPanel.add(vPanel, BorderLayout.CENTER); @@ -463,6 +468,8 @@ public class GridController extends CPanel //FR [ 1757088 ] public void setDetailGrid(boolean value){ detailGrid = value; + if (detailGrid && vPanel != null) + vPanel.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getPrimary2())); } public boolean isDetailGrid(){ @@ -907,13 +914,15 @@ public class GridController extends CPanel boolean noData = m_mTab.getRowCount() == 0; log.config(m_mTab.toString() + " - Rows=" + m_mTab.getRowCount()); // All Components in vPanel (Single Row) + + Set hiddens = new HashSet(); Component[] comps = vPanel.getComponentsRecursive(); for (int i = 0; i < comps.length; i++) { Component comp = comps[i]; String columnName = comp.getName(); - if (columnName != null) + if (columnName != null && columnName.length() > 0) { GridField mField = m_mTab.getField(columnName); if (mField != null) @@ -952,12 +961,63 @@ public class GridController extends CPanel } } } - else if (comp.isVisible()) - comp.setVisible(false); + else + { + if (comp.isVisible()) + comp.setVisible(false); + hiddens.add(columnName); + } } } } // all components - log.config(m_mTab.toString() + " - fini - " + (col<=0 ? "complete" : "seletive")); + + // hide empty field group based on the environment + Map hiddensPanel = new HashMap(); + Set visiblePanel = new HashSet(); + 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 (hiddensPanel.containsKey(fieldGroup) && !hiddens.contains(columnName)) + { + visiblePanel.add((CollapsiblePanel)hiddensPanel.remove(fieldGroup)); + } + } + } + } + } + } + + 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 - " + + (col <= 0 ? "complete" : "seletive")); } // dynamicDisplay /** diff --git a/client/src/org/compiere/grid/VPanel.java b/client/src/org/compiere/grid/VPanel.java index 7cd333ae9d..717974175d 100644 --- a/client/src/org/compiere/grid/VPanel.java +++ b/client/src/org/compiere/grid/VPanel.java @@ -211,6 +211,7 @@ public final class VPanel extends CTabbedPane m_gbc.weightx = 1; m_gbc.ipadx = 0; m_main.add(m_tab,m_gbc); + m_tab.setName("IncludedTab#"+AD_Tab_ID); if (includedTabList.containsKey(AD_Tab_ID)) { @@ -233,8 +234,15 @@ public final class VPanel extends CTabbedPane fieldGroupType = m_oldFieldGroupType; } - if (addGroup(fieldGroup, fieldGroupType)) // sets top - sameLine = false; + if (addGroup(fieldGroup, fieldGroupType)) // sets top + { + if (X_AD_FieldGroup.FIELDGROUPTYPE_Collapse.equals(fieldGroupType)) + { + CollapsiblePanel panel = (CollapsiblePanel) m_tablist.get(fieldGroup); + panel.getCollapsiblePane().setCollapsed(mField.getIsCollapsedByDefault()); + } + sameLine = false; + } else { fieldGroup = m_oldFieldGroup; @@ -402,7 +410,7 @@ public final class VPanel extends CTabbedPane setupCollapsiblePaneLayout(m_tab); CompoundBorder border = (CompoundBorder)m_tab.getBorder(); m_tab.setBorder(new CompoundBorder(border.getOutsideBorder(), BorderFactory.createEmptyBorder(0, 0, 2, 0))); - m_tab.setName(fieldGroup); + collapsibleSection.setName(fieldGroup); m_gbc.anchor = GridBagConstraints.NORTHWEST; //m_gbc.gridy = 0; // line m_gbc.gridx = 0;