use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class DateTimeToStringNodeModel 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(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;
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class TimestampToDateTimeNodeModel 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", "(Date&Time)");
replaceOrAppendModel.addChangeListener(e -> suffixModel.setEnabled(replaceOrAppendModel.getStringValue().equals(OPTION_APPEND)));
suffixModel.setEnabled(false);
return suffixModel;
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class ExtractDateTimeFieldsNodeModel method createSubsecondUnitsModel.
static SettingsModelString createSubsecondUnitsModel(final SettingsModelBoolean subsecondsModelBoolean) {
final SettingsModelString subsecondsModelString = new SettingsModelString("subsecond_units", MILLISECOND);
subsecondsModelString.setEnabled(subsecondsModelBoolean.getBooleanValue());
return subsecondsModelString;
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class DateTimeBasedRowFilterNodeDialog method checkPeriodOrDuration.
/**
* Checks if period or duration can be parsed
*/
private void checkPeriodOrDuration() {
String warning = "";
try {
DurationPeriodFormatUtils.parsePeriod(((SettingsModelString) m_dialogCompPeriodOrDurationValue.getModel()).getStringValue());
if (m_dialogCompColSelection.getSelectedAsSpec().getType().isCompatible(LocalTimeValue.class)) {
warning = "A date-based duration cannot be applied on a time!";
}
} catch (DateTimeParseException e) {
try {
DurationPeriodFormatUtils.parseDuration(((SettingsModelString) m_dialogCompPeriodOrDurationValue.getModel()).getStringValue());
if (m_dialogCompColSelection.getSelectedAsSpec().getType().isCompatible(LocalDateValue.class)) {
warning = "A time-based duration cannot be applied on a date!";
}
} catch (DateTimeParseException e2) {
warning = "Value does not represent a duration!";
}
}
if (!warning.equals("")) {
((JComponent) m_dialogCompPeriodOrDurationValue.getComponentPanel().getComponent(1)).setBorder(BorderFactory.createLineBorder(Color.RED));
m_typeWarningLabel.setText(warning);
} else {
((JComponent) m_dialogCompPeriodOrDurationValue.getComponentPanel().getComponent(1)).setBorder(UIManager.getBorder("TextField.border"));
}
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class DateTimeShiftNodeModel 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", "(shifted)");
replaceOrAppendModel.addChangeListener(e -> suffixModel.setEnabled(replaceOrAppendModel.getStringValue().equals(OPTION_APPEND)));
suffixModel.setEnabled(false);
return suffixModel;
}
Aggregations