use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class CreateDateTimeNodeModel method createDurationModel.
/**
* @return the string model, used in both dialog and model.
*/
static SettingsModelString createDurationModel(final SettingsModelString rowNrOptionSelectionModel, final SettingsModelString durationOrEndSelectionModel) {
final SettingsModelString settingsModelString = new SettingsModelString("duration", null);
final ChangeListener changeListener = e -> {
if (durationOrEndSelectionModel.getStringValue() != null && rowNrOptionSelectionModel.getStringValue() != null) {
settingsModelString.setEnabled(rowNrOptionSelectionModel.getStringValue().equals(RowNrMode.Variable.name()) || (rowNrOptionSelectionModel.getStringValue().equals(RowNrMode.Fixed.name()) && durationOrEndSelectionModel.getStringValue().equals(EndMode.Duration.name())));
}
};
rowNrOptionSelectionModel.addChangeListener(changeListener);
durationOrEndSelectionModel.addChangeListener(changeListener);
changeListener.stateChanged(new ChangeEvent(rowNrOptionSelectionModel));
return settingsModelString;
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class CreateDateTimeNodeModel method createEndModel.
/**
* @return the date&time model, used in both dialog and model.
*/
static SettingsModelDateTime createEndModel(final SettingsModelString rowNrOptionSelectionModel, final SettingsModelString durationOrEndSelectionModel, final SettingsModelBoolean useExecTimeModel) {
final SettingsModelDateTime settingsModelDateTime = new SettingsModelDateTime("end", LocalDateTime.now().withNano(0));
final ChangeListener changeListener = e -> {
if (durationOrEndSelectionModel.getStringValue() != null && rowNrOptionSelectionModel.getStringValue() != null) {
settingsModelDateTime.setEnabled((rowNrOptionSelectionModel.getStringValue().equals(RowNrMode.Variable.name()) || (rowNrOptionSelectionModel.getStringValue().equals(RowNrMode.Fixed.name()) && durationOrEndSelectionModel.getStringValue().equals(EndMode.End.name()))) && !useExecTimeModel.getBooleanValue());
}
};
rowNrOptionSelectionModel.addChangeListener(changeListener);
durationOrEndSelectionModel.addChangeListener(changeListener);
useExecTimeModel.addChangeListener(changeListener);
changeListener.stateChanged(new ChangeEvent(rowNrOptionSelectionModel));
return settingsModelDateTime;
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class CreateDateTimeNodeModel method createEndUseExecTimeModel.
/**
* @return the boolean model, used in both dialog and model.
*/
static SettingsModelBoolean createEndUseExecTimeModel(final SettingsModelString rowNrOptionSelectionModel, final SettingsModelString durationOrEndSelectionModel) {
SettingsModelBoolean settingsModelBoolean = new SettingsModelBoolean("end_use_exec_time", false);
final ChangeListener changeListener = e -> {
if (durationOrEndSelectionModel.getStringValue() != null && rowNrOptionSelectionModel.getStringValue() != null) {
settingsModelBoolean.setEnabled(rowNrOptionSelectionModel.getStringValue().equals(RowNrMode.Variable.name()) || (rowNrOptionSelectionModel.getStringValue().equals(RowNrMode.Fixed.name()) && durationOrEndSelectionModel.getStringValue().equals(EndMode.End.name())));
}
};
rowNrOptionSelectionModel.addChangeListener(changeListener);
durationOrEndSelectionModel.addChangeListener(changeListener);
changeListener.stateChanged(new ChangeEvent(rowNrOptionSelectionModel));
return settingsModelBoolean;
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class ModifyDateNodeDialog 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_dialogCompDate.loadSettingsFrom(settings, specs);
m_dialogCompTimeZone.loadSettingsFrom(settings, specs);
m_dialogCompModifySelect.loadSettingsFrom(settings, specs);
m_filterOnlyLocalDate = ((SettingsModelString) m_dialogCompModifySelect.getModel()).getStringValue().equals(ModifyDateNodeModel.MODIFY_OPTION_APPEND);
final DataColumnSpecFilterConfiguration filterConfiguration = ModifyDateNodeModel.createDCFilterConfiguration(m_filterOnlyLocalDate ? ModifyDateNodeModel.LOCAL_TIME_FILTER : ModifyDateNodeModel.DATE_TIME_FILTER);
filterConfiguration.loadConfigurationInDialog(settings, specs[0]);
m_dialogCompColFilter.loadConfiguration(filterConfiguration, specs[0]);
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class OldToNewTimeNodeModel method createTimeZoneSelectModel.
/**
* @param typeModelBool
* @return the string select model, used in both dialog and model.
*/
static SettingsModelString createTimeZoneSelectModel() {
final SettingsModelString zoneSelectModel = new SettingsModelString("time_zone_select", ZoneId.systemDefault().getId());
zoneSelectModel.setEnabled(false);
return zoneSelectModel;
}
Aggregations