Search in sources :

Example 1 with ConfigWO

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

the class VirtualParallelizedChunkPortObjectInNodeFactory 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 2 with ConfigWO

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

the class PieSectionDataModel method saveElements.

/**
 * {@inheritDoc}
 */
@Override
protected void saveElements(final Collection<PieSubSectionDataModel> elements, final ConfigWO config, final ExecutionMonitor exec) throws CanceledExecutionException {
    config.addInt(CFG_ELEMENT_COUNT, elements.size());
    int idx = 0;
    for (final PieSubSectionDataModel element : elements) {
        final ConfigWO elementConfig = config.addConfig(CFG_SECTION_ELEMENT + idx++);
        element.save2File(elementConfig, exec);
    }
}
Also used : ConfigWO(org.knime.core.node.config.ConfigWO)

Example 3 with ConfigWO

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

the class DataTableSpec method save.

/**
 * Saves the table spec name and all {@link DataColumnSpec}s to the given
 * {@link ConfigWO} object.
 *
 * @param config the config object to save this table specs to
 */
public void save(final ConfigWO config) {
    config.addString(CFG_SPEC_NAME, m_name);
    config.addInt(CFG_NR_COLUMNS, m_columnSpecs.length);
    for (int i = 0; i < m_columnSpecs.length; i++) {
        ConfigWO column = config.addConfig(CFG_COLUMN_SPEC + i);
        m_columnSpecs[i].save(column);
    }
    if (!m_properties.isEmpty()) {
        Config propertiesConfig = config.addConfig(CFG_PROPERTIES);
        int i = 0;
        for (Map.Entry<String, String> entry : m_properties.entrySet()) {
            Config entryConfig = propertiesConfig.addConfig("prop-" + (i++));
            entryConfig.addString(CFG_PROPERTY_KEY, entry.getKey());
            entryConfig.addString(CFG_PROPERTY_VALUE, entry.getValue());
        }
    }
}
Also used : Config(org.knime.core.node.config.Config) ConfigWO(org.knime.core.node.config.ConfigWO) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) TreeMap(java.util.TreeMap)

Example 4 with ConfigWO

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

the class DataType method save.

/**
 * Saves this <code>DataType</code> to the given
 * {@link org.knime.core.node.config.ConfigWO}.
 * If it is a native type only the class name of the cell class is stored.
 * Otherwise the names of all value classes and whether it has a preferred
 * value is written to the {@link org.knime.core.node.config.ConfigWO}.
 *
 * @param config write to this {@link org.knime.core.node.config.ConfigWO}
 */
public void save(final ConfigWO config) {
    if (m_collectionElementType != null) {
        ConfigWO sub = config.addConfig(CFG_COLL_ELEMENT_TYPE);
        m_collectionElementType.save(sub);
    }
    if (m_cellClass == null) {
        config.addString(CFG_CELL_NAME, null);
        // only for backwards compatibility
        config.addBoolean(CFG_HAS_PREF_VALUE, true);
        String[] valueClasses = convertClassesToNames(m_valueClasses);
        config.addStringArray(CFG_VALUE_CLASSES, valueClasses);
    } else {
        // only memorize cell class (is hashed anyway)
        config.addString(CFG_CELL_NAME, m_cellClass.getName());
    }
    if (!m_adapterValueList.isEmpty()) {
        String[] adapterClasses = convertClassesToNames(m_adapterValueList);
        config.addStringArray(CFG_ADAPTER_CLASSES, adapterClasses);
    }
}
Also used : ConfigWO(org.knime.core.node.config.ConfigWO)

Example 5 with ConfigWO

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

the class BarDataModel method saveElements.

/**
 * {@inheritDoc}
 */
@Override
protected void saveElements(final Collection<BarElementDataModel> elements, final ConfigWO config, final ExecutionMonitor exec) throws CanceledExecutionException {
    config.addInt(CFG_ELEMENT_COUNT, elements.size());
    int idx = 0;
    for (final BarElementDataModel element : elements) {
        final ConfigWO elementConfig = config.addConfig(CFG_BAR_ELEMENT + idx++);
        element.save2File(elementConfig, exec);
    }
}
Also used : ConfigWO(org.knime.core.node.config.ConfigWO)

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