use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class FlowVariable method save.
/**
* Saves this flow variable to a settings object. This method writes
* directly into the argument object (no creating of intermediate child).
* @param settings To save to.
*/
void save(final NodeSettingsWO settings) {
settings.addString("name", getName());
settings.addString("class", getType().name());
switch(getType()) {
case INTEGER:
settings.addInt("value", getIntValue());
break;
case DOUBLE:
settings.addDouble("value", getDoubleValue());
break;
case STRING:
settings.addString("value", getStringValue());
break;
case CREDENTIALS:
NodeSettingsWO subSettings = settings.addNodeSettings("value");
m_valueCredentials.save(subSettings);
break;
default:
assert false : "Unknown variable type: " + getType();
}
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class MetaNodeDialogPane method saveSettingsTo.
/**
* {@inheritDoc}
*/
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
for (Map.Entry<NodeID, MetaNodeDialogNode> e : m_nodes.entrySet()) {
final NodeID key = e.getKey();
if (e.getValue() instanceof QuickFormInputNode) {
AbstractQuickFormConfiguration config = ((QuickFormInputNode) e.getValue()).getConfiguration();
AbstractQuickFormValueInConfiguration valueConfig = config.createValueConfiguration();
QuickFormConfigurationPanel value = m_quickFormInputNodePanels.get(key);
value.saveSettings(valueConfig);
NodeSettingsWO subSettings = settings.addNodeSettings((Integer.toString(key.getIndex())));
valueConfig.saveValue(subSettings);
} else if (e.getValue() instanceof DialogNode) {
DialogNode dialogNode = (DialogNode) e.getValue();
DialogNodePanel nodePanel = m_dialogNodePanels.get(key);
DialogNodeValue nodeValue = nodePanel.getNodeValue();
final String parameterName = SubNodeContainer.getDialogNodeParameterName(dialogNode, key);
if (nodeValue != null) {
NodeSettingsWO subSettings = settings.addNodeSettings((parameterName));
nodeValue.saveToNodeSettings(subSettings);
}
}
}
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class ObsoleteMetaNodeFileWorkflowPersistor method loadSettingsForConnections.
/**
* {@inheritDoc}
*/
@Override
protected NodeSettingsRO loadSettingsForConnections(final NodeSettingsRO set) throws InvalidSettingsException {
NodeSettingsRO original = super.loadSettingsForConnections(set);
if (!m_metaNodeType.equals(MetaNodeType.LOOPER)) {
return original;
}
// looper nodes have two more connections (meta-in and out), faking them
NodeSettings fake = new NodeSettings(original.getKey());
original.copyTo(fake);
String wfmInKey;
int i = 0;
do {
wfmInKey = "workflow_connection" + i;
} while (fake.containsKey(wfmInKey));
NodeSettingsWO wfmIn = fake.addNodeSettings(wfmInKey);
// ID is not read anyway...
wfmIn.addInt("ID", Integer.MAX_VALUE - 1);
wfmIn.addInt("sourceID", -1);
wfmIn.addInt("sourcePort", 0);
wfmIn.addInt("targetID", m_dataInNodeIDs[0]);
wfmIn.addInt("targetPort", 0);
String wfmOutKey;
do {
wfmOutKey = "workflow_connection" + i++;
} while (fake.containsKey(wfmOutKey));
NodeSettingsWO wfmOut = fake.addNodeSettings(wfmOutKey);
// ID is not read ...
wfmOut.addInt("ID", Integer.MAX_VALUE - 2);
wfmOut.addInt("sourceID", m_dataOutNodeIDs[0]);
wfmOut.addInt("sourcePort", 0);
wfmOut.addInt("targetID", -1);
wfmOut.addInt("targetPort", 0);
return fake;
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class ObsoleteMetaNodeFileWorkflowPersistor method loadOutPortsSetting.
/**
* {@inheritDoc}
*/
@Override
protected NodeSettingsRO loadOutPortsSetting(final NodeSettingsRO settings) throws InvalidSettingsException {
NodeSettings template = new NodeSettings("outports");
for (int i = 0; i < m_dataOutNodeIDs.length; i++) {
NodeSettingsWO sub = template.addNodeSettings("data_" + i);
sub.addInt("index", i);
sub.addInt("node", m_dataOutNodeIDs[i]);
sub.addString("type", "data");
}
return template;
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class SubNodeContainer method performSaveModelSettingsTo.
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("rawtypes")
void performSaveModelSettingsTo(final NodeSettings modelSettings) {
Map<NodeID, DialogNode> nodes = m_wfm.findNodes(DialogNode.class, false);
for (Map.Entry<NodeID, DialogNode> entry : nodes.entrySet()) {
final DialogNode dialogNode = entry.getValue();
final String parameterName = getDialogNodeParameterName(dialogNode, entry.getKey());
final DialogNodeValue dialogValue = dialogNode.getDialogValue();
if (dialogValue != null) {
NodeSettingsWO subSettings = modelSettings.addNodeSettings(parameterName);
dialogValue.saveToNodeSettings(subSettings);
}
}
}
Aggregations