use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class NaiveBayesLearnerNodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
final SettingsModelString colName = m_classifyColumnName.createCloneWithValidatedValue(settings);
if (colName == null || colName.getStringValue().trim().length() < 1) {
throw new InvalidSettingsException("No class column selected");
}
final SettingsModelIntegerBounded maxNoOfNomVals = m_maxNoOfNominalVals.createCloneWithValidatedValue(settings);
if (maxNoOfNomVals.getIntValue() < 0) {
throw new InvalidSettingsException("Maximum number of unique " + "nominal values should be a positive number");
}
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class NewToOldTimeNodeModel 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", "(old 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 StringToDateTimeNodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
m_colSelect.validateSettings(settings);
m_isReplaceOrAppend.validateSettings(settings);
m_suffix.validateSettings(settings);
m_format.validateSettings(settings);
m_locale.validateSettings(settings);
try {
LocaleUtils.toLocale(m_locale.getStringValue());
} catch (IllegalArgumentException ex) {
throw new InvalidSettingsException("Unsupported locale in setting (" + m_locale.getStringValue() + "): " + ex.getMessage(), ex);
}
m_cancelOnFail.validateSettings(settings);
final SettingsModelString formatClone = m_format.createCloneWithValidatedValue(settings);
final String format = formatClone.getStringValue();
if (StringUtils.isEmpty(format)) {
throw new InvalidSettingsException("Format must not be empty!");
}
try {
DateTimeFormatter.ofPattern(format);
} catch (IllegalArgumentException e) {
String msg = "Invalid date format: \"" + format + "\".";
final String errMsg = e.getMessage();
if (!StringUtils.isEmpty(errMsg)) {
msg += " Reason: " + errMsg;
}
throw new InvalidSettingsException(msg, e);
}
settings.getString("typeEnum");
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class StringToDateTimeNodeModel 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 ExtendedStatisticsNodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
m_computeMedian.validateSettings(settings);
m_nominalValues.validateSettings(settings);
m_nominalValuesOutput.validateSettings(settings);
m_nominalFilter.validateSettings(settings);
getImageFormat().validateSettings(settings);
SettingsModelString tmpFormat = createImageFormat();
tmpFormat.loadSettingsFrom(settings);
String format = tmpFormat.getStringValue();
if (!POSSIBLE_IMAGE_FORMATS.contains(format)) {
throw new InvalidSettingsException("Unsupported image format: " + format);
}
getHistogramWidth().validateSettings(settings);
getHistogramHeight().validateSettings(settings);
getEnableHiLite().validateSettings(settings);
getShowMinMax().validateSettings(settings);
}
Aggregations