Search in sources :

Example 1 with SettingsModelInteger

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

the class DateTimeShiftNodeModel method createNumericalValueModel.

/**
 * @param numericalSelectionModel model for the numerical selection button group
 * @return the string model, used in both dialog and model.
 */
public static SettingsModelInteger createNumericalValueModel(final SettingsModelString numericalSelectionModel) {
    final SettingsModelInteger model = new SettingsModelInteger("numerical_value", 1);
    numericalSelectionModel.addChangeListener(l -> model.setEnabled(numericalSelectionModel.getStringValue().equals(NumericalMode.Value.name()) && numericalSelectionModel.isEnabled()));
    model.setEnabled(false);
    return model;
}
Also used : SettingsModelInteger(org.knime.core.node.defaultnodesettings.SettingsModelInteger)

Example 2 with SettingsModelInteger

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

the class AbstractHistogramNodeModel method validateSettings.

/**
 * {@inheritDoc}
 */
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
    final SettingsModelBoolean model = m_allRows.createCloneWithValidatedValue(settings);
    if (!model.getBooleanValue()) {
        // read the spinner value only if the user hasn't selected to
        // retrieve all values
        m_noOfRows.validateSettings(settings);
        final SettingsModelInteger copy = m_noOfRows.createCloneWithValidatedValue(settings);
        if (copy.getIntValue() <= 0) {
            throw new InvalidSettingsException("No of rows must be greater zero");
        }
    }
    try {
        m_xColName.validateSettings(settings);
    } catch (final Throwable e) {
        // It's an older node which hasn't stored the aggregation column
        final String xCol = settings.getString("xColumn");
        if (xCol == null || xCol.length() < 1) {
            throw new InvalidSettingsException("Invalid binning column");
        }
    }
    try {
        m_aggrColName.validateSettings(settings);
    } catch (final Throwable e) {
        // It's an older node which hasn't stored the aggregation column
        LOGGER.debug("Exception while validating settings: " + e.getMessage());
    }
}
Also used : SettingsModelBoolean(org.knime.core.node.defaultnodesettings.SettingsModelBoolean) SettingsModelInteger(org.knime.core.node.defaultnodesettings.SettingsModelInteger) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 3 with SettingsModelInteger

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

the class ReadTableNodeModel method createLimitSpinnerModel.

/**
 * @param limitCheckerModel to register for enable/disable.
 * @return
 */
static final SettingsModelInteger createLimitSpinnerModel(final SettingsModelBoolean limitCheckerModel) {
    final SettingsModelInteger result = new SettingsModelInteger("limitRowsCount", 100000);
    limitCheckerModel.addChangeListener(new ChangeListener() {

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

Example 4 with SettingsModelInteger

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

the class TableToVariableNodeDialog method getReplaceInteger.

/**
 * @param policyModel The policy model.
 * @return the SM for the new integer value.
 */
static final SettingsModelInteger getReplaceInteger(final SettingsModelString policyModel) {
    SettingsModelInteger model = new SettingsModelInteger("CFG_Integer", 0);
    ChangeListener listener = new PolicyChangeListener(policyModel, model);
    policyModel.addChangeListener(listener);
    listener.stateChanged(null);
    return model;
}
Also used : SettingsModelInteger(org.knime.core.node.defaultnodesettings.SettingsModelInteger) ChangeListener(javax.swing.event.ChangeListener)

Aggregations

SettingsModelInteger (org.knime.core.node.defaultnodesettings.SettingsModelInteger)4 ChangeListener (javax.swing.event.ChangeListener)2 ChangeEvent (javax.swing.event.ChangeEvent)1 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)1 SettingsModelBoolean (org.knime.core.node.defaultnodesettings.SettingsModelBoolean)1 SettingsModelString (org.knime.core.node.defaultnodesettings.SettingsModelString)1