Search in sources :

Example 81 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class SingleNodeContainer method areDialogAndNodeSettingsEqual.

// //////////////////////////////////
// Credentials handling
// //////////////////////////////////
/**
 * {@inheritDoc}
 */
@Override
public boolean areDialogAndNodeSettingsEqual() {
    final String key = "snc_settings";
    NodeSettingsWO nodeSettings = new NodeSettings(key);
    saveSettings(nodeSettings, true);
    NodeSettingsWO dlgSettings = new NodeSettings(key);
    NodeContext.pushContext(this);
    try {
        getDialogPane().finishEditingAndSaveSettingsTo(dlgSettings);
    } catch (InvalidSettingsException e) {
        return false;
    } finally {
        NodeContext.removeLastContext();
    }
    return dlgSettings.equals(nodeSettings);
}
Also used : NodeSettings(org.knime.core.node.NodeSettings) NodeSettingsWO(org.knime.core.node.NodeSettingsWO) InvalidSettingsException(org.knime.core.node.InvalidSettingsException)

Example 82 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class SettingsModelColumnName method saveSettingsForDialog.

/**
 * {@inheritDoc}
 */
@Override
protected void saveSettingsForDialog(final NodeSettingsWO settings) throws InvalidSettingsException {
    final NodeSettingsWO subSettings = settings.addNodeSettings(m_configName);
    subSettings.addBoolean(CFG_ROWID, m_useRowID);
    super.saveSettingsForDialog(subSettings);
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Example 83 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class PortObjectIDSettings method saveSettings.

/**
 * Saves the current settings to a NodeSettings object.
 * @param settings To write to.
 */
public void saveSettings(final NodeSettingsWO settings) {
    if (m_id != null) {
        settings.addInt("portobject_ID", m_id);
    }
    settings.addBoolean("copyData", m_copyData);
    NodeSettingsWO sub = settings.addNodeSettings("flowVariables");
    int index = 0;
    for (FlowVariable fv : getFlowVariables()) {
        NodeSettingsWO child = sub.addNodeSettings("flowVar_" + (index++));
        // copied from (package scope) save method in FlowVariable
        child.addString("name", fv.getName());
        child.addString("class", fv.getType().name());
        switch(fv.getType()) {
            case INTEGER:
                child.addInt("value", fv.getIntValue());
                break;
            case DOUBLE:
                child.addDouble("value", fv.getDoubleValue());
                break;
            case STRING:
                child.addString("value", fv.getStringValue());
                break;
            case CREDENTIALS:
                child.addString("value", fv.getName());
                break;
            default:
                assert false : "Unknown variable type: " + fv.getType();
        }
    }
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO) FlowVariable(org.knime.core.node.workflow.FlowVariable)

Example 84 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class NameFilterConfiguration method saveConfiguration.

/**
 * Save current config to argument.
 *
 * <p>Subclasses should not define another method with similar signature and then
 * call that new method to read from the passed NodeSettings object but instead overwrite
 * {@link #loadConfigurationInDialogChild(NodeSettingsRO, String[])}.
 *
 * @param settings The settings to save into
 */
public final void saveConfiguration(final NodeSettingsWO settings) {
    NodeSettingsWO subSettings = settings.addNodeSettings(m_configRootName);
    subSettings.addString(KEY_FILTER_TYPE, m_type);
    // Only add removed list for selected enforce option
    String[] includes = m_enforceOption == EnforceOption.EnforceInclusion ? (String[]) ArrayUtils.addAll(m_includeList, m_removedFromIncludeList) : m_includeList;
    subSettings.addStringArray(KEY_INCLUDED_NAMES, includes);
    String[] excludes = m_enforceOption == EnforceOption.EnforceExclusion ? (String[]) ArrayUtils.addAll(m_excludeList, m_removedFromExcludeList) : m_excludeList;
    subSettings.addStringArray(KEY_EXCLUDED_NAMES, excludes);
    subSettings.addString(KEY_ENFORCE_OPTION, m_enforceOption.name());
    NodeSettingsWO configSettings = subSettings.addNodeSettings(PatternFilterConfiguration.TYPE);
    m_patternConfig.saveConfiguration(configSettings);
    saveConfigurationChild(subSettings);
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Example 85 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO in project knime-core by knime.

the class DataColumnSpecFilterConfiguration method saveConfigurationChild.

/**
 * {@inheritDoc}
 */
@Override
protected void saveConfigurationChild(final NodeSettingsWO settings) {
    super.saveConfigurationChild(settings);
    NodeSettingsWO configSettings = settings.addNodeSettings(TypeFilterConfigurationImpl.TYPE);
    m_typeConfig.saveConfiguration(configSettings);
}
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