Search in sources :

Example 31 with NodeSettingsWO

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

the class RenameConfiguration method save.

/**
 * @param settings the NodeSettingsWO to write to
 */
public void save(final NodeSettingsWO settings) {
    for (Entry<String, RenameColumnSetting> entry : m_settings.entrySet()) {
        NodeSettingsWO subSub = settings.addNodeSettings(entry.getKey());
        entry.getValue().saveSettingsTo(subSub);
    }
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Example 32 with NodeSettingsWO

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

the class BinnerNodeDialogPane method saveSettingsTo.

/**
 * @param settings write intervals to
 * @throws InvalidSettingsException if a bin name is empty
 * @see NodeDialogPane#saveSettingsTo(NodeSettingsWO)
 */
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
    LinkedHashSet<String> colList = new LinkedHashSet<String>();
    for (String cell : m_intervals.keySet()) {
        IntervalPanel p = m_intervals.get(cell);
        // only if at least 1 bin is defined
        if (p.getNumIntervals() > 0) {
            colList.add(cell);
            NodeSettingsWO set = settings.addNodeSettings(cell.toString());
            if (p.isAppendedColumn()) {
                String appendedName = p.getColumnName();
                Enumeration<?> e = m_numMdl.elements();
                while (e.hasMoreElements()) {
                    DataColumnSpec cspec = (DataColumnSpec) e.nextElement();
                    if (cspec.getName().equals(appendedName)) {
                        throw new InvalidSettingsException("New appended column " + appendedName + " matches other column.");
                    }
                }
                settings.addString(cell.toString() + BinnerNodeModel.IS_APPENDED, appendedName);
            } else {
                settings.addString(cell.toString() + BinnerNodeModel.IS_APPENDED, null);
            }
            for (int j = 0; j < p.getNumIntervals(); j++) {
                IntervalItemPanel item = p.getInterval(j);
                String binName = item.getBin();
                if (binName == null || binName.length() == 0) {
                    throw new InvalidSettingsException("Name for bin " + j + " not set: " + item);
                }
                NodeSettingsWO bin = set.addNodeSettings(binName + "_" + j);
                NumericBin theBin = new NumericBin(binName, item.isLeftOpen(), item.getLeftValue(false), item.isRightOpen(), item.getRightValue(false));
                theBin.saveToSettings(bin);
            }
        }
    }
    // add binned columns
    String[] columns = colList.toArray(new String[0]);
    settings.addStringArray(BinnerNodeModel.NUMERIC_COLUMNS, columns);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) DataColumnSpec(org.knime.core.data.DataColumnSpec) NodeSettingsWO(org.knime.core.node.NodeSettingsWO) InvalidSettingsException(org.knime.core.node.InvalidSettingsException)

Example 33 with NodeSettingsWO

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

the class MVColumnSettings method saveSettings.

/**
 * Saves the settings to a NodeSettings object.
 * @param settings the settings to save to
 */
protected void saveSettings(final NodeSettingsWO settings) {
    settings.addStringArray(COLUMN_NAMES_KEY, m_columns.toArray(new String[0]));
    NodeSettingsWO s = settings.addNodeSettings(SETTINGS_KEY);
    m_settings.saveSettings(s);
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Example 34 with NodeSettingsWO

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

the class MVSettings method saveToSettings.

/**
 * Saves the settings.
 * @param settings the settings to save to
 */
public void saveToSettings(final NodeSettingsWO settings) {
    NodeSettingsWO colSettings = settings.addNodeSettings(COL_SETTINGS_CFG);
    int i = 0;
    for (MVColumnSettings cols : m_columnSettings) {
        NodeSettingsWO colSetting = colSettings.addNodeSettings((Integer.toString(i++)));
        cols.saveSettings(colSetting);
    }
    NodeSettingsWO dtSettings = settings.addNodeSettings(DT_SETTINGS_CFG);
    for (Entry<String, MVIndividualSettings> entry : m_generalSettings.entrySet()) {
        NodeSettingsWO dtSetting = dtSettings.addNodeSettings(entry.getKey());
        entry.getValue().saveSettings(dtSetting);
    }
}
Also used : NodeSettingsWO(org.knime.core.node.NodeSettingsWO)

Example 35 with NodeSettingsWO

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

the class MVIndividualSettings method saveSettings.

/**
 * Saves settings for a column.
 * @param settings the settings to write to
 */
protected void saveSettings(final NodeSettingsWO settings) {
    settings.addString(FACTORY_ID_CFG, m_factory.getID());
    NodeSettingsWO s = settings.addNodeSettings(SETTINGS_CFG);
    m_settings.copyTo(s);
}
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