use of org.knime.core.node.config.Config in project knime-core by knime.
the class SettingsModel method saveEnableStatusAndModelID.
/**
* Saves this' model id and the current enable status into the specified
* settings object. It creates a new sub config for that.
*
* @param settings the settings object to add the settings to.
*/
private void saveEnableStatusAndModelID(final NodeSettingsWO settings) {
Config intCfg = settings.addConfig(getConfigName() + CFGKEY_INTERNAL);
intCfg.addString(CFGKEY_MODELID, getModelTypeID());
intCfg.addBoolean(CFGKEY_ENABLESTAT, m_enabled);
}
use of org.knime.core.node.config.Config in project knime-core by knime.
the class SettingsModelAuthentication method loadSettingsForModel.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsForModel(final NodeSettingsRO settings) throws InvalidSettingsException {
// no default value, throw an exception instead
Config config = settings.getConfig(m_configName);
AuthenticationType authType = AuthenticationType.valueOf(config.getString(SELECTED_TYPE));
String username = config.getString(USERNAME);
String password = authType.requiresPassword() ? config.getPassword(PASSWORD, secretKey) : "";
setValues(authType, config.getString(CREDENTIAL), username, password);
}
use of org.knime.core.node.config.Config in project knime-core by knime.
the class SettingsModelColor method loadSettingsForModel.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsForModel(final NodeSettingsRO settings) throws InvalidSettingsException {
try {
// no default value, throw an exception instead
final Config config = settings.getConfig(getConfigName());
final int red = config.getInt(CNFG_RED);
final int green = config.getInt(CNFG_GREEN);
final int blue = config.getInt(CNFG_BLUE);
final int alpha = config.getInt(CNFG_ALPHA);
Color color;
if (red < 0 || green < 0 || blue < 0 || alpha < 0) {
// the color is null
color = null;
} else {
color = new Color(red, green, blue, alpha);
}
setColorValue(color);
} catch (final IllegalArgumentException iae) {
throw new InvalidSettingsException(iae.getMessage());
}
}
use of org.knime.core.node.config.Config in project knime-core by knime.
the class SettingsModelColor method saveSettingsForModel.
/**
* {@inheritDoc}
*/
@Override
protected void saveSettingsForModel(final NodeSettingsWO settings) {
final Config config = settings.addConfig(getConfigName());
final int red, green, blue, alpha;
if (m_value != null) {
red = m_value.getRed();
green = m_value.getGreen();
blue = m_value.getBlue();
alpha = m_value.getAlpha();
} else {
red = -1;
green = -1;
blue = -1;
alpha = -1;
}
config.addInt(CNFG_RED, red);
config.addInt(CNFG_GREEN, green);
config.addInt(CNFG_BLUE, blue);
config.addInt(CNFG_ALPHA, alpha);
}
use of org.knime.core.node.config.Config in project knime-core by knime.
the class SettingsModelFilterString method validateSettingsForModel.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettingsForModel(final NodeSettingsRO settings) throws InvalidSettingsException {
// expect a sub-config with two string arrays: include and exclude list
Config lists = settings.getConfig(m_configName);
lists.getStringArray(CFGKEY_INCL);
lists.getStringArray(CFGKEY_EXCL);
}
Aggregations