use of org.knime.core.node.NodeSettingsRO in project knime-core by knime.
the class CorrelationOperator method loadSettingsFrom.
@Override
public void loadSettingsFrom(final NodeSettingsRO settings, final DataTableSpec spec) throws NotConfigurableException {
try {
NodeSettingsRO colSettings = settings.getNodeSettings(COLUMN_SETTINGS);
super.loadSettingsFrom(colSettings, spec);
NodeSettingsRO corrSettings = settings.getNodeSettings(CORRELATION_SETTINGS);
final DataTableSpec[] specs = new DataTableSpec[] { spec };
getDialogComponent().loadSettingsFrom(corrSettings, specs);
} catch (InvalidSettingsException e) {
}
}
use of org.knime.core.node.NodeSettingsRO in project knime-core by knime.
the class CorrelationOperator method validateSettings.
@Override
public void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
NodeSettingsRO colSettings = settings.getNodeSettings(COLUMN_SETTINGS);
super.validateSettings(colSettings);
NodeSettingsRO corrSettings = settings.getNodeSettings(CORRELATION_SETTINGS);
m_settings.validateSettings(corrSettings);
}
use of org.knime.core.node.NodeSettingsRO in project knime-core by knime.
the class ScorerNodeModel method loadInternals.
/**
* {@inheritDoc}
*/
@Override
protected void loadInternals(final File internDir, final ExecutionMonitor exec) throws IOException {
// load internal values
File fSett = new File(internDir, FILE_NAME_INTERNAL_SETT);
if (fSett.exists() && fSett.canRead()) {
NodeSettingsRO sett = NodeSettings.loadFromXML(new FileInputStream(fSett));
try {
m_correctCount = sett.getInt(CFG_CORRECT_COUNT);
m_falseCount = sett.getInt(CFG_FALSE_COUNT);
m_nrRows = sett.getInt(CFG_NUMBER_ROWS);
} catch (InvalidSettingsException ise) {
IOException ioe = new IOException();
ioe.initCause(ise);
throw ioe;
}
} else {
throw new IOException("Could not load scorer internals. " + "File does not exist or can't be read: " + fSett);
}
// load scored table
File fTable = new File(internDir, FILE_NAME_INTERNAL_RESULT);
m_lastResult = DataContainer.readFromZip(fTable);
}
use of org.knime.core.node.NodeSettingsRO in project knime-core by knime.
the class ColSetting method loadIndividualColSetting.
/**
* Helper that individual settings from a config object, used in NodeDialog.
*
* @param settings to load from
* @param spec ignored, used here to differ from method that is used by
* {@link org.knime.core.node.NodeModel}
* @return individual settings
*/
protected static ColSetting[] loadIndividualColSetting(final NodeSettingsRO settings, final DataTableSpec spec) {
// avoid checkstyle complain
assert (spec == spec);
Map<String, ColSetting> individHash = new LinkedHashMap<String, ColSetting>();
if (settings.containsKey(CFG_INDIVIDUAL)) {
NodeSettingsRO subConfig;
try {
subConfig = settings.getNodeSettings(CFG_INDIVIDUAL);
Map<String, ColSetting> subDefaults = loadSubConfigs(subConfig);
individHash.putAll(subDefaults);
} catch (InvalidSettingsException ise) {
LOGGER.debug("Error loading subconfig: " + CFG_INDIVIDUAL, ise);
}
}
return individHash.values().toArray(new ColSetting[0]);
}
use of org.knime.core.node.NodeSettingsRO in project knime-core by knime.
the class ColSetting method loadIndividualColSetting.
/**
* Helper that load individual settings from a config object, used in
* NodeModel.
*
* @param settings to load from
* @return individual settings
* @throws InvalidSettingsException if errors occur
*/
protected static ColSetting[] loadIndividualColSetting(final NodeSettingsRO settings) throws InvalidSettingsException {
NodeSettingsRO subConfig = settings.getNodeSettings(CFG_INDIVIDUAL);
Map<String, ColSetting> map = loadSubConfigs(subConfig);
return map.values().toArray(new ColSetting[0]);
}
Aggregations