Search in sources :

Example 71 with Box

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;
}
Also used : JLabel(javax.swing.JLabel) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox)

Example 72 with Box

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);
}
Also used : JPanel(javax.swing.JPanel) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox)

Example 73 with Box

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);
}
Also used : JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) JRadioButton(javax.swing.JRadioButton) DataColumnSpecFilterPanel(org.knime.core.node.util.filter.column.DataColumnSpecFilterPanel) ActionListener(java.awt.event.ActionListener) BorderLayout(java.awt.BorderLayout) ButtonGroup(javax.swing.ButtonGroup) ActionEvent(java.awt.event.ActionEvent) Box(javax.swing.Box) DomainOverflowPolicy(org.knime.base.node.preproc.domain.editnumeric.EditNumericDomainNodeModel.DomainOverflowPolicy)

Example 74 with Box

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;
}
Also used : JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) ButtonGroup(javax.swing.ButtonGroup) BoxLayout(javax.swing.BoxLayout) Box(javax.swing.Box) Dimension(java.awt.Dimension)

Example 75 with Box

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;
}
Also used : JCheckBox(javax.swing.JCheckBox) DocumentListener(javax.swing.event.DocumentListener) ChangeEvent(javax.swing.event.ChangeEvent) JLabel(javax.swing.JLabel) ChangeListener(javax.swing.event.ChangeListener) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField) DocumentEvent(javax.swing.event.DocumentEvent) FocusListener(java.awt.event.FocusListener) FocusEvent(java.awt.event.FocusEvent)

Aggregations

Box (javax.swing.Box)192 JCheckBox (javax.swing.JCheckBox)95 JLabel (javax.swing.JLabel)93 JPanel (javax.swing.JPanel)87 Dimension (java.awt.Dimension)65 BorderLayout (java.awt.BorderLayout)51 JButton (javax.swing.JButton)48 JComboBox (javax.swing.JComboBox)46 JScrollPane (javax.swing.JScrollPane)42 BoxLayout (javax.swing.BoxLayout)38 ActionEvent (java.awt.event.ActionEvent)31 ActionListener (java.awt.event.ActionListener)28 JTextField (javax.swing.JTextField)25 EmptyBorder (javax.swing.border.EmptyBorder)19 Insets (java.awt.Insets)17 SearchFilterPanel (pcgen.gui2.filter.SearchFilterPanel)14 FlippingSplitPane (pcgen.gui2.tools.FlippingSplitPane)14 TitledBorder (javax.swing.border.TitledBorder)13 FilterBar (pcgen.gui2.filter.FilterBar)13 GridBagConstraints (java.awt.GridBagConstraints)12