use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class AggregationMethodDecorator method saveMethod.
/**
* @param cfg {@link NodeSettingsWO} to write to
* @param method the {@link AggregationFunction} to save
* @since 2.11
*/
public static void saveMethod(final NodeSettingsWO cfg, final AggregationMethod method) {
cfg.addString(CNFG_AGGR_METHODS, method.getId());
if (method.hasOptionalSettings()) {
try {
final NodeSettingsWO subConfig = cfg.addNodeSettings("functionSettings");
method.saveSettingsTo(subConfig);
} catch (Exception e) {
LOGGER.error("Exception while saving settings for aggreation method '" + method.getId() + "', reason: " + e.getMessage());
}
}
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class NamedAggregationOperator method saveMethods.
/**
* @param settings the {@link NodeSettingsWO} to write to
* @param operators list of the
* {@link NamedAggregationOperator}s to save
* @since 2.7
*/
public static void saveMethods(final NodeSettingsWO settings, final List<NamedAggregationOperator> operators) {
if (settings == null) {
throw new NullPointerException("config must not be null");
}
if (operators == null) {
throw new NullPointerException("methods must not be null");
}
final String[] colNames = new String[operators.size()];
final String[] aggrMethods = new String[operators.size()];
final boolean[] inclMissingVals = new boolean[operators.size()];
for (int i = 0, length = operators.size(); i < length; i++) {
final NamedAggregationOperator operator = operators.get(i);
colNames[i] = operator.getName();
aggrMethods[i] = operator.getId();
inclMissingVals[i] = operator.inclMissingCells();
if (operator.hasOptionalSettings()) {
try {
NodeSettingsWO operatorSettings = settings.addNodeSettings(createSettingsKey(operator));
operator.saveSettingsTo(operatorSettings);
} catch (Exception e) {
LOGGER.error("Exception while saving settings for aggreation operator '" + operator.getId() + "', reason: " + e.getMessage());
}
}
}
settings.addStringArray(CNFG_RESULT_COL_NAMES, colNames);
settings.addStringArray(CNFG_AGGR_METHODS, aggrMethods);
settings.addBooleanArray(CNFG_INCL_MISSING_VALS, inclMissingVals);
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class SettingsModelColumnName method saveSettingsForModel.
/**
* {@inheritDoc}
*/
@Override
protected void saveSettingsForModel(final NodeSettingsWO settings) {
final NodeSettingsWO subSettings = settings.addNodeSettings(m_configName);
subSettings.addBoolean(CFG_ROWID, m_useRowID);
super.saveSettingsForModel(subSettings);
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class SettingsModelDoubleRange method saveSettingsForModel.
/**
* {@inheritDoc}
*/
@Override
protected void saveSettingsForModel(final NodeSettingsWO settings) {
NodeSettingsWO mySettings = settings.addNodeSettings(m_configName);
mySettings.addDouble("MIN", m_minRange);
mySettings.addDouble("MAX", m_maxRange);
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class ConfigEditJTree method main.
/**
* Public testing method that displays a simple tree with no flow
* variable stack, though.
* @param args command line args, ignored here.
*/
public static void main(final String[] args) {
NodeSettings settings = new NodeSettings("Demo");
settings.addString("String_Demo", "This is a demo string");
settings.addInt("Int_Demo", 32);
settings.addDoubleArray("DoubleArray_Demo", new double[] { 3.2, 97.4 });
NodeSettingsWO sub = settings.addNodeSettings("SubElement_Demo");
sub.addString("String_Demo", "Yet another string");
sub.addString("String_Demo2", "One more");
JFrame frame = new JFrame("Tree View Demo");
Container content = frame.getContentPane();
ConfigEditTreeModel treeModel = ConfigEditTreeModel.create(settings);
ConfigEditJTree tree = new ConfigEditJTree(treeModel);
JPanel p = new JPanel(new BorderLayout());
p.add(new JScrollPane(tree), BorderLayout.CENTER);
content.add(p);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
Aggregations