Search in sources :

Example 51 with SettingsModelString

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

the class DecisionTreeLearnerNodeDialog2 method createSettingsFirstSplitColumn.

/**
 * @return name of column to perform first split on
 */
static SettingsModelString createSettingsFirstSplitColumn(final SettingsModelBoolean useFirstSplitCol) {
    SettingsModelString firstSplitCol = new SettingsModelString(DecisionTreeLearnerNodeModel2.KEY_FIRST_SPLIT_COL, null);
    useFirstSplitCol.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(final ChangeEvent e) {
            firstSplitCol.setEnabled(((SettingsModelBoolean) e.getSource()).getBooleanValue());
        }
    });
    firstSplitCol.setEnabled(useFirstSplitCol.getBooleanValue());
    return firstSplitCol;
}
Also used : SettingsModelBoolean(org.knime.core.node.defaultnodesettings.SettingsModelBoolean) ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 52 with SettingsModelString

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

the class EntropyNodeDialogPane method createFlowPrefixModel.

/**
 * @param useNamePrefixModel TODO
 * @return A new {@link SettingsModelString} for the flow variable prefix
 * @since 3.2 Creates the settings model for the flow variable prefix
 */
public static SettingsModelString createFlowPrefixModel(final SettingsModelBoolean useNamePrefixModel) {
    final SettingsModelString result = new SettingsModelString("name prefix for flowvars", "");
    useNamePrefixModel.addChangeListener(new ChangeListener() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void stateChanged(final ChangeEvent e) {
            result.setEnabled(useNamePrefixModel.getBooleanValue());
        }
    });
    result.setEnabled(useNamePrefixModel.getBooleanValue());
    return result;
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 53 with SettingsModelString

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

the class SotaPredictorNodeModel method validateSettings.

/**
 * {@inheritDoc}
 */
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
    // Since 2.10
    try {
        SettingsModelString s = PredictorHelper.getInstance().createPredictionColumn();
        s.loadSettingsFrom(settings);
        if (s.getStringValue().isEmpty()) {
            throw new InvalidSettingsException("The prediction column name cannot be empty.");
        }
    } catch (InvalidSettingsException ex) {
    // Ignore
    }
}
Also used : InvalidSettingsException(org.knime.core.node.InvalidSettingsException) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 54 with SettingsModelString

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

the class CreateBitVectorNodeModel method createSingleColumnModel.

/**
 * @return the settings model holding the selected string column name
 */
static SettingsModelString createSingleColumnModel() {
    final SettingsModelString model = new SettingsModelString("singleColumnName", null);
    model.setEnabled(!ColumnType.getDefault().isMultiColumn());
    return model;
}
Also used : SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 55 with SettingsModelString

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

the class CreateBitVectorNodeModel method validateSettings.

/**
 * {@inheritDoc}
 */
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
    final ColumnType columnType = ColumnType.getType(((SettingsModelString) m_columnType.createCloneWithValidatedValue(settings)).getStringValue());
    final DataColumnSpecFilterConfiguration tmpMultiColumnConfig = createMultiColumnConfig(null);
    tmpMultiColumnConfig.loadConfigurationInModel(settings);
    m_mscPattern.validateSettings(settings);
    m_mscHasWildcards.validateSettings(settings);
    m_mscCaseSensitiv.validateSettings(settings);
    m_mscRegex.validateSettings(settings);
    SetMatching.get(((SettingsModelString) m_mscSetMatching.createCloneWithValidatedValue(settings)).getStringValue());
    m_threshold.validateSettings(settings);
    m_useMean.validateSettings(settings);
    m_meanPercentage.validateSettings(settings);
    final String singleCol = ((SettingsModelString) m_singleColumn.createCloneWithValidatedValue(settings)).getStringValue();
    if (!columnType.isMultiColumn() && singleCol == null) {
        throw new InvalidSettingsException("Please select the single column to process");
    }
    m_singleStringColumnType.validateSettings(settings);
    m_remove.validateSettings(settings);
    final String outCol = ((SettingsModelString) m_outputColumn.createCloneWithValidatedValue(settings)).getStringValue();
    if (outCol == null || outCol.trim().isEmpty()) {
        throw new InvalidSettingsException("Please specify the name of the output column");
    }
    m_failOnError.validateSettings(settings);
    BitVectorType.getType(((SettingsModelString) m_vectorType.createCloneWithValidatedValue(settings)).getStringValue());
}
Also used : DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Aggregations

SettingsModelString (org.knime.core.node.defaultnodesettings.SettingsModelString)96 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)36 SettingsModelBoolean (org.knime.core.node.defaultnodesettings.SettingsModelBoolean)15 ChangeListener (javax.swing.event.ChangeListener)13 ChangeEvent (javax.swing.event.ChangeEvent)12 IOException (java.io.IOException)7 CanceledExecutionException (org.knime.core.node.CanceledExecutionException)7 DialogComponentString (org.knime.core.node.defaultnodesettings.DialogComponentString)7 Duration (java.time.Duration)5 Period (java.time.Period)5 DateTimeParseException (java.time.format.DateTimeParseException)5 SettingsModelDateTime (org.knime.time.util.SettingsModelDateTime)5 LocalDate (java.time.LocalDate)4 LocalDateTime (java.time.LocalDateTime)4 ZonedDateTime (java.time.ZonedDateTime)4 Temporal (java.time.temporal.Temporal)4 TemporalAmount (java.time.temporal.TemporalAmount)4 DateTimeType (org.knime.time.util.DateTimeType)4 File (java.io.File)3 DateTimeException (java.time.DateTimeException)3