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);
setValues(AuthenticationType.valueOf(config.getString(SELECTED_TYPE)), config.getString(CREDENTIAL), config.getString(USERNAME), config.getPassword(PASSWORD, secretKey));
}
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 loadSettingsForModel.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsForModel(final NodeSettingsRO settings) throws InvalidSettingsException {
try {
// no default value, throw an exception instead
Config lists = settings.getConfig(m_configName);
String[] incl = lists.getStringArray(CFGKEY_INCL);
String[] excl = lists.getStringArray(CFGKEY_EXCL);
setIncludeList(incl);
setExcludeList(excl);
boolean keepAll = lists.getBoolean(CFGKEY_KEEPALL, false);
setKeepAllSelected(keepAll);
} catch (IllegalArgumentException iae) {
throw new InvalidSettingsException(iae.getMessage());
}
}
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