use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class FileWorkflowPersistor method saveAuthorInformation.
/**
* @since 2.8
*/
protected static void saveAuthorInformation(final AuthorInformation aI, final NodeSettingsWO settings) {
if (aI != null) {
final NodeSettingsWO sub = settings.addNodeSettings(CFG_AUTHOR_INFORMATION);
sub.addString("authored-by", aI.getAuthor());
String authorWhen = aI.getAuthoredDate() == null ? null : formatDate(aI.getAuthoredDate());
sub.addString("authored-when", authorWhen);
sub.addString("lastEdited-by", aI.getLastEditor());
String lastEditWhen = aI.getLastEditDate() == null ? null : formatDate(aI.getLastEditDate());
sub.addString("lastEdited-when", lastEditWhen);
}
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class FileWorkflowPersistor method saveWorkflowAnnotations.
protected static void saveWorkflowAnnotations(final WorkflowManager manager, final NodeSettingsWO settings) {
Collection<WorkflowAnnotation> annotations = manager.getWorkflowAnnotations();
if (annotations.size() == 0) {
return;
}
NodeSettingsWO annoSettings = settings.addNodeSettings("annotations");
int i = 0;
for (Annotation a : annotations) {
NodeSettingsWO t = annoSettings.addNodeSettings("annotation_" + i);
a.save(t);
i += 1;
}
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class FileWorkflowPersistor method saveWizardState.
/**
* Saves the status of the wizard if set so in the save-helper.
* @param wm ...
* @param preFilledSettings ...
* @param saveHelper ...
*/
private static void saveWizardState(final WorkflowManager wm, final NodeSettings preFilledSettings, final WorkflowSaveHelper saveHelper) {
if (!saveHelper.isSaveWizardController() || !wm.isProject()) {
return;
}
NodeSettingsWO wizardSettings = preFilledSettings.addNodeSettings("wizard");
final WizardExecutionController wizardController = wm.getWizardExecutionController();
if (wizardController != null) {
wizardController.save(wizardSettings);
}
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class FileWorkflowPersistor method saveEditorUIInformation.
/**
* @param settings
* @since 2.6
*/
static void saveEditorUIInformation(final WorkflowManager wfm, final NodeSettings settings) {
EditorUIInformation editorInfo = wfm.getEditorUIInformation();
if (editorInfo != null) {
NodeSettingsWO editorConfig = settings.addNodeSettings(CFG_EDITOR_INFO);
editorConfig.addBoolean(CFG_EDITOR_SNAP_GRID, editorInfo.getSnapToGrid());
editorConfig.addBoolean(CFG_EDITOR_SHOW_GRID, editorInfo.getShowGrid());
editorConfig.addInt(CFG_EDITOR_X_GRID, editorInfo.getGridX());
editorConfig.addInt(CFG_EDITOR_Y_GRID, editorInfo.getGridY());
editorConfig.addDouble(CFG_EDITOR_ZOOM, editorInfo.getZoomLevel());
editorConfig.addBoolean(CFG_EDITOR_CURVED_CONNECTIONS, editorInfo.getHasCurvedConnections());
editorConfig.addInt(CFG_EDITOR_CONNECTION_WIDTH, editorInfo.getConnectionLineWidth());
}
}
use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.
the class FileWorkflowPersistor method saveConnection.
protected static void saveConnection(final NodeSettingsWO settings, final ConnectionContainer connection) {
int sourceID = connection.getSource().getIndex();
int destID = connection.getDest().getIndex();
switch(connection.getType()) {
case WFMIN:
sourceID = -1;
break;
case WFMOUT:
destID = -1;
break;
case WFMTHROUGH:
sourceID = -1;
destID = -1;
break;
default:
}
settings.addInt("sourceID", sourceID);
settings.addInt("destID", destID);
int sourcePort = connection.getSourcePort();
settings.addInt("sourcePort", sourcePort);
int targetPort = connection.getDestPort();
settings.addInt("destPort", targetPort);
ConnectionUIInformation uiInfo = connection.getUIInfo();
if (uiInfo != null) {
// TODO there is actually no need to store the class name - just keep it for now for backwards compatibility
settings.addString(CFG_UIINFO_CLASS, uiInfo.getClass().getName());
// nest into separate sub config
NodeSettingsWO subConfig = settings.addNodeSettings(CFG_UIINFO_SUB_CONFIG);
int[][] allBendpoints = uiInfo.getAllBendpoints();
subConfig.addInt(KEY_BENDPOINTS + "_size", allBendpoints.length);
for (int i = 0; i < allBendpoints.length; i++) {
subConfig.addIntArray(KEY_BENDPOINTS + "_" + i, allBendpoints[i]);
}
}
if (!connection.isDeletable()) {
settings.addBoolean("isDeletable", false);
}
}
Aggregations