Search in sources :

Example 6 with SettingsModelString

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

the class ExtractDurationPeriodFieldsNodeModel method createSubsecondUnitsModel.

/**
 * @return the string model, used in both dialog and model.
 */
static SettingsModelString createSubsecondUnitsModel(final SettingsModelBoolean boolModel) {
    final SettingsModelString settingsModelString = new SettingsModelString("subsecond_units", Granularity.MILLISECOND.toString());
    settingsModelString.setEnabled(false);
    boolModel.addChangeListener(l -> settingsModelString.setEnabled(boolModel.getBooleanValue()));
    return settingsModelString;
}
Also used : SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 7 with SettingsModelString

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

the class DateTimeDifferenceNodeModel method validateSettings.

/**
 * {@inheritDoc}
 */
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
    m_col1stSelectModel.validateSettings(settings);
    m_col2ndSelectModel.validateSettings(settings);
    m_modusSelectModel.validateSettings(settings);
    SettingsModelString temp = createModusSelection();
    temp.loadSettingsFrom(settings);
    try {
        ModusOptions.valueOf(temp.getStringValue());
    } catch (IllegalArgumentException ex) {
        throw new InvalidSettingsException("Unknown difference modus '" + temp.getStringValue() + "'");
    }
    m_fixedDateTimeModel.validateSettings(settings);
    m_calculationSelectModel.validateSettings(settings);
    m_granularityModel.validateSettings(settings);
    m_newColNameModel.validateSettings(settings);
}
Also used : InvalidSettingsException(org.knime.core.node.InvalidSettingsException) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 8 with SettingsModelString

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

the class DateTimeDifferenceNodeModel method createGranularityModel.

/**
 * @return the string model, used in both dialog and model.
 */
static SettingsModelString createGranularityModel(final SettingsModelString calcSelectionModel) {
    final SettingsModelString granularityModel = new SettingsModelString("granularity", Granularity.DAY.toString());
    calcSelectionModel.addChangeListener(l -> granularityModel.setEnabled(calcSelectionModel.getStringValue().equals(OutputMode.Granularity.name())));
    return granularityModel;
}
Also used : SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 9 with SettingsModelString

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

the class DurationPeriodToStringNodeModel method createSuffixModel.

/**
 * @param replaceOrAppendModel model for the replace/append button group
 * @return the string model, used in both dialog and model.
 */
public static SettingsModelString createSuffixModel(final SettingsModelString replaceOrAppendModel) {
    final SettingsModelString suffixModel = new SettingsModelString("suffix", "(String)");
    replaceOrAppendModel.addChangeListener(e -> suffixModel.setEnabled(replaceOrAppendModel.getStringValue().equals(OPTION_APPEND)));
    suffixModel.setEnabled(false);
    return suffixModel;
}
Also used : SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 10 with SettingsModelString

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

the class OldToNewTimeNodeModel method createSuffixModel.

/**
 * @param replaceOrAppendModel model for the replace/append button group
 * @return the string model, used in both dialog and model.
 */
public static SettingsModelString createSuffixModel(final SettingsModelString replaceOrAppendModel) {
    final SettingsModelString suffixModel = new SettingsModelString("suffix", "(new Date&Time)");
    replaceOrAppendModel.addChangeListener(e -> suffixModel.setEnabled(replaceOrAppendModel.getStringValue().equals(OPTION_APPEND)));
    suffixModel.setEnabled(false);
    return suffixModel;
}
Also used : SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Aggregations

SettingsModelString (org.knime.core.node.defaultnodesettings.SettingsModelString)99 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)39 SettingsModelBoolean (org.knime.core.node.defaultnodesettings.SettingsModelBoolean)15 ChangeListener (javax.swing.event.ChangeListener)13 ChangeEvent (javax.swing.event.ChangeEvent)12 IOException (java.io.IOException)8 CanceledExecutionException (org.knime.core.node.CanceledExecutionException)8 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 File (java.io.File)4 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 DateTimeException (java.time.DateTimeException)3