Search in sources :

Example 16 with SettingsModelBoolean

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

the class RowKeyNodeModel2 method validateSettings.

/**
 * {@inheritDoc}
 */
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
    assert (settings != null);
    final SettingsModelBoolean replaceRowKeyModel = m_replaceKey.createCloneWithValidatedValue(settings);
    final SettingsModelBoolean appendRowKeyModel = m_appendRowKey.createCloneWithValidatedValue(settings);
    final SettingsModelString newRowKeyModel = m_newRowKeyColumn.createCloneWithValidatedValue(settings);
    final SettingsModelString newColNameModel = m_newColumnName.createCloneWithValidatedValue(settings);
    validateInput(null, appendRowKeyModel.getBooleanValue(), newColNameModel.getStringValue(), replaceRowKeyModel.getBooleanValue(), newRowKeyModel.getStringValue(), appendRowKeyModel.getBooleanValue());
}
Also used : SettingsModelBoolean(org.knime.core.node.defaultnodesettings.SettingsModelBoolean) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 17 with SettingsModelBoolean

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

the class NumericRowSplitterNodeModel method validateSettings.

/**
 * {@inheritDoc}
 */
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
    m_columnSelection.validateSettings(settings);
    m_lowerBound.validateSettings(settings);
    m_lowerBoundCheck.validateSettings(settings);
    m_lowerBoundValue.validateSettings(settings);
    m_upperBound.validateSettings(settings);
    m_upperBoundCheck.validateSettings(settings);
    m_upperBoundValue.validateSettings(settings);
    SettingsModelBoolean lowerBoundCheck = m_lowerBoundCheck.createCloneWithValidatedValue(settings);
    SettingsModelBoolean upperBoundCheck = m_upperBoundCheck.createCloneWithValidatedValue(settings);
    if (lowerBoundCheck.getBooleanValue() && upperBoundCheck.getBooleanValue()) {
        SettingsModelDouble lowerBoundValue = m_lowerBoundValue.createCloneWithValidatedValue(settings);
        double low = lowerBoundValue.getDoubleValue();
        SettingsModelDouble upperBoundValue = m_upperBoundValue.createCloneWithValidatedValue(settings);
        double upp = upperBoundValue.getDoubleValue();
        if (low > upp) {
            throw new InvalidSettingsException("Check lower and upper " + "bound values: " + low + " > " + upp);
        }
        if (low == upp) {
            SettingsModelString lowerBound = m_lowerBound.createCloneWithValidatedValue(settings);
            boolean inclLow = NumericRowSplitterNodeDialogPane.includeLowerBound(lowerBound);
            SettingsModelString upperBound = m_upperBound.createCloneWithValidatedValue(settings);
            boolean inclUpp = NumericRowSplitterNodeDialogPane.includeUpperBound(upperBound);
            if ((inclLow ^ inclUpp) || (!inclLow & !inclUpp)) {
                throw new InvalidSettingsException("Lower and upper bounds " + "are inconsistent with borders!");
            }
        }
    }
}
Also used : SettingsModelBoolean(org.knime.core.node.defaultnodesettings.SettingsModelBoolean) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) SettingsModelDouble(org.knime.core.node.defaultnodesettings.SettingsModelDouble) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 18 with SettingsModelBoolean

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

the class DecisionTreeLearnerNodeDialog method createSettingsSkipNominalColumnsWithoutDomain.

/**
 * @return binary nominal split mode
 */
static SettingsModelBoolean createSettingsSkipNominalColumnsWithoutDomain() {
    SettingsModelBoolean setting = new SettingsModelBoolean(DecisionTreeLearnerNodeModel.KEY_SKIP_COLUMNS, DecisionTreeLearnerNodeModel.DEFAULT_BINARY_NOMINAL_SPLIT_MODE);
    setting.setBooleanValue(true);
    return setting;
}
Also used : SettingsModelBoolean(org.knime.core.node.defaultnodesettings.SettingsModelBoolean)

Example 19 with SettingsModelBoolean

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

the class DecisionTreeLearnerNodeDialog method createSettingsFilterNominalValuesFromParent.

/**
 * @param skipNominalColumnsWithoutDomainModel model to listen to for
 * enablement (only enable if binary nominal splits)
 * @return model representing {@link
 * DecisionTreeLearnerNodeModel#KEY_FILTER_NOMINAL_VALUES_FROM_PARENT}
 */
static SettingsModelBoolean createSettingsFilterNominalValuesFromParent(final SettingsModelBoolean skipNominalColumnsWithoutDomainModel) {
    final SettingsModelBoolean model = new SettingsModelBoolean(DecisionTreeLearnerNodeModel.KEY_FILTER_NOMINAL_VALUES_FROM_PARENT, false);
    skipNominalColumnsWithoutDomainModel.addChangeListener(new ChangeListener() {

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

Example 20 with SettingsModelBoolean

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

the class AbstractDifferenceChecker method createIgnoreDomainPossibleValuesOrderingModel.

private static final SettingsModelBoolean createIgnoreDomainPossibleValuesOrderingModel(final SettingsModelBoolean ignoreDomainsModel) {
    SettingsModelBoolean result = new SettingsModelBoolean("ignoreDomainPossibleValuesOrdering", false);
    ignoreDomainsModel.addChangeListener(e -> result.setEnabled(!ignoreDomainsModel.getBooleanValue()));
    result.setEnabled(!ignoreDomainsModel.getBooleanValue());
    return result;
}
Also used : SettingsModelBoolean(org.knime.core.node.defaultnodesettings.SettingsModelBoolean)

Aggregations

SettingsModelBoolean (org.knime.core.node.defaultnodesettings.SettingsModelBoolean)36 SettingsModelString (org.knime.core.node.defaultnodesettings.SettingsModelString)15 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)13 ChangeEvent (javax.swing.event.ChangeEvent)5 ChangeListener (javax.swing.event.ChangeListener)5 IOException (java.io.IOException)4 CanceledExecutionException (org.knime.core.node.CanceledExecutionException)4 DialogComponentBoolean (org.knime.core.node.defaultnodesettings.DialogComponentBoolean)4 DialogComponentString (org.knime.core.node.defaultnodesettings.DialogComponentString)4 File (java.io.File)3 DataTableSpec (org.knime.core.data.DataTableSpec)3 RowKey (org.knime.core.data.RowKey)3 BufferedDataTable (org.knime.core.node.BufferedDataTable)3 ExecutionContext (org.knime.core.node.ExecutionContext)3 ExecutionMonitor (org.knime.core.node.ExecutionMonitor)3 NodeModel (org.knime.core.node.NodeModel)3 NodeSettingsRO (org.knime.core.node.NodeSettingsRO)3 NodeSettingsWO (org.knime.core.node.NodeSettingsWO)3 DateTimeException (java.time.DateTimeException)2 Duration (java.time.Duration)2