Search in sources :

Example 16 with SettingsModelString

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

the class ModifyTimeNodeDialog method loadSettingsFrom.

/**
 * {@inheritDoc}
 */
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final DataTableSpec[] specs) throws NotConfigurableException {
    m_spec = specs[0];
    m_dialogCompReplaceOrAppend.loadSettingsFrom(settings, specs);
    m_dialogCompSuffix.loadSettingsFrom(settings, specs);
    m_dialogCompModifySelect.loadSettingsFrom(settings, specs);
    m_dialogCompTime.loadSettingsFrom(settings, specs);
    m_dialogCompTimeZone.loadSettingsFrom(settings, specs);
    m_filterOnlyLocalDate = ((SettingsModelString) m_dialogCompModifySelect.getModel()).getStringValue().equals(ModifyTimeNodeModel.MODIFY_OPTION_APPEND);
    final DataColumnSpecFilterConfiguration filterConfiguration = ModifyTimeNodeModel.createDCFilterConfiguration(m_filterOnlyLocalDate ? ModifyTimeNodeModel.LOCAL_DATE_FILTER : ModifyTimeNodeModel.DATE_TIME_FILTER);
    filterConfiguration.loadConfigurationInDialog(settings, specs[0]);
    m_dialogCompColFilter.loadConfiguration(filterConfiguration, specs[0]);
}
Also used : DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 17 with SettingsModelString

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

the class ModifyTimeZoneNodeDialog method loadSettingsFrom.

/**
 * {@inheritDoc}
 */
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final DataTableSpec[] specs) throws NotConfigurableException {
    m_spec = specs[0];
    m_dialogCompReplaceOrAppend.loadSettingsFrom(settings, specs);
    m_dialogCompSuffix.loadSettingsFrom(settings, specs);
    m_dialogCompTimeZone.loadSettingsFrom(settings, specs);
    m_dialogCompModifySelect.loadSettingsFrom(settings, specs);
    m_includeLocalDateTime = ((SettingsModelString) m_dialogCompModifySelect.getModel()).getStringValue().equals(ModifyTimeZoneNodeModel.MODIFY_OPTION_SET);
    final DataColumnSpecFilterConfiguration filterConfiguration = ModifyTimeZoneNodeModel.createDCFilterConfiguration(m_includeLocalDateTime ? ModifyTimeZoneNodeModel.ZONED_AND_LOCAL_FILTER : ModifyTimeZoneNodeModel.ZONED_FILTER);
    filterConfiguration.loadConfigurationInDialog(settings, specs[0]);
    m_dialogCompColFilter.loadConfiguration(filterConfiguration, specs[0]);
}
Also used : DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 18 with SettingsModelString

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

the class ModifyTimeZoneNodeModel 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", "(modified time zone)");
    replaceOrAppendModel.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(final ChangeEvent e) {
            if (replaceOrAppendModel.getStringValue().equals(OPTION_APPEND)) {
                suffixModel.setEnabled(true);
            } else {
                suffixModel.setEnabled(false);
            }
        }
    });
    suffixModel.setEnabled(false);
    return suffixModel;
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 19 with SettingsModelString

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

the class DateShiftConfigure method createNewColNameModel.

/**
 * @param replaceColumnModel TODO
 * @return settings model for the new column name
 */
public static SettingsModelString createNewColNameModel(final SettingsModelBoolean replaceColumnModel) {
    final SettingsModelString result = new SettingsModelString(CFG_NEW_COL_NAME, "ShiftDate");
    replaceColumnModel.addChangeListener((e) -> result.setEnabled(!replaceColumnModel.getBooleanValue()));
    result.setEnabled(!replaceColumnModel.getBooleanValue());
    return result;
}
Also used : SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Example 20 with SettingsModelString

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

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