* [ 1876642 ] Add Collapsed by Default to Field Group
* [ 1876642 ] Add Collapsed by Default to Field Group * minor changes in border.
This commit is contained in:
parent
beb845225d
commit
38ba58c4eb
|
@ -86,7 +86,7 @@ public class StatusBar extends CPanel
|
||||||
statusDB.addMouseListener(new StatusBar_mouseAdapter(this));
|
statusDB.addMouseListener(new StatusBar_mouseAdapter(this));
|
||||||
this.setLayout(mainLayout);
|
this.setLayout(mainLayout);
|
||||||
infoLine.setFont(AdempierePLAF.getFont_Label());
|
infoLine.setFont(AdempierePLAF.getFont_Label());
|
||||||
infoLine.setBorder(BorderFactory.createRaisedBevelBorder());
|
infoLine.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary2()));
|
||||||
infoLine.setHorizontalAlignment(SwingConstants.CENTER);
|
infoLine.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
infoLine.setHorizontalTextPosition(SwingConstants.CENTER);
|
infoLine.setHorizontalTextPosition(SwingConstants.CENTER);
|
||||||
infoLine.setText("info");
|
infoLine.setText("info");
|
||||||
|
|
|
@ -28,6 +28,7 @@ import javax.swing.event.*;
|
||||||
import javax.swing.table.*;
|
import javax.swing.table.*;
|
||||||
|
|
||||||
import org.adempiere.plaf.AdempiereLookAndFeel;
|
import org.adempiere.plaf.AdempiereLookAndFeel;
|
||||||
|
import org.adempiere.plaf.AdempierePLAF;
|
||||||
import org.compiere.apps.*;
|
import org.compiere.apps.*;
|
||||||
import org.compiere.grid.ed.*;
|
import org.compiere.grid.ed.*;
|
||||||
import org.compiere.grid.tree.*;
|
import org.compiere.grid.tree.*;
|
||||||
|
@ -311,6 +312,10 @@ public class GridController extends CPanel
|
||||||
//FR [ 1757088 ]
|
//FR [ 1757088 ]
|
||||||
vPanel = new VPanel(mTab.getName(), m_WindowNo);
|
vPanel = new VPanel(mTab.getName(), m_WindowNo);
|
||||||
vPanel.putClientProperty(AdempiereLookAndFeel.HIDE_IF_ONE_TAB, Boolean.TRUE);
|
vPanel.putClientProperty(AdempiereLookAndFeel.HIDE_IF_ONE_TAB, Boolean.TRUE);
|
||||||
|
if (this.isDetailGrid())
|
||||||
|
{
|
||||||
|
vPanel.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getPrimary2()));
|
||||||
|
}
|
||||||
vPane.getViewport().add(xPanel, null);
|
vPane.getViewport().add(xPanel, null);
|
||||||
xPanel.add(vPanel, BorderLayout.CENTER);
|
xPanel.add(vPanel, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
@ -463,6 +468,8 @@ public class GridController extends CPanel
|
||||||
//FR [ 1757088 ]
|
//FR [ 1757088 ]
|
||||||
public void setDetailGrid(boolean value){
|
public void setDetailGrid(boolean value){
|
||||||
detailGrid = value;
|
detailGrid = value;
|
||||||
|
if (detailGrid && vPanel != null)
|
||||||
|
vPanel.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getPrimary2()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDetailGrid(){
|
public boolean isDetailGrid(){
|
||||||
|
@ -907,13 +914,15 @@ public class GridController extends CPanel
|
||||||
boolean noData = m_mTab.getRowCount() == 0;
|
boolean noData = m_mTab.getRowCount() == 0;
|
||||||
log.config(m_mTab.toString() + " - Rows=" + m_mTab.getRowCount());
|
log.config(m_mTab.toString() + " - Rows=" + m_mTab.getRowCount());
|
||||||
// All Components in vPanel (Single Row)
|
// All Components in vPanel (Single Row)
|
||||||
|
|
||||||
|
Set hiddens = new HashSet<String>();
|
||||||
Component[] comps = vPanel.getComponentsRecursive();
|
Component[] comps = vPanel.getComponentsRecursive();
|
||||||
for (int i = 0; i < comps.length; i++)
|
for (int i = 0; i < comps.length; i++)
|
||||||
{
|
{
|
||||||
Component comp = comps[i];
|
Component comp = comps[i];
|
||||||
String columnName = comp.getName();
|
String columnName = comp.getName();
|
||||||
|
|
||||||
if (columnName != null)
|
if (columnName != null && columnName.length() > 0)
|
||||||
{
|
{
|
||||||
GridField mField = m_mTab.getField(columnName);
|
GridField mField = m_mTab.getField(columnName);
|
||||||
if (mField != null)
|
if (mField != null)
|
||||||
|
@ -952,12 +961,63 @@ public class GridController extends CPanel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (comp.isVisible())
|
else
|
||||||
comp.setVisible(false);
|
{
|
||||||
|
if (comp.isVisible())
|
||||||
|
comp.setVisible(false);
|
||||||
|
hiddens.add(columnName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // all components
|
} // all components
|
||||||
log.config(m_mTab.toString() + " - fini - " + (col<=0 ? "complete" : "seletive"));
|
|
||||||
|
// 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 (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
|
} // dynamicDisplay
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -211,6 +211,7 @@ public final class VPanel extends CTabbedPane
|
||||||
m_gbc.weightx = 1;
|
m_gbc.weightx = 1;
|
||||||
m_gbc.ipadx = 0;
|
m_gbc.ipadx = 0;
|
||||||
m_main.add(m_tab,m_gbc);
|
m_main.add(m_tab,m_gbc);
|
||||||
|
m_tab.setName("IncludedTab#"+AD_Tab_ID);
|
||||||
|
|
||||||
if (includedTabList.containsKey(AD_Tab_ID))
|
if (includedTabList.containsKey(AD_Tab_ID))
|
||||||
{
|
{
|
||||||
|
@ -234,7 +235,14 @@ public final class VPanel extends CTabbedPane
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addGroup(fieldGroup, fieldGroupType)) // sets top
|
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;
|
sameLine = false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fieldGroup = m_oldFieldGroup;
|
fieldGroup = m_oldFieldGroup;
|
||||||
|
@ -402,7 +410,7 @@ public final class VPanel extends CTabbedPane
|
||||||
setupCollapsiblePaneLayout(m_tab);
|
setupCollapsiblePaneLayout(m_tab);
|
||||||
CompoundBorder border = (CompoundBorder)m_tab.getBorder();
|
CompoundBorder border = (CompoundBorder)m_tab.getBorder();
|
||||||
m_tab.setBorder(new CompoundBorder(border.getOutsideBorder(), BorderFactory.createEmptyBorder(0, 0, 2, 0)));
|
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.anchor = GridBagConstraints.NORTHWEST;
|
||||||
//m_gbc.gridy = 0; // line
|
//m_gbc.gridy = 0; // line
|
||||||
m_gbc.gridx = 0;
|
m_gbc.gridx = 0;
|
||||||
|
|
Loading…
Reference in New Issue