Search in sources :

Example 16 with NodeSettingsWO

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

the class AggregationMethodDecorator method saveMethod.

/**
 * @param cfg {@link NodeSettingsWO} to write to
 * @param method the {@link AggregationFunction} to save
 * @since 2.11
 */
public static void saveMethod(final NodeSettingsWO cfg, final AggregationMethod method) {
    cfg.addString(CNFG_AGGR_METHODS, method.getId());
    if (method.hasOptionalSettings()) {
        try {
            final NodeSettingsWO subConfig = cfg.addNodeSettings("functionSettings");
            method.saveSettingsTo(subConfig);
        } catch (Exception e) {
            LOGGER.error("Exception while saving settings for aggreation method '" + method.getId() + "', reason: " + e.getMessage());
        }
    }
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) NotConfigurableException(org.knime.core.node.NotConfigurableException)

Example 17 with NodeSettingsWO

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

the class NamedAggregationOperator method saveMethods.

/**
 * @param settings the {@link NodeSettingsWO} to write to
 * @param operators list of the
 * {@link NamedAggregationOperator}s to save
 * @since 2.7
 */
public static void saveMethods(final NodeSettingsWO settings, final List<NamedAggregationOperator> operators) {
    if (settings == null) {
        throw new NullPointerException("config must not be null");
    }
    if (operators == null) {
        throw new NullPointerException("methods must not be null");
    }
    final String[] colNames = new String[operators.size()];
    final String[] aggrMethods = new String[operators.size()];
    final boolean[] inclMissingVals = new boolean[operators.size()];
    for (int i = 0, length = operators.size(); i < length; i++) {
        final NamedAggregationOperator operator = operators.get(i);
        colNames[i] = operator.getName();
        aggrMethods[i] = operator.getId();
        inclMissingVals[i] = operator.inclMissingCells();
        if (operator.hasOptionalSettings()) {
            try {
                NodeSettingsWO operatorSettings = settings.addNodeSettings(createSettingsKey(operator));
                operator.saveSettingsTo(operatorSettings);
            } catch (Exception e) {
                LOGGER.error("Exception while saving settings for aggreation operator '" + operator.getId() + "', reason: " + e.getMessage());
            }
        }
    }
    settings.addStringArray(CNFG_RESULT_COL_NAMES, colNames);
    settings.addStringArray(CNFG_AGGR_METHODS, aggrMethods);
    settings.addBooleanArray(CNFG_INCL_MISSING_VALS, inclMissingVals);
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO) InvalidSettingsException(org.knime.core.node.InvalidSettingsException)

Example 18 with NodeSettingsWO

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

the class SettingsModelColumnName method saveSettingsForModel.

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

Example 19 with NodeSettingsWO

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

the class SettingsModelDoubleRange method saveSettingsForModel.

/**
 * {@inheritDoc}
 */
@Override
protected void saveSettingsForModel(final NodeSettingsWO settings) {
    NodeSettingsWO mySettings = settings.addNodeSettings(m_configName);
    mySettings.addDouble("MIN", m_minRange);
    mySettings.addDouble("MAX", m_maxRange);
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Example 20 with NodeSettingsWO

use of org.knime.core.node.NodeSettingsWO 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);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) NodeSettings(org.knime.core.node.NodeSettings) Container(java.awt.Container) BorderLayout(java.awt.BorderLayout) NodeSettingsWO(org.knime.core.node.NodeSettingsWO) JFrame(javax.swing.JFrame)

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