Search in sources :

Example 11 with ConfigWO

use of org.knime.core.node.config.ConfigWO in project knime-core by knime.

the class VirtualSubNodeInputNodeFactory method savePortTypeList.

/**
 * @param portTypes
 * @param config
 */
static void savePortTypeList(final PortType[] portTypes, final ConfigWO config) {
    for (int i = 0; i < portTypes.length; i++) {
        ConfigWO portSetting = config.addConfig("port_" + i);
        portSetting.addInt("index", i);
        ConfigWO portTypeConfig = portSetting.addConfig("type");
        portTypes[i].save(portTypeConfig);
    }
}
Also used : ConfigWO(org.knime.core.node.config.ConfigWO)

Example 12 with ConfigWO

use of org.knime.core.node.config.ConfigWO in project knime-core by knime.

the class DefaultHiLiteMapper method save.

/**
 * Saves the settings in this mapper to a config object. Note that it writes
 * directly to the passed root node of the config tree. It's good practice
 * to open an local config object on which this method is invoked.
 * @param config The config to write to.
 */
public void save(final ConfigWO config) {
    for (RowKey key : keySet()) {
        Set<RowKey> mappedKeys = getKeys(key);
        ConfigWO keySettings = config.addConfig(key.toString());
        keySettings.addString(key.getString(), key.getString());
        keySettings.addRowKeyArray(CFG_MAPPED_KEYS, mappedKeys.toArray(new RowKey[mappedKeys.size()]));
    }
}
Also used : RowKey(org.knime.core.data.RowKey) ConfigWO(org.knime.core.node.config.ConfigWO)

Example 13 with ConfigWO

use of org.knime.core.node.config.ConfigWO in project knime-core by knime.

the class PMCCPortObjectAndSpec method save.

/**
 * Saves this object to a config.
 * @param m To save to.
 */
public void save(final ConfigWO m) {
    ConfigWO sub = m.addConfig(CFG_INTERNAL);
    sub.addStringArray(CFG_NAMES, m_colNames);
    sub.addBoolean(CFG_CONTAINS_VALUES, m_correlations != null);
    if (m_correlations != null) {
        m_correlations.save(sub.addConfig(CFG_VALUES));
    }
}
Also used : ConfigWO(org.knime.core.node.config.ConfigWO)

Example 14 with ConfigWO

use of org.knime.core.node.config.ConfigWO in project knime-core by knime.

the class ColorModelNominal method save.

/**
 * Saves the <code>DataCell</code> to <code>Color</code> mapping to the
 * given <code>Config</code>. The color is split into red, green, blue, and
 * alpha component which are stored as int array.
 * @param config Save settings to.
 * @see org.knime.core.data.property.ColorHandler.ColorModel
 *      #save(ConfigWO)
 * @throws NullPointerException If the <i>config</i> is <code>null</code>.
 */
@Override
public void save(final ConfigWO config) {
    ConfigWO keyConfig = config.addConfig(CFG_KEYS);
    for (Map.Entry<DataCell, ColorAttr> e : m_map.entrySet()) {
        DataCell key = e.getKey();
        keyConfig.addDataCell(key.toString(), key);
        Color color = e.getValue().getColor();
        config.addInt(key.toString(), color.getRGB());
    }
}
Also used : Color(java.awt.Color) DataCell(org.knime.core.data.DataCell) ConfigWO(org.knime.core.node.config.ConfigWO) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 15 with ConfigWO

use of org.knime.core.node.config.ConfigWO in project knime-core by knime.

the class ShapeModelNominal method save.

/**
 * Saves the <code>DataCell</code> to <code>Shape</code> mapping to the
 * given <code>Config</code>.
 * @param config Save settings to.
 * @throws NullPointerException If the <i>config</i> is <code>null</code>.
 */
@Override
public void save(final ConfigWO config) {
    ConfigWO keyConfig = config.addConfig(CFG_KEYS);
    for (Map.Entry<DataCell, Shape> e : m_map.entrySet()) {
        DataCell key = e.getKey();
        keyConfig.addDataCell(key.toString(), key);
        Shape shape = e.getValue();
        config.addString(key.toString(), shape.toString());
    }
}
Also used : Shape(org.knime.core.data.property.ShapeFactory.Shape) DataCell(org.knime.core.data.DataCell) ConfigWO(org.knime.core.node.config.ConfigWO) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Aggregations

ConfigWO (org.knime.core.node.config.ConfigWO)15 Map (java.util.Map)4 Config (org.knime.core.node.config.Config)4 Color (java.awt.Color)3 File (java.io.File)3 FileOutputStream (java.io.FileOutputStream)3 LinkedHashMap (java.util.LinkedHashMap)3 GZIPOutputStream (java.util.zip.GZIPOutputStream)3 DataCell (org.knime.core.data.DataCell)3 NodeSettings (org.knime.core.node.NodeSettings)3 HashMap (java.util.HashMap)2 Point (java.awt.Point)1 TreeMap (java.util.TreeMap)1 ColorColumn (org.knime.base.node.viz.histogram.util.ColorColumn)1 PieSectionDataModel (org.knime.base.node.viz.pie.datamodel.PieSectionDataModel)1 RowKey (org.knime.core.data.RowKey)1 Shape (org.knime.core.data.property.ShapeFactory.Shape)1