use of org.jdesktop.swingx.JXCollapsiblePane in project adempiere by adempiere.
the class VPanel method addGroup.
// addField
/**
* Add Group
* @param fieldGroup field group
* @param fieldGroupType
* @return true if group added
*/
private boolean addGroup(String fieldGroup, String fieldGroupType) {
// First time - add top
if (m_oldFieldGroup == null) {
m_oldFieldGroup = "";
m_oldFieldGroupType = "";
}
if (fieldGroup == null || fieldGroup.length() == 0 || fieldGroup.equals(m_oldFieldGroup))
return false;
//[ 1757088 ]
if (m_tablist.get(fieldGroup) != null) {
return false;
}
//[ 1757088 ]
if (fieldGroupType.equals(X_AD_FieldGroup.FIELDGROUPTYPE_Tab)) {
CPanel m_tab = new CPanel();
m_tab.setBackground(AdempierePLAF.getFormBackground());
String tpConstraints = defaultLayoutConstraints;
MigLayout layout = new MigLayout(tpConstraints);
layout.addLayoutCallback(callback);
m_tab.setLayout(layout);
m_tab.setName(fieldGroup);
CPanel dummy = new CPanel();
dummy.setLayout(new BorderLayout());
dummy.add(m_tab, BorderLayout.NORTH);
dummy.setName(m_tab.getName());
dummy.setBorder(BorderFactory.createEmptyBorder(10, 12, 0, 12));
this.add(dummy);
m_tablist.put(fieldGroup, m_tab);
} else if (fieldGroupType.equals(X_AD_FieldGroup.FIELDGROUPTYPE_Collapse)) {
CollapsiblePanel collapsibleSection = new CollapsiblePanel(fieldGroup);
JXCollapsiblePane m_tab = collapsibleSection.getCollapsiblePane();
m_tab.setAnimated(false);
m_tab.getContentPane().setBackground(AdempierePLAF.getFormBackground());
String cpConstraints = defaultLayoutConstraints;
// 0 inset left and right as this is a nested panel
// 0 inset top because of the struts added below
cpConstraints += ", ins 0 0 n 0";
MigLayout layout = new MigLayout(cpConstraints);
layout.addLayoutCallback(callback);
collapsibleSection.setName(fieldGroup);
m_main.add(collapsibleSection, "newline, spanx, growx");
m_tab.setLayout(layout);
/* for compatibility with old layout, force collapsible field groups
* to have a minimum of two columns by inserting invisible components
*/
Component strut1 = Box.createVerticalStrut(1);
strut1.setName("vstrut1" + fieldGroup);
Component strut2 = Box.createVerticalStrut(1);
strut2.setName("vstrut2" + fieldGroup);
m_tab.add(new CLabel(""), "gap 0 0 0 0");
m_tab.add(strut1, "pushx, growx, gap 0 0 0 0");
m_tab.add(new CLabel(""), "");
m_tab.add(strut2, "pushx, growx, gap 0 0 0 0, wrap");
m_tablist.put(fieldGroup, collapsibleSection);
} else // Label or null
{
CLabel label = new CLabel(fieldGroup, CLabel.LEADING);
label.setFont(AdempierePLAF.getFont_Label().deriveFont(Font.BOLDITALIC, AdempierePLAF.getFont_Label().getSize2D()));
// BR [ 359 ]
// Show label completely
m_main.add(label, "newline, alignx leading, spanx, growx");
m_main.add(new JSeparator(), "newline, spanx, growx");
// reset
}
m_oldFieldGroup = fieldGroup;
m_oldFieldGroupType = fieldGroupType;
return true;
}
use of org.jdesktop.swingx.JXCollapsiblePane in project clusterMaker2 by RBVI.
the class ScatterPlotDialog method createUI.
private void createUI() {
panelXAxis = new JPanel();
panelYAxis = new JPanel();
panelButtons = new JPanel();
labelXAxis = new JLabel("X - Axis: ");
labelYAxis = new JLabel("Y - Axis: ");
labelPointSize = new JLabel("Size of points: ");
textFieldPointSize = new JTextField(2);
collapsiblePaneOptions = new JXCollapsiblePane();
// collapsiblePaneLegend = new JXCollapsiblePane();
buttonPlot = new JButton("Plot");
buttonOptions = new JButton("Advanced");
if (loadings != null)
buttonLegend = new JButton("Arrow Legend");
buttonColor = new JButton("Get Colors");
buttonLayout = new JButton("Copy Layout");
container.setLayout(new GridBagLayout());
container.removeAll();
ScatterPlot scatterPlot = new ScatterPlot(manager, scores, loadings, 0, 1, pointColor, 3, loadingsColorMap, useLoadings);
GridBagConstraints constraints = new GridBagConstraints();
constraints.anchor = GridBagConstraints.NORTHWEST;
constraints.insets = new Insets(5, 5, 5, 5);
constraints.gridx = 0;
constraints.gridy = 0;
constraints.weightx = 1.0;
constraints.weighty = 1.0;
constraints.fill = GridBagConstraints.BOTH;
container.add(scatterPlot, constraints);
if (useLoadings) {
constraints.gridx = 1;
constraints.weightx = 0;
constraints.weighty = 0;
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.NORTHEAST;
legendPanel = createLegendPane();
container.add(legendPanel, constraints);
}
constraints.gridx = 0;
constraints.gridy = 1;
constraints.gridwidth = 2;
constraints.weightx = 1.0;
constraints.weighty = 0;
constraints.anchor = GridBagConstraints.SOUTHWEST;
constraints.fill = GridBagConstraints.HORIZONTAL;
container.add(createControlJPanel(scores, loadings), constraints);
container.setBorder(BorderFactory.createEtchedBorder());
}
use of org.jdesktop.swingx.JXCollapsiblePane in project adempiere by adempiere.
the class StackedBox method addBox.
/**
* Adds a new component to this <code>StackedBox</code>
*
* @param title
* @param component
*/
public void addBox(String title, Component component) {
final JXCollapsiblePane collapsible = new JXCollapsiblePane();
collapsible.getContentPane().setBackground(Color.WHITE);
collapsible.add(component);
collapsible.setBorder(new CompoundBorder(separatorBorder, collapsible.getBorder()));
Action toggleAction = collapsible.getActionMap().get(JXCollapsiblePane.TOGGLE_ACTION);
// use the collapse/expand icons from the JTree UI
toggleAction.putValue(JXCollapsiblePane.COLLAPSE_ICON, UIManager.getIcon("Tree.expandedIcon"));
toggleAction.putValue(JXCollapsiblePane.EXPAND_ICON, UIManager.getIcon("Tree.collapsedIcon"));
JXHyperlink link = new JXHyperlink(toggleAction);
link.setText(title);
link.setFont(link.getFont().deriveFont(Font.BOLD));
link.setOpaque(true);
link.setBackground(getTitleBackgroundColor());
link.setFocusPainted(false);
link.setUnclickedColor(getTitleForegroundColor());
link.setClickedColor(getTitleForegroundColor());
link.setBorder(new CompoundBorder(separatorBorder, BorderFactory.createEmptyBorder(2, 4, 2, 4)));
link.setBorderPainted(true);
add(link);
add(collapsible);
}
Aggregations