use of org.knime.core.node.NodeSettingsRO in project knime-core by knime.
the class TypeFilterConfigurationImpl method loadConfigurationInDialog.
/**
* Loads the configuration from the given settings object. Sets defaults if invalid.
* @param settings Settings object containing the configuration.
* @param tableSpec The column specs to find the available types.
*/
void loadConfigurationInDialog(final NodeSettingsRO settings, final DataTableSpec tableSpec) {
m_selections.clear();
NodeSettingsRO typeListSettings;
try {
typeListSettings = settings.getNodeSettings(CFG_TYPELIST);
for (String key : typeListSettings.keySet()) {
m_selections.put(key, typeListSettings.getBoolean(key, false));
}
} catch (InvalidSettingsException e) {
// ignore
}
}
use of org.knime.core.node.NodeSettingsRO in project knime-core by knime.
the class NameFilterConfiguration method loadConfigurationInModel.
/**
* Load config from argument.
*
* <p>Subclasses should not define another method with similar signature and then
* call that new method to read from the passed NodeSettings object but instead overwrite
* {@link #loadConfigurationInModelChild(NodeSettingsRO)}.
*
* @param settings To load from.
* @throws InvalidSettingsException If inconsistent/missing.
*/
public final void loadConfigurationInModel(final NodeSettingsRO settings) throws InvalidSettingsException {
NodeSettingsRO subSettings = settings.getNodeSettings(m_configRootName);
String type = subSettings.getString(KEY_FILTER_TYPE);
if (type == null || !verifyType(type)) {
throw new InvalidSettingsException("Invalid type: " + type);
}
m_type = type;
m_enforceOption = EnforceOption.parse(subSettings.getString(KEY_ENFORCE_OPTION));
m_includeList = subSettings.getStringArray(KEY_INCLUDED_NAMES);
m_excludeList = subSettings.getStringArray(KEY_EXCLUDED_NAMES);
try {
NodeSettingsRO configSettings = subSettings.getNodeSettings(PatternFilterConfiguration.TYPE);
m_patternConfig.loadConfigurationInModel(configSettings);
} catch (InvalidSettingsException e) {
if (PatternFilterConfiguration.TYPE.equals(m_type)) {
throw e;
}
// Otherwise leave at default settings as pattern matcher is not active (might be prior 2.9)
}
loadConfigurationInModelChild(subSettings);
}
use of org.knime.core.node.NodeSettingsRO in project knime-core by knime.
the class SettingsModelColumnName method loadSettingsForDialog.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsForDialog(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
final boolean oldUseRowID = m_useRowID;
try {
final NodeSettingsRO subSettings = settings.getNodeSettings(m_configName);
final boolean useRowId = subSettings.getBoolean(CFG_ROWID);
final boolean rowIDChanged = setUseRowID(useRowId);
final String oldStringVal = super.getStringValue();
super.loadSettingsForDialog(subSettings, specs);
final String newStringVal = super.getStringValue();
boolean stringValChanged;
if (oldStringVal == null) {
stringValChanged = newStringVal != null;
} else {
stringValChanged = !oldStringVal.equals(newStringVal);
}
if (rowIDChanged && !stringValChanged) {
// If the column name has changed
// the notifyChangeListener method is called from the
// updateStringValue method by calling the setStringValue method
notifyChangeListeners();
}
} catch (final InvalidSettingsException iae) {
// if the argument is not accepted: keep the old value.
m_useRowID = oldUseRowID;
}
}
use of org.knime.core.node.NodeSettingsRO in project knime-core by knime.
the class SettingsModelDoubleRange method loadSettingsForModel.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsForModel(final NodeSettingsRO settings) throws InvalidSettingsException {
try {
NodeSettingsRO mySettings = settings.getNodeSettings(m_configName);
setRange(mySettings.getDouble("MIN"), mySettings.getDouble("MAX"));
} catch (InvalidSettingsException ise) {
throw new InvalidSettingsException(getClass().getSimpleName() + " - " + m_configName + ": " + ise.getMessage());
} catch (IllegalArgumentException iae) {
throw new InvalidSettingsException(getClass().getSimpleName() + " - " + m_configName + ": " + iae.getMessage());
}
}
use of org.knime.core.node.NodeSettingsRO in project knime-core by knime.
the class SettingsModelDoubleRange method validateSettingsForModel.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettingsForModel(final NodeSettingsRO settings) throws InvalidSettingsException {
double min;
double max;
try {
NodeSettingsRO mySettings = settings.getNodeSettings(m_configName);
min = mySettings.getDouble("MIN");
max = mySettings.getDouble("MAX");
} catch (InvalidSettingsException ise) {
throw new InvalidSettingsException(getClass().getSimpleName() + " - " + m_configName + ": " + ise.getMessage());
}
if (min > max) {
throw new InvalidSettingsException("min>max in " + getClass().getSimpleName() + " - " + m_configName);
}
}
Aggregations