use of javax.swing.Box in project knime-core by knime.
the class PieProperties method createColumnSettingsBox.
/**
* @return the column information box
*/
private static Box createColumnSettingsBox(final JComponent pieCol, final JComponent aggrCol) {
// the x column box
final Box xColumnBox = Box.createHorizontalBox();
// xColumnBox.setBorder(BorderFactory
// .createEtchedBorder(EtchedBorder.RAISED));
final JLabel xColLabelLabel = new JLabel(PieProperties.PIE_COLUMN_LABEL);
xColumnBox.add(Box.createRigidArea(HORIZONTAL_SPACER_DIM));
xColumnBox.add(xColLabelLabel);
xColumnBox.add(Box.createHorizontalGlue());
xColumnBox.add(pieCol);
xColumnBox.add(Box.createRigidArea(HORIZONTAL_SPACER_DIM));
// the aggregation column box
final Box aggrColumnBox = Box.createHorizontalBox();
// xColumnBox.setBorder(BorderFactory
// .createEtchedBorder(EtchedBorder.RAISED));
final JLabel aggrColLabelLabel = new JLabel(PieProperties.AGGREGATION_COLUMN_LABEL);
aggrColumnBox.add(Box.createRigidArea(HORIZONTAL_SPACER_DIM));
aggrColumnBox.add(aggrColLabelLabel);
aggrColumnBox.add(Box.createHorizontalGlue());
aggrColumnBox.add(aggrCol);
aggrColumnBox.add(Box.createRigidArea(HORIZONTAL_SPACER_DIM));
// final Box aggrColumnBox = Box.createHorizontalBox();
// aggrColumnBox.add(m_aggrCol);
// aggrColumnBox.add(Box.createRigidArea(HORIZONTAL_SPACER_DIM));
// the box which surround both column selection boxes
final Box columnsBox = Box.createVerticalBox();
columnsBox.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), COLUMNS_BORDER_LABEL));
columnsBox.add(Box.createVerticalGlue());
columnsBox.add(xColumnBox);
columnsBox.add(Box.createVerticalGlue());
columnsBox.add(aggrColumnBox);
columnsBox.add(Box.createVerticalGlue());
return columnsBox;
}
use of javax.swing.Box in project knime-core by knime.
the class PieProperties method addColumnTab.
/**
* @param pieCol the pie column component
* @param aggrCol the aggregation column component
*/
protected void addColumnTab(final JComponent pieCol, final JComponent aggrCol) {
// the column select tab
final Box aggrLabelButtonBox = GUIUtils.createButtonGroupBox(m_aggrMethButtonGrp, true, AGGREGATION_METHOD_LABEL, true);
final Box rootBox = Box.createHorizontalBox();
rootBox.add(aggrLabelButtonBox);
rootBox.add(Box.createHorizontalStrut(5));
rootBox.add(createColumnSettingsBox(pieCol, aggrCol));
final JPanel columnPanel = new JPanel();
columnPanel.add(rootBox);
final int tabCount = getTabCount();
int colTabIdx = 1;
if (tabCount < 1) {
colTabIdx = 0;
}
insertTab(COLUMN_TAB_LABEL, null, columnPanel, null, colTabIdx);
}
use of javax.swing.Box in project knime-core by knime.
the class EditNumericDomainNodeDialogPane method createMinMaxTab.
private void createMinMaxTab() {
m_filterPanel = new DataColumnSpecFilterPanel();
m_filterPanel.setIncludeTitle(" Include ");
m_filterPanel.setExcludeTitle(" Exclude ");
m_lowerBField = createTextField("0.0");
m_upperBField = createTextField("1.0");
JPanel retainMinMaxPanel = new JPanel(new GridLayout(2, 2));
retainMinMaxPanel.setBorder(BorderFactory.createTitledBorder("Domain"));
createBoundedBox(retainMinMaxPanel, m_lowerBField, LOWER_B + ": ");
createBoundedBox(retainMinMaxPanel, m_upperBField, UPPER_B + ": ");
Box outOfDomainBox = Box.createVerticalBox();
outOfDomainBox.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Out of Domain Policy"));
m_buttonGrp = new ButtonGroup();
for (final DomainOverflowPolicy handler : DomainOverflowPolicy.values()) {
JRadioButton jRadioButton = new JRadioButton(handler.getDescription());
jRadioButton.setActionCommand(handler.toString());
jRadioButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
m_handler = handler;
}
});
m_buttonGrp.add(jRadioButton);
outOfDomainBox.add(jRadioButton, Component.LEFT_ALIGNMENT);
}
JPanel tabpanel = new JPanel();
tabpanel.setLayout(new BorderLayout());
tabpanel.add(m_filterPanel, BorderLayout.NORTH);
tabpanel.add(retainMinMaxPanel, BorderLayout.WEST);
outOfDomainBox.add(Box.createHorizontalGlue());
tabpanel.add(outOfDomainBox, BorderLayout.SOUTH);
addTab("Edit Domain", tabpanel);
}
use of javax.swing.Box in project knime-core by knime.
the class RowFilterNodeDialogPane method createDialogPanel.
protected JPanel createDialogPanel() {
JPanel result = new JPanel();
result.setLayout(new BoxLayout(result, BoxLayout.X_AXIS));
// the panel on the left side for the filter selection
Box selectionBox = Box.createVerticalBox();
selectionBox.setMaximumSize(new Dimension(300, 500));
m_rangeInclRadio = new JRadioButton("Include rows by number");
m_rangeExclRadio = new JRadioButton("Exclude rows by number");
m_rangeInclRadio.setActionCommand("range");
m_rangeExclRadio.setActionCommand("range");
addActionListener(m_rangeInclRadio);
addActionListener(m_rangeExclRadio);
m_rowIDInclRadio = new JRadioButton("Include rows by row ID");
m_rowIDExclRadio = new JRadioButton("Exclude rows by row ID");
m_rowIDInclRadio.setActionCommand("id");
m_rowIDExclRadio.setActionCommand("id");
addActionListener(m_rowIDInclRadio);
addActionListener(m_rowIDExclRadio);
m_colValInclRadio = new JRadioButton("Include rows by attribute value");
m_colValExclRadio = new JRadioButton("Exclude rows by attribute value");
m_colValInclRadio.setActionCommand("colval");
m_colValExclRadio.setActionCommand("colval");
addActionListener(m_colValInclRadio);
addActionListener(m_colValExclRadio);
// only one at a time should be selected
ButtonGroup group = new ButtonGroup();
group.add(m_rangeInclRadio);
group.add(m_rangeExclRadio);
group.add(m_rowIDInclRadio);
group.add(m_rowIDExclRadio);
group.add(m_colValInclRadio);
group.add(m_colValExclRadio);
selectionBox.add(Box.createVerticalGlue());
selectionBox.add(m_colValInclRadio);
selectionBox.add(m_colValExclRadio);
selectionBox.add(Box.createVerticalStrut(3));
selectionBox.add(m_rangeInclRadio);
selectionBox.add(m_rangeExclRadio);
selectionBox.add(Box.createVerticalStrut(3));
selectionBox.add(m_rowIDInclRadio);
selectionBox.add(m_rowIDExclRadio);
selectionBox.add(Box.createVerticalGlue());
// the panel containing the filter panels. They will be instantiated
// in loadSettings
m_filterPanel = new JPanel();
m_filterPanel.setLayout(new BoxLayout(m_filterPanel, BoxLayout.Y_AXIS));
m_filterPanel.setPreferredSize(new Dimension(400, 400));
result.add(selectionBox);
result.add(Box.createHorizontalStrut(7));
result.add(m_filterPanel);
return result;
}
use of javax.swing.Box in project knime-core by knime.
the class LimitRowsPanel method getLimitPanel.
private Container getLimitPanel() {
m_limitRows = new JCheckBox("Read only the first");
m_maxNumber = new JTextField();
m_maxNumber.setColumns(6);
m_maxNumber.setPreferredSize(new Dimension(125, 25));
m_maxNumber.setMaximumSize(new Dimension(125, 25));
m_limitRows.setSelected(false);
m_maxNumber.setEnabled(false);
// make sure we always have a valid value. Reject invalid characters.
m_maxNumber.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void removeUpdate(final DocumentEvent e) {
checkAndFixTextfield();
}
@Override
public void insertUpdate(final DocumentEvent e) {
checkAndFixTextfield();
}
@Override
public void changedUpdate(final DocumentEvent e) {
checkAndFixTextfield();
}
});
m_maxNumber.addFocusListener(new FocusListener() {
@Override
public void focusLost(final FocusEvent e) {
if (m_maxNumber.getText().trim().length() == 0) {
// can't handle no empty strings.
m_lastValidValue = "0";
m_maxNumber.setText(m_lastValidValue);
}
}
@Override
public void focusGained(final FocusEvent e) {
}
});
m_limitRows.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent e) {
// en/disable the textfield
m_maxNumber.setEnabled(m_limitRows.isSelected());
// also - if the textfield is enabled and empty set a value
if (m_maxNumber.isEnabled()) {
if ((m_maxNumber.getText() == null) || (m_maxNumber.getText().trim().length() == 0)) {
// set a valid value, so we can safely assume that if there is a value in there it's always valid.
m_maxNumber.setText("1000");
m_lastValidValue = "1000";
}
}
}
});
Box result = Box.createHorizontalBox();
result.add(m_limitRows);
result.add(Box.createHorizontalStrut(3));
result.add(m_maxNumber);
result.add(Box.createHorizontalStrut(3));
result.add(new JLabel("table rows from the file."));
result.add(Box.createHorizontalGlue());
return result;
}
Aggregations