Search in sources :

Example 6 with DialogComponentBoolean

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

the class AbstractFieldExtractorNodeDialog method createUIComponentFor.

/**
 * Creates the necessary {@link SettingsModel}s, adds the listener to the
 * checkbox and creates the UI component with a horizontally oriented group
 * containing the checkbox and text field. Then closes the group.
 * @param timeField name of the time field for which the ui component
 * should be created
 */
protected void createUIComponentFor(final String timeField) {
    // create the settings models and add listener
    SettingsModelBoolean checkBoxModel = createUseTimeFieldModel(timeField);
    SettingsModelString colNameModel = createTimeFieldColumnNameModel(timeField);
    addListener(checkBoxModel, colNameModel);
    createNewGroup("");
    setHorizontalPlacement(true);
    addDialogComponent(new DialogComponentBoolean(checkBoxModel, timeField));
    addDialogComponent(new DialogComponentString(colNameModel, "Column name:", true, 20));
    closeCurrentGroup();
    setHorizontalPlacement(false);
}
Also used : SettingsModelBoolean(org.knime.core.node.defaultnodesettings.SettingsModelBoolean) DialogComponentString(org.knime.core.node.defaultnodesettings.DialogComponentString) DialogComponentBoolean(org.knime.core.node.defaultnodesettings.DialogComponentBoolean) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 7 with DialogComponentBoolean

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

the class DecTreePredictorNodeFactory method createNodeDialogPane.

/**
 * {@inheritDoc}
 */
@Override
public NodeDialogPane createNodeDialogPane() {
    return new DefaultNodeSettingsPane() {

        {
            addDialogComponent(new DialogComponentNumber(DecTreePredictorNodeModel.createMaxNumPatternSettings(), /* label: */
            "Maximum number of stored patterns " + "for HiLite-ing: ", 100));
            addDialogComponent(new DialogComponentBoolean(new SettingsModelBoolean(DecTreePredictorNodeModel.SHOW_DISTRIBUTION, false), "Append columns with normalized class distribution"));
        }
    };
}
Also used : SettingsModelBoolean(org.knime.core.node.defaultnodesettings.SettingsModelBoolean) DialogComponentNumber(org.knime.core.node.defaultnodesettings.DialogComponentNumber) DialogComponentBoolean(org.knime.core.node.defaultnodesettings.DialogComponentBoolean) DefaultNodeSettingsPane(org.knime.core.node.defaultnodesettings.DefaultNodeSettingsPane)

Example 8 with DialogComponentBoolean

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

the class PredictorHelper method addPredictionColumn.

/**
 * Adds the prediction column name to the {@code dialog}. After that horizontal placement is set. <br>
 * Please make sure to initialize the {@code changePredictionColName} model properly or fire the model state change
 * listeners.
 *
 * @param dialog A {@link DefaultNodeSettingsPane}.
 * @param predictionColumn The {@link SettingsModelString} for the custom prediction column.
 * @param changePredictionColName The {@link SettingsModelBoolean} for overriding the prediction column.
 * @return The created {@link DialogComponentString}, although the dialog will also contain a checkbox to
 *         enable/disable the custom column name.
 */
public DialogComponentString addPredictionColumn(final DefaultNodeSettingsPane dialog, final SettingsModelString predictionColumn, final SettingsModelBoolean changePredictionColName) {
    final DialogComponentString ret = new DialogComponentString(predictionColumn, "Prediction column: ", true, 40);
    // dialog.createNewGroup("Prediction Column");
    dialog.closeCurrentGroup();
    dialog.setHorizontalPlacement(true);
    DialogComponentBoolean changeDefault = new DialogComponentBoolean(changePredictionColName, CHANGE_PREDICTION_COLUMN_NAME);
    changeDefault.setToolTipText("Allows to override the default column name for the predictions.");
    changePredictionColName.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(final ChangeEvent e) {
            ret.getModel().setEnabled(changePredictionColName.getBooleanValue());
        }
    });
    dialog.addDialogComponent(changeDefault);
    dialog.addDialogComponent(ret);
    // TODO add a dummy dialogcomponent to initialize the button.
    dialog.closeCurrentGroup();
    return ret;
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) DialogComponentString(org.knime.core.node.defaultnodesettings.DialogComponentString) DialogComponentBoolean(org.knime.core.node.defaultnodesettings.DialogComponentBoolean) ChangeListener(javax.swing.event.ChangeListener)

Example 9 with DialogComponentBoolean

use of org.knime.core.node.defaultnodesettings.DialogComponentBoolean 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 10 with DialogComponentBoolean

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

Aggregations

DialogComponentBoolean (org.knime.core.node.defaultnodesettings.DialogComponentBoolean)20 DialogComponentString (org.knime.core.node.defaultnodesettings.DialogComponentString)9 JPanel (javax.swing.JPanel)7 GridBagConstraints (java.awt.GridBagConstraints)5 GridBagLayout (java.awt.GridBagLayout)5 SettingsModelString (org.knime.core.node.defaultnodesettings.SettingsModelString)5 SettingsModelBoolean (org.knime.core.node.defaultnodesettings.SettingsModelBoolean)4 Box (javax.swing.Box)3 DialogComponent (org.knime.core.node.defaultnodesettings.DialogComponent)3 DialogComponentNumber (org.knime.core.node.defaultnodesettings.DialogComponentNumber)3 DialogComponentStringSelection (org.knime.core.node.defaultnodesettings.DialogComponentStringSelection)3 BorderLayout (java.awt.BorderLayout)2 ChangeEvent (javax.swing.event.ChangeEvent)2 ChangeListener (javax.swing.event.ChangeListener)2 DialogComponentColumnFilter2 (org.knime.core.node.defaultnodesettings.DialogComponentColumnFilter2)2 SettingsModelInteger (org.knime.core.node.defaultnodesettings.SettingsModelInteger)2 Component (java.awt.Component)1 Dimension (java.awt.Dimension)1 Insets (java.awt.Insets)1 Arrays (java.util.Arrays)1