Search in sources :

Example 61 with Box

use of javax.swing.Box in project knime-core by knime.

the class DateInputDialog method initialize.

/**
 * This method initializes the dialog Component, with standard values. Which are later on overwritten by the load
 * method. All possible JComponets are created and initialized nevertheless they might not be used due to different
 * configurations.
 */
private void initialize() {
    m_useSeconds = new JCheckBox();
    m_useMinutes = new JCheckBox();
    m_useHours = new JCheckBox();
    m_useDate = new JCheckBox();
    m_hours = new JSpinner(new SpinnerNumberModel(0, 0, 23, 1));
    m_hours.setMaximumSize(new Dimension(SPINNER_WIDTH, 25));
    m_hours.setMinimumSize(new Dimension(SPINNER_WIDTH, 25));
    m_minutes = new JSpinner(new SpinnerNumberModel(0, 0, 59, 1));
    m_minutes.setMaximumSize(new Dimension(SPINNER_WIDTH, 25));
    m_minutes.setMinimumSize(new Dimension(SPINNER_WIDTH, 25));
    m_seconds = new JSpinner(new SpinnerNumberModel(0, 0, 59, 1));
    m_seconds.setMaximumSize(new Dimension(SPINNER_WIDTH, 25));
    m_seconds.setMinimumSize(new Dimension(SPINNER_WIDTH, 25));
    m_startDate = new JDateChooser() {

        {
            // fixes bug AP-5865
            popup.setFocusable(false);
        }
    };
    m_startDate.setLocale(Locale.US);
    m_startDate.getJCalendar().getCalendar().setTimeZone(TimeZone.getTimeZone("UTC"));
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    setMinimumSize(new Dimension(PANEL_WIDTH, 60));
    Box outerBox = Box.createVerticalBox();
    Box dateBox = Box.createHorizontalBox();
    if (m_isOptional) {
        dateBox.add(m_useDate);
        dateBox.add(Box.createHorizontalStrut(HORIZ_SPACE));
    }
    dateBox.add(m_startDate);
    dateBox.add(Box.createHorizontalStrut(HORIZ_SPACE));
    dateBox.setPreferredSize(new Dimension(PANEL_WIDTH, 25));
    dateBox.setMaximumSize(new Dimension(PANEL_WIDTH, 25));
    dateBox.setMinimumSize(new Dimension(PANEL_WIDTH, 25));
    outerBox.add(dateBox);
    Box timeBox = Box.createHorizontalBox();
    if (m_displayHours) {
        if (m_optionalTime) {
            timeBox.add(m_useHours);
        }
        timeBox.add(new JLabel("Hour: "));
        timeBox.add(m_hours);
        timeBox.add(Box.createHorizontalStrut(HORIZ_SPACE));
        timeBox.add(Box.createHorizontalStrut(HORIZ_SPACE));
        if (m_displayMinutes) {
            if (m_optionalTime) {
                timeBox.add(m_useMinutes);
            }
            timeBox.add(new JLabel("Minute: "));
            timeBox.add(m_minutes);
            timeBox.add(Box.createHorizontalStrut(HORIZ_SPACE));
            timeBox.add(Box.createHorizontalStrut(HORIZ_SPACE));
            if (m_displaySeconds) {
                if (m_optionalTime) {
                    timeBox.add(m_useSeconds);
                }
                timeBox.add(new JLabel("Second: "));
                timeBox.add(m_seconds);
                timeBox.add(Box.createHorizontalStrut(HORIZ_SPACE));
            }
        }
    }
    timeBox.add(Box.createHorizontalGlue());
    outerBox.setMaximumSize(new Dimension(PANEL_WIDTH, 60));
    outerBox.setMinimumSize(new Dimension(PANEL_WIDTH, 60));
    outerBox.add(Box.createVerticalStrut(VERT_SPACE));
    outerBox.add(timeBox);
    if (m_isOptional) {
        m_startDate.setEnabled(false);
        m_useHours.setEnabled(false);
    } else {
        m_startDate.setEnabled(true);
        m_useHours.setEnabled(true);
    }
    m_useHours.setSelected(false);
    m_hours.setEnabled(false);
    m_useMinutes.setEnabled(false);
    m_minutes.setEnabled(false);
    m_useSeconds.setEnabled(false);
    m_seconds.setEnabled(false);
    m_useDate.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            if (m_useDate.isSelected()) {
                m_startDate.setEnabled(true);
                m_useHours.setEnabled(true);
            } else {
                m_startDate.setEnabled(false);
                m_startDate.cleanup();
                m_useHours.setSelected(false);
                m_useHours.setEnabled(false);
                m_hours.setEnabled(false);
                m_useMinutes.setEnabled(false);
                m_useMinutes.setSelected(false);
                m_minutes.setEnabled(false);
                m_useSeconds.setEnabled(false);
                m_useSeconds.setSelected(false);
                m_seconds.setEnabled(false);
            }
        }
    });
    m_useHours.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            if (m_useHours.isSelected()) {
                m_hours.setEnabled(true);
                m_useMinutes.setEnabled(true);
                m_minutes.setEnabled(false);
                m_useSeconds.setEnabled(false);
                m_seconds.setEnabled(false);
            } else {
                m_hours.setEnabled(false);
                m_useMinutes.setEnabled(false);
                m_useMinutes.setSelected(false);
                m_minutes.setEnabled(false);
                m_useSeconds.setEnabled(false);
                m_useSeconds.setSelected(false);
                m_seconds.setEnabled(false);
            }
        }
    });
    m_useMinutes.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            if (m_useMinutes.isSelected()) {
                m_minutes.setEnabled(true);
                m_useSeconds.setEnabled(true);
                m_seconds.setEnabled(false);
            } else {
                m_useMinutes.setSelected(false);
                m_minutes.setEnabled(false);
                m_useSeconds.setEnabled(false);
                m_useSeconds.setSelected(false);
                m_seconds.setEnabled(false);
                m_seconds.setEnabled(false);
            }
        }
    });
    m_useSeconds.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e) {
            if (m_useSeconds.isSelected()) {
                m_seconds.setEnabled(true);
            } else {
                m_seconds.setEnabled(false);
            }
        }
    });
    if (!m_optionalTime) {
        m_useHours.setSelected(true);
        m_useMinutes.setSelected(true);
        m_useSeconds.setSelected(true);
    }
    add(outerBox);
    add(Box.createVerticalStrut(VERT_SPACE));
}
Also used : JCheckBox(javax.swing.JCheckBox) SpinnerNumberModel(javax.swing.SpinnerNumberModel) JDateChooser(com.toedter.calendar.JDateChooser) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JSpinner(javax.swing.JSpinner) JLabel(javax.swing.JLabel) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox) Dimension(java.awt.Dimension)

Example 62 with Box

use of javax.swing.Box in project knime-core by knime.

the class AbstractHistogramProperties method createBinSettingsPanel.

/**
 * The bin related settings:
 * <ol>
 * <li>size</li>
 * <li>number of bins</li>
 * <li>show empty bins</li>
 * <li>show missing value bin</li>
 * </ol>.
 *
 * @return the panel with all bar related settings
 */
private JPanel createBinSettingsPanel() {
    final Box binNoBox = Box.createVerticalBox();
    // barNoBox.setBorder(BorderFactory
    // .createEtchedBorder(EtchedBorder.RAISED));
    // the number of bars label box
    final Box noOfBinsLabelBox = Box.createHorizontalBox();
    final JLabel noOfBinsLabel = new JLabel(AbstractHistogramProperties.NUMBER_OF_BINS_LABEL);
    noOfBinsLabelBox.add(Box.createHorizontalGlue());
    noOfBinsLabelBox.add(noOfBinsLabel);
    noOfBinsLabelBox.add(Box.createHorizontalGlue());
    binNoBox.add(noOfBinsLabelBox);
    // the number of bins slider box
    final Box noOfBinsSliderBox = Box.createHorizontalBox();
    noOfBinsSliderBox.add(Box.createHorizontalGlue());
    noOfBinsSliderBox.add(m_noOfBins);
    noOfBinsSliderBox.add(Box.createHorizontalGlue());
    binNoBox.add(noOfBinsSliderBox);
    // the box with the select boxes and apply button
    final Box binSelButtonBox = Box.createVerticalBox();
    // barSelButtonBox.setBorder(BorderFactory
    // .createEtchedBorder(EtchedBorder.RAISED));
    final Box binSelectBox = Box.createVerticalBox();
    // barSelectBox.setBorder(BorderFactory
    // .createEtchedBorder(EtchedBorder.RAISED));
    binSelectBox.add(m_showEmptyBins);
    binSelectBox.add(Box.createVerticalGlue());
    binSelectBox.add(m_showMissingValBin);
    binSelectBox.add(m_showInvalidValBin);
    binSelectBox.add(Box.createVerticalGlue());
    binSelButtonBox.add(binSelectBox);
    binSelButtonBox.add(Box.createVerticalGlue());
    // final Box buttonBox = Box.createHorizontalBox();
    // // buttonBox.setBorder(BorderFactory
    // // .createEtchedBorder(EtchedBorder.RAISED));
    // final Dimension d = new Dimension(75, 1);
    // buttonBox.add(Box.createRigidArea(d));
    // buttonBox.add(m_applyBarSettingsButton);
    // barSelButtonBox.add(buttonBox);
    final Box binBox = Box.createHorizontalBox();
    binBox.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
    binBox.add(Box.createHorizontalGlue());
    binBox.add(binNoBox);
    binBox.add(Box.createHorizontalGlue());
    binBox.add(binSelButtonBox);
    final JPanel binPanel = new JPanel();
    binPanel.add(binBox);
    return binPanel;
}
Also used : JPanel(javax.swing.JPanel) JLabel(javax.swing.JLabel) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox)

Example 63 with Box

use of javax.swing.Box in project knime-core by knime.

the class AbstractHistogramProperties method createVizSettingsPanel.

/**
 * The visualization panel with the following options:
 * <ol>
 * <li>Show grid line</li>
 * <li>Show bar outline</li>
 * </ol>.
 *
 * @return the visualization settings panel
 */
private JPanel createVizSettingsPanel() {
    final JPanel vizPanel = new JPanel();
    // visualisation box
    final Box vizBox = Box.createVerticalBox();
    vizBox.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Display option"));
    vizBox.add(Box.createVerticalGlue());
    vizBox.add(m_showGrid);
    vizBox.add(Box.createVerticalGlue());
    vizBox.add(m_showBinOutline);
    vizBox.add(Box.createVerticalGlue());
    vizBox.add(m_showBarOutline);
    vizBox.add(Box.createVerticalGlue());
    vizBox.add(Box.createVerticalGlue());
    vizBox.add(m_showElementOutline);
    // label layout box
    final Box labelBox = Box.createHorizontalBox();
    labelBox.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Labels"));
    labelBox.add(Box.createHorizontalGlue());
    final Box labelDisplayBox = GUIUtils.createButtonGroupBox(m_labelDisplayPolicy, true, null, false);
    labelBox.add(labelDisplayBox);
    labelBox.add(Box.createHorizontalGlue());
    final Box labelOrientationBox = GUIUtils.createButtonGroupBox(m_labelOrientation, true, LABEL_ORIENTATION_LABEL, false);
    labelBox.add(labelOrientationBox);
    labelBox.add(Box.createHorizontalGlue());
    // bar layout box
    final Box layoutDisplayBox = GUIUtils.createButtonGroupBox(m_layoutDisplayPolicy, false, null, false);
    final Box binWidthBox = Box.createVerticalBox();
    // barWidthBox.setBorder(BorderFactory
    // .createEtchedBorder(EtchedBorder.RAISED));
    final Box binWidthLabelBox = Box.createHorizontalBox();
    final JLabel binWidthLabel = new JLabel(AbstractHistogramProperties.BIN_SIZE_LABEL);
    binWidthLabelBox.add(Box.createHorizontalGlue());
    binWidthLabelBox.add(binWidthLabel);
    binWidthLabelBox.add(Box.createHorizontalGlue());
    binWidthBox.add(binWidthLabelBox);
    // the bin width slider box
    final Box binWidthSliderBox = Box.createHorizontalBox();
    binWidthSliderBox.add(Box.createHorizontalGlue());
    binWidthSliderBox.add(m_binWidth);
    binWidthSliderBox.add(Box.createHorizontalGlue());
    binWidthBox.add(binWidthSliderBox);
    final Box barLayoutBox = Box.createVerticalBox();
    barLayoutBox.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Bar Layout"));
    barLayoutBox.add(Box.createVerticalGlue());
    barLayoutBox.add(binWidthBox);
    barLayoutBox.add(Box.createVerticalGlue());
    barLayoutBox.add(layoutDisplayBox);
    barLayoutBox.add(Box.createVerticalGlue());
    final Box rootBox = Box.createHorizontalBox();
    rootBox.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
    rootBox.add(Box.createRigidArea(HORIZONTAL_SPACER_DIM));
    rootBox.add(vizBox);
    rootBox.add(Box.createHorizontalGlue());
    rootBox.add(labelBox);
    rootBox.add(Box.createHorizontalGlue());
    rootBox.add(barLayoutBox);
    rootBox.add(Box.createRigidArea(HORIZONTAL_SPACER_DIM));
    vizPanel.add(rootBox);
    return vizPanel;
}
Also used : JPanel(javax.swing.JPanel) JLabel(javax.swing.JLabel) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox)

Example 64 with Box

use of javax.swing.Box in project knime-core by knime.

the class ColumnResorterNodeDialog method initButtonBox.

/**
 * @return Creates and returns the panel containing the buttons.
 */
private Box initButtonBox() {
    Box buttonBox = Box.createVerticalBox();
    buttonBox.setBorder(new TitledBorder("Actions"));
    JButton buttonAZ = new JButton("A-Z");
    JButton buttonZA = new JButton("Z-A");
    JButton moveFirst = new JButton("Move First");
    JButton moveLast = new JButton("Move Last");
    JButton buttonUp = new JButton("Up");
    JButton buttonDown = new JButton("Down");
    JButton buttonOriginal = new JButton("Reset");
    // same size for all buttons
    Dimension allButtons = moveFirst.getPreferredSize();
    buttonAZ.setMinimumSize(allButtons);
    buttonAZ.setMaximumSize(allButtons);
    buttonZA.setMinimumSize(allButtons);
    buttonZA.setMaximumSize(allButtons);
    buttonUp.setMinimumSize(allButtons);
    buttonUp.setMaximumSize(allButtons);
    buttonDown.setMinimumSize(allButtons);
    buttonDown.setMaximumSize(allButtons);
    moveLast.setMinimumSize(allButtons);
    moveLast.setMaximumSize(allButtons);
    buttonOriginal.setMaximumSize(allButtons);
    buttonOriginal.setMinimumSize(allButtons);
    buttonBox.add(buttonAZ);
    buttonBox.add(buttonZA);
    buttonBox.add(buttonUp);
    buttonBox.add(buttonDown);
    buttonBox.add(moveFirst);
    buttonBox.add(moveLast);
    buttonBox.add(buttonOriginal);
    buttonOriginal.addActionListener(new ActionListener() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void actionPerformed(final ActionEvent e) {
            m_listModel.removeAllElements();
            for (DataColumnSpec col : m_origColOrder) {
                m_listModel.addElement(col);
            }
            // add dummy element "<any unknown new column>".
            m_listModel.addElement(DataColumnSpecListDummyCellRenderer.UNKNOWN_COL_DUMMY);
            m_jlist.ensureIndexIsVisible(0);
        }
    });
    buttonAZ.addActionListener(new ActionListener() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void actionPerformed(final ActionEvent e) {
            DataColumnSpec[] tmp = getSortedCols();
            m_listModel.removeAllElements();
            for (int i = 0; i < tmp.length; i++) {
                m_listModel.insertElementAt(tmp[i], i);
            }
            m_jlist.ensureIndexIsVisible(0);
        }
    });
    buttonZA.addActionListener(new ActionListener() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void actionPerformed(final ActionEvent e) {
            DataColumnSpec[] tmp = getSortedCols();
            m_listModel.removeAllElements();
            for (int i = tmp.length - 1; i >= 0; i--) {
                m_listModel.insertElementAt(tmp[i], tmp.length - i - 1);
            }
            m_jlist.ensureIndexIsVisible(0);
        }
    });
    buttonUp.addActionListener(new ActionListener() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void actionPerformed(final ActionEvent e) {
            if (m_jlist.getSelectedIndex() != -1) {
                int[] indices = m_jlist.getSelectedIndices();
                moveUp(indices);
            } else {
                LOGGER.info("Please select a column.");
            }
        }
    });
    buttonDown.addActionListener(new ActionListener() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void actionPerformed(final ActionEvent e) {
            if (m_jlist.getSelectedIndex() != -1) {
                int[] indices = m_jlist.getSelectedIndices();
                moveDown(indices);
            } else {
                LOGGER.info("Please select a column.");
            }
        }
    });
    moveFirst.addActionListener(new ActionListener() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void actionPerformed(final ActionEvent e) {
            if (m_jlist.getSelectedIndex() != -1) {
                int[] indices = m_jlist.getSelectedIndices();
                moveFirst(indices);
            } else {
                LOGGER.info("Please select a column.");
            }
        }
    });
    moveLast.addActionListener(new ActionListener() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void actionPerformed(final ActionEvent e) {
            if (m_jlist.getSelectedIndex() != -1) {
                int[] indices = m_jlist.getSelectedIndices();
                moveLast(indices);
            } else {
                LOGGER.info("Please select a column.");
            }
        }
    });
    return buttonBox;
}
Also used : DataColumnSpec(org.knime.core.data.DataColumnSpec) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) Box(javax.swing.Box) Dimension(java.awt.Dimension) TitledBorder(javax.swing.border.TitledBorder)

Example 65 with Box

use of javax.swing.Box in project knime-core by knime.

the class ColumnAggregatorNodeDialog method createAdvancedOptionsBox.

private JComponent createAdvancedOptionsBox() {
    // general option box
    final DialogComponentBoolean removeAggregationCols = new DialogComponentBoolean(m_removeAgregationCols, "Remove aggregation columns");
    m_components.add(removeAggregationCols);
    final DialogComponentBoolean removeRetainedCols = new DialogComponentBoolean(m_removeRetainedCols, "Remove retained columns");
    m_components.add(removeRetainedCols);
    final DialogComponent maxNoneNumericVals = new DialogComponentNumber(m_maxUniqueValues, "Maximum unique values per row", new Integer(1000), 5);
    m_components.add(maxNoneNumericVals);
    maxNoneNumericVals.setToolTipText("All rows with more unique values " + "will be skipped and replaced by a missing value");
    final DialogComponentString valueDelimiter = new DialogComponentString(m_valueDelimiter, "Value delimiter", false, 5);
    m_components.add(valueDelimiter);
    final Box upperBox = new Box(BoxLayout.X_AXIS);
    upperBox.add(Box.createGlue());
    upperBox.add(removeAggregationCols.getComponentPanel());
    upperBox.add(removeRetainedCols.getComponentPanel());
    upperBox.add(Box.createGlue());
    final Box lowerBox = new Box(BoxLayout.X_AXIS);
    lowerBox.add(Box.createGlue());
    lowerBox.add(maxNoneNumericVals.getComponentPanel());
    lowerBox.add(valueDelimiter.getComponentPanel());
    lowerBox.add(Box.createGlue());
    final Box generalBox = new Box(BoxLayout.Y_AXIS);
    generalBox.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), " Advanced settings "));
    generalBox.add(upperBox);
    generalBox.add(lowerBox);
    return generalBox;
}
Also used : SettingsModelInteger(org.knime.core.node.defaultnodesettings.SettingsModelInteger) DialogComponentString(org.knime.core.node.defaultnodesettings.DialogComponentString) DialogComponentBoolean(org.knime.core.node.defaultnodesettings.DialogComponentBoolean) DialogComponentNumber(org.knime.core.node.defaultnodesettings.DialogComponentNumber) Box(javax.swing.Box) DialogComponent(org.knime.core.node.defaultnodesettings.DialogComponent)

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