Search in sources :

Example 6 with NodeSettingsWO

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);
    }
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Example 7 with NodeSettingsWO

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;
    }
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Example 8 with NodeSettingsWO

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);
    }
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Example 9 with NodeSettingsWO

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());
    }
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Example 10 with NodeSettingsWO

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);
    }
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Aggregations

NodeSettingsWO (org.knime.core.node.NodeSettingsWO)111 NodeSettings (org.knime.core.node.NodeSettings)16 Map (java.util.Map)11 File (java.io.File)9 FileOutputStream (java.io.FileOutputStream)9 LinkedHashMap (java.util.LinkedHashMap)9 HashMap (java.util.HashMap)8 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)8 RowKey (org.knime.core.data.RowKey)6 DataCell (org.knime.core.data.DataCell)5 BufferedOutputStream (java.io.BufferedOutputStream)4 NodeSettingsRO (org.knime.core.node.NodeSettingsRO)4 HashSet (java.util.HashSet)3 GZIPOutputStream (java.util.zip.GZIPOutputStream)3 DataRow (org.knime.core.data.DataRow)3 ExecutionMonitor (org.knime.core.node.ExecutionMonitor)3 AbstractQuickFormConfiguration (org.knime.core.quickform.AbstractQuickFormConfiguration)3 AbstractQuickFormValueInConfiguration (org.knime.core.quickform.AbstractQuickFormValueInConfiguration)3 QuickFormInputNode (org.knime.core.quickform.in.QuickFormInputNode)3 MutableInteger (org.knime.core.util.MutableInteger)3