use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class MissingNodeDialog method onClose.
/**
* {@inheritDoc}
*/
@Override
public void onClose() {
super.onClose();
m_settings = null;
m_tree.setModel(new DefaultTreeModel(new NodeSettings("ignored")));
}
use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class MissingNodeModel method loadValidatedSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadValidatedSettingsFrom(final NodeSettingsRO settings) throws InvalidSettingsException {
m_settings = new NodeSettings("copy");
settings.copyTo(m_settings);
}
use of org.knime.core.node.NodeSettings 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);
}
use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class PMMLPreprocPortObjectSpec method saveTo.
/**
* @param out zipped stream to write the entries to
* @throws IOException if something goes wrong
*/
public void saveTo(final PortObjectSpecZipOutputStream out) throws IOException {
NodeSettings settings = new NodeSettings(COLUMN_NAMES_KEY);
settings.addStringArray(COLUMNS_KEY, m_columnNames.toArray(new String[m_columnNames.size()]));
settings.saveToXML(out);
out.close();
}
use of org.knime.core.node.NodeSettings in project knime-core by knime.
the class NodeExecutionJobManagerPool method merge.
/**
* Get the common settings for a set of job managers.
* Used from {@link WorkflowManager#getCommonSettings(org.knime.core.node.workflow.NodeID...)}.
* @param jobManagers ...
* @return ...
* @since 2.7
*/
public static NodeContainerSettings merge(final NodeExecutionJobManager[] jobManagers) {
String factoryID = null;
NodeSettings mgrSettings = null;
boolean isFirst = true;
for (NodeExecutionJobManager jobManager : jobManagers) {
String curFactoryID;
NodeSettings curMgrSettings;
if (jobManager == null) {
curFactoryID = null;
curMgrSettings = null;
} else {
curFactoryID = jobManager.getID();
NodeSettings temp = new NodeSettings(CFG_JOB_MANAGER_SETTINGS);
jobManager.save(temp);
curMgrSettings = temp;
}
if (isFirst) {
isFirst = false;
factoryID = curFactoryID;
mgrSettings = curMgrSettings;
} else if (ConvenienceMethods.areEqual(factoryID, curFactoryID)) {
if (!ConvenienceMethods.areEqual(mgrSettings, curMgrSettings)) {
mgrSettings = null;
}
} else {
// different job managers
// unassigned
curFactoryID = null;
}
}
if (factoryID == null) {
return null;
}
NodeExecutionJobManagerFactory jobManagerFactory = getJobManagerFactory(factoryID);
assert jobManagerFactory != null : "Factory ID " + factoryID + " unknown although job manager present";
NodeExecutionJobManager instance = jobManagerFactory.getInstance();
if (mgrSettings != null) {
try {
instance.load(mgrSettings);
} catch (InvalidSettingsException e) {
LOGGER.error("Settings could not be applied to job manager although " + "they retrieved from another identical instance.", e);
}
}
NodeContainerSettings result = new NodeContainerSettings();
result.setJobManager(instance);
return result;
}
Aggregations