Search in sources :

Example 16 with AbstractButton

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

the class AbstractHistogramProperties method addAggrMethodListener.

/**
 * @param listener adds the listener to the aggregation method button
 * group
 */
protected void addAggrMethodListener(final ActionListener listener) {
    final Enumeration<AbstractButton> buttons = m_aggrMethButtonGrp.getElements();
    while (buttons.hasMoreElements()) {
        final AbstractButton button = buttons.nextElement();
        button.addActionListener(listener);
    }
}
Also used : AbstractButton(javax.swing.AbstractButton)

Example 17 with AbstractButton

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

the class RankNodeDialog method saveSettingsTo.

/**
 * {@inheritDoc}
 */
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
    String[] rankColNames = new String[m_rankTableModel.getRowCount()];
    String[] order = new String[m_rankTableModel.getRowCount()];
    for (int r = 0; r < m_rankTableModel.getRowCount(); r++) {
        rankColNames[r] = ((DataColumnSpec) m_rankTableModel.getValueAt(r, 0)).getName();
        order[r] = (String) m_rankTableModel.getValueAt(r, 1);
    }
    String[] groupColNames = new String[m_groupTableModel.getRowCount()];
    for (int r = 0; r < m_groupTableModel.getRowCount(); r++) {
        groupColNames[r] = ((DataColumnSpec) m_groupTableModel.getValueAt(r, 0)).getName();
    }
    // get selected mode
    Enumeration<AbstractButton> buttons = m_modusGroup.getElements();
    String modus = null;
    while (buttons.hasMoreElements()) {
        AbstractButton currentButton = buttons.nextElement();
        if (m_modusGroup.isSelected(currentButton.getModel())) {
            modus = currentButton.getText();
        }
    }
    m_rankMode.setStringValue(modus);
    m_rankColsModel.setStringArrayValue(rankColNames);
    m_rankOrderModel.setStringArrayValue(order);
    m_groupColsModel.setStringArrayValue(groupColNames);
    m_retainRowOrder.setBooleanValue(m_retainOrderCheckBox.isSelected());
    m_rankOutColName.setStringValue(m_outColNameTextField.getText());
    m_rankAsLong.setBooleanValue(m_rankAsLongCheckBox.isSelected());
    validateSettings(settings);
    // save settings models
    m_rankColsModel.saveSettingsTo(settings);
    m_rankOrderModel.saveSettingsTo(settings);
    m_groupColsModel.saveSettingsTo(settings);
    m_rankMode.saveSettingsTo(settings);
    m_rankOutColName.saveSettingsTo(settings);
    m_retainRowOrder.saveSettingsTo(settings);
    m_rankAsLong.saveSettingsTo(settings);
}
Also used : AbstractButton(javax.swing.AbstractButton) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 18 with AbstractButton

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

the class PieProperties method updatePanel.

/**
 * @param vizModel the actual {@link PieVizModel}
 */
public void updatePanel(final D vizModel) {
    if (vizModel == null) {
        return;
    }
    // select the actual aggregation method
    final Enumeration<AbstractButton> buttons = m_aggrMethButtonGrp.getElements();
    while (buttons.hasMoreElements()) {
        final AbstractButton button = buttons.nextElement();
        if (button.getActionCommand().equals(vizModel.getAggregationMethod().name())) {
            button.setSelected(true);
        }
        button.setEnabled(vizModel.getAggregationColumnName() != null);
    }
    m_explodeSelectedSections.setSelected(vizModel.explodeSelectedSections());
    final Enumeration<AbstractButton> labels = m_labelDisplayPolicy.getElements();
    while (labels.hasMoreElements()) {
        final AbstractButton button = labels.nextElement();
        if (button.getActionCommand().equals(vizModel.getLabelDisplayPolicy().getActionCommand())) {
            button.setSelected(true);
        }
    }
    m_pieSize.setValue((int) (vizModel.getPieSize() * 100));
    m_explodeSize.setValue((int) vizModel.getExplodeSize() * 100);
    m_showDetails.setSelected(vizModel.showDetails());
    m_showMissingValSection.setSelected(vizModel.showMissingValSection());
    enableMissingSectionOption(vizModel.hasMissingSection());
    enableShowDetailsOption(vizModel.detailsAvailable());
    m_showSectionOutline.setSelected(vizModel.drawSectionOutline());
    updatePanelInternal(vizModel);
}
Also used : AbstractButton(javax.swing.AbstractButton)

Example 19 with AbstractButton

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

the class CharsetNamePanel method overrideSettings.

/**
 * Writes the current settings of the panel into the passed settings object.
 *
 * @param settings the object to write settings in
 * @return true if the new settings are different from the one passed in.
 * @since 3.2
 */
public boolean overrideSettings(final FileReaderNodeSettings settings) {
    String oldCSN = settings.getCharsetName();
    String newCSN = null;
    Enumeration<AbstractButton> buttons = m_group.getElements();
    while (buttons.hasMoreElements()) {
        AbstractButton b = buttons.nextElement();
        if (b.isSelected()) {
            newCSN = b.getActionCommand();
            if (CUSTOM_LABEL.equals(newCSN)) {
                newCSN = m_customName.getText();
            } else if (DEFAULT_LABEL.equals(newCSN)) {
                newCSN = null;
            }
            settings.setCharsetName(newCSN);
            break;
        }
    }
    boolean changed;
    if (oldCSN == null) {
        changed = newCSN != null;
    } else {
        changed = !oldCSN.equals(newCSN);
    }
    if (changed) {
        settings.setCharsetUserSet(true);
    }
    return changed;
}
Also used : AbstractButton(javax.swing.AbstractButton)

Example 20 with AbstractButton

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

the class CharsetNamePanel method loadSettings.

/**
 * @param settings
 * @since 3.1
 */
public void loadSettings(final FileReaderSettings settings) {
    String csName = settings.getCharsetName();
    if (csName == null) {
        // the default
        m_default.setSelected(true);
    } else {
        boolean foundIt = false;
        Enumeration<AbstractButton> buttons = m_group.getElements();
        while (buttons.hasMoreElements()) {
            AbstractButton b = buttons.nextElement();
            if (csName.equals(b.getActionCommand())) {
                foundIt = true;
                b.setSelected(true);
                break;
            }
        }
        if (!foundIt) {
            m_custom.setSelected(true);
            m_customName.setText(csName);
        }
    }
}
Also used : AbstractButton(javax.swing.AbstractButton)

Aggregations

AbstractButton (javax.swing.AbstractButton)50 JLabel (javax.swing.JLabel)8 JPanel (javax.swing.JPanel)8 Component (java.awt.Component)7 ButtonModel (javax.swing.ButtonModel)7 JRadioButton (javax.swing.JRadioButton)5 JButton (javax.swing.JButton)4 Dimension (java.awt.Dimension)3 File (java.io.File)3 ArrayList (java.util.ArrayList)3 NotConfigurableException (org.knime.core.node.NotConfigurableException)3 FlowLayout (java.awt.FlowLayout)2 GridBagConstraints (java.awt.GridBagConstraints)2 Insets (java.awt.Insets)2 ActionEvent (java.awt.event.ActionEvent)2 MouseEvent (java.awt.event.MouseEvent)2 JComboBox (javax.swing.JComboBox)2 JComponent (javax.swing.JComponent)2 JFileChooser (javax.swing.JFileChooser)2 JTextField (javax.swing.JTextField)2