Search in sources :

Example 1 with DialogComponent

use of org.knime.core.node.defaultnodesettings.DialogComponent in project knime-core by knime.

the class SVMLearnerNodeDialog method saveSettingsTo.

/**
 * {@inheritDoc}
 */
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
    for (DialogComponent comp : m_components) {
        comp.saveSettingsTo(settings);
    }
    for (JRadioButton button : m_kernels) {
        if (button.isSelected()) {
            String s = button.getText();
            settings.addString(SVMLearnerNodeModel.CFG_KERNELTYPE, s);
        }
    }
}
Also used : JRadioButton(javax.swing.JRadioButton) DialogComponent(org.knime.core.node.defaultnodesettings.DialogComponent) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 2 with DialogComponent

use of org.knime.core.node.defaultnodesettings.DialogComponent in project knime-core by knime.

the class PredictorNodeDialog method loadSettingsFrom.

/**
 * {@inheritDoc}
 */
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
    extractTargetColumn(specs);
    for (DialogComponent comp : m_dialogComponents) {
        comp.loadSettingsFrom(settings, specs);
    }
    try {
        m_overridePredModel.loadSettingsFrom(settings);
    } catch (InvalidSettingsException ex) {
        getLogger().debug(ex.getMessage(), ex);
        m_overridePredModel.setEnabled(true);
        m_overridePredModel.setBooleanValue(false);
    }
    try {
        m_predictionColModel.loadSettingsFrom(settings);
    } catch (InvalidSettingsException ex) {
        getLogger().debug(ex.getMessage(), ex);
        m_predictionColModel.setEnabled(m_overridePredModel.getBooleanValue());
        m_predictionColModel.setStringValue("");
    }
    m_overridePred.getModel().setSelected(m_overridePredModel.getBooleanValue());
    try {
        m_addProbsModel.loadSettingsFrom(settings);
    } catch (InvalidSettingsException ex) {
        getLogger().debug(ex.getMessage(), ex);
        m_addProbsModel.setEnabled(true);
        m_addProbsModel.setBooleanValue(true);
    }
    m_addProbs.getModel().setSelected(m_addProbsModel.getBooleanValue());
    try {
        m_suffixModel.loadSettingsFrom(settings);
    } catch (InvalidSettingsException ex) {
        getLogger().debug(ex.getMessage(), ex);
        m_suffixModel.setEnabled(m_addProbsModel.getBooleanValue());
        m_suffixModel.setStringValue("");
    }
    for (ActionListener listener : m_addProbs.getActionListeners()) {
        listener.actionPerformed(null);
    }
    for (ActionListener listener : m_overridePred.getActionListeners()) {
        listener.actionPerformed(null);
    }
}
Also used : ActionListener(java.awt.event.ActionListener) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) DialogComponent(org.knime.core.node.defaultnodesettings.DialogComponent)

Example 3 with DialogComponent

use of org.knime.core.node.defaultnodesettings.DialogComponent 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)

Example 4 with DialogComponent

use of org.knime.core.node.defaultnodesettings.DialogComponent in project knime-core by knime.

the class GroupByNodeDialog method createAdvancedOptionsBox.

private JComponent createAdvancedOptionsBox() {
    final DialogComponent maxNoneNumericVals = new DialogComponentNumber(m_maxUniqueValues, "Maximum unique values per group", new Integer(1000), 5);
    maxNoneNumericVals.setToolTipText("All groups with more unique values " + "will be skipped and replaced by a missing value");
    final DialogComponentStringSelection colNamePolicy = new DialogComponentStringSelection(m_columnNamePolicy, "Column naming:", ColumnNamePolicy.getPolicyLabels());
    final DialogComponent enableHilite = new DialogComponentBoolean(m_enableHilite, "Enable hiliting");
    final DialogComponentString valueDelimiter = new DialogComponentString(m_valueDelimiter, "Value delimiter", false, 2);
    final DialogComponent inMemory = new DialogComponentBoolean(m_inMemory, "Process in memory");
    inMemory.setToolTipText("Processes all data in memory.");
    final DialogComponent retainOrder = new DialogComponentBoolean(m_retainOrder, "Retain row order");
    retainOrder.setToolTipText("Retains the original row order of the input table.");
    final JPanel rootPanel = new JPanel(new GridBagLayout());
    rootPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), " Advanced settings "));
    final GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.LINE_START;
    c.weightx = 0;
    c.weighty = 0;
    c.fill = GridBagConstraints.NONE;
    c.gridx = 0;
    c.gridy = 0;
    rootPanel.add(colNamePolicy.getComponentPanel(), c);
    c.gridx++;
    rootPanel.add(enableHilite.getComponentPanel(), c);
    c.gridx++;
    rootPanel.add(inMemory.getComponentPanel(), c);
    c.gridx++;
    rootPanel.add(retainOrder.getComponentPanel(), c);
    c.gridy++;
    c.gridx = 0;
    c.anchor = GridBagConstraints.FIRST_LINE_START;
    rootPanel.add(maxNoneNumericVals.getComponentPanel(), c);
    c.gridx++;
    c.anchor = GridBagConstraints.LINE_START;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridwidth = GridBagConstraints.REMAINDER;
    final JPanel fakePanel = new JPanel(new GridBagLayout());
    final GridBagConstraints gc = new GridBagConstraints();
    gc.anchor = GridBagConstraints.LINE_START;
    gc.gridx = 0;
    gc.gridy = 0;
    gc.fill = GridBagConstraints.NONE;
    fakePanel.add(valueDelimiter.getComponentPanel(), gc);
    gc.fill = GridBagConstraints.HORIZONTAL;
    gc.weightx = 1;
    gc.gridy++;
    fakePanel.add(new JPanel(), gc);
    rootPanel.add(fakePanel, c);
    return rootPanel;
}
Also used : SettingsModelInteger(org.knime.core.node.defaultnodesettings.SettingsModelInteger) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) DialogComponentStringSelection(org.knime.core.node.defaultnodesettings.DialogComponentStringSelection) DialogComponentString(org.knime.core.node.defaultnodesettings.DialogComponentString) DialogComponentNumber(org.knime.core.node.defaultnodesettings.DialogComponentNumber) DialogComponentBoolean(org.knime.core.node.defaultnodesettings.DialogComponentBoolean) DialogComponent(org.knime.core.node.defaultnodesettings.DialogComponent)

Example 5 with DialogComponent

use of org.knime.core.node.defaultnodesettings.DialogComponent in project knime-core by knime.

the class ColumnAggregatorNodeDialog method loadSettingsFrom.

/**
 * {@inheritDoc}
 */
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
    assert (specs.length == 1);
    m_spec = (DataTableSpec) specs[0];
    for (final DialogComponent component : m_components) {
        component.loadSettingsFrom(settings, specs);
    }
    try {
        m_aggrMethodsPanel.loadSettingsFrom(settings.getNodeSettings(ColumnAggregatorNodeModel.CFG_AGGREGATION_METHODS), getSuperType(), m_spec);
        m_version.loadSettingsFrom(settings);
    } catch (final InvalidSettingsException e) {
        throw new NotConfigurableException(e.getMessage(), e);
    }
}
Also used : NotConfigurableException(org.knime.core.node.NotConfigurableException) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) DialogComponent(org.knime.core.node.defaultnodesettings.DialogComponent)

Aggregations

DialogComponent (org.knime.core.node.defaultnodesettings.DialogComponent)7 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)3 DialogComponentBoolean (org.knime.core.node.defaultnodesettings.DialogComponentBoolean)2 DialogComponentNumber (org.knime.core.node.defaultnodesettings.DialogComponentNumber)2 DialogComponentString (org.knime.core.node.defaultnodesettings.DialogComponentString)2 SettingsModelInteger (org.knime.core.node.defaultnodesettings.SettingsModelInteger)2 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 ActionListener (java.awt.event.ActionListener)1 Box (javax.swing.Box)1 JPanel (javax.swing.JPanel)1 JRadioButton (javax.swing.JRadioButton)1 NotConfigurableException (org.knime.core.node.NotConfigurableException)1 DialogComponentStringSelection (org.knime.core.node.defaultnodesettings.DialogComponentStringSelection)1 SettingsModelString (org.knime.core.node.defaultnodesettings.SettingsModelString)1