Search in sources :

Example 26 with NodeSettingsRO

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

the class SettingsModelPCADimensions method loadSettingsForDialog.

/**
 * {@inheritDoc}
 */
@Override
protected void loadSettingsForDialog(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
    try {
        final NodeSettingsRO mySettings = settings.getNodeSettings(m_configName);
        setValues(mySettings.getDouble("doubleVal"), mySettings.getInt("intVal"), mySettings.getBoolean("choice"));
        if (specs.length > 1 && specs[1] instanceof PCAModelPortObjectSpec) {
            m_eigenvalues = ((PCAModelPortObjectSpec) specs[1]).getEigenValues();
        } else {
            m_eigenvalues = null;
        }
    } catch (final InvalidSettingsException e) {
        setValues(100, 2, false);
    }
}
Also used : InvalidSettingsException(org.knime.core.node.InvalidSettingsException) NodeSettingsRO(org.knime.core.node.NodeSettingsRO)

Example 27 with NodeSettingsRO

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

the class EditNominalDomainConfiguration method loadColumnMapping.

/**
 * Loads the column settings.
 *
 * @param settings
 * @throws InvalidSettingsException
 */
private void loadColumnMapping(final NodeSettingsRO settings) throws InvalidSettingsException {
    NodeSettingsRO nodeSettings = settings.getNodeSettings(COLUMNS);
    for (String cols : nodeSettings) {
        NodeSettingsRO colSettings = nodeSettings.getNodeSettings(cols);
        DataCell[] dataCellArray = colSettings.getDataCellArray(COLUMN_ORDERING, new DataCell[0]);
        DataCell[] createdSettings = colSettings.getDataCellArray(COLUMN_CREATED_VALS, new DataCell[0]);
        CheckUtils.checkSetting(dataCellArray != null, "invalid settings for column '%s'", cols);
        m_colMapping.put(cols, Arrays.asList(dataCellArray));
        m_createdDomainValues.put(cols, new HashSet<DataCell>(Arrays.asList(createdSettings)));
    }
}
Also used : DataCell(org.knime.core.data.DataCell) NodeSettingsRO(org.knime.core.node.NodeSettingsRO)

Example 28 with NodeSettingsRO

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

the class OrRowFilter method loadSettingsFrom.

/**
 * {@inheritDoc}
 */
@Override
public void loadSettingsFrom(final NodeSettingsRO cfg) throws InvalidSettingsException {
    NodeSettingsRO cfg1 = cfg.getNodeSettings(CFG_FILTER1);
    NodeSettingsRO cfg2 = cfg.getNodeSettings(CFG_FILTER2);
    m_in1 = RowFilterFactory.createRowFilter(cfg1);
    m_in2 = RowFilterFactory.createRowFilter(cfg2);
}
Also used : NodeSettingsRO(org.knime.core.node.NodeSettingsRO)

Example 29 with NodeSettingsRO

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

the class NegRowFilter method loadSettingsFrom.

/**
 * {@inheritDoc}
 */
@Override
public void loadSettingsFrom(final NodeSettingsRO cfg) throws InvalidSettingsException {
    NodeSettingsRO inCfg = cfg.getNodeSettings(CFG_INFILTER);
    m_inFilter = RowFilterFactory.createRowFilter(inCfg);
}
Also used : NodeSettingsRO(org.knime.core.node.NodeSettingsRO)

Example 30 with NodeSettingsRO

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

the class GroupByNodeModel method loadInternals.

/**
 * {@inheritDoc}
 */
@Override
protected void loadInternals(final File nodeInternDir, final ExecutionMonitor exec) throws IOException {
    if (m_enableHilite.getBooleanValue()) {
        final NodeSettingsRO config = NodeSettings.loadFromXML(new FileInputStream(new File(nodeInternDir, INTERNALS_FILE_NAME)));
        try {
            setHiliteMapping(DefaultHiLiteMapper.load(config));
            m_hilite.addToHiLiteHandler(getInHiLiteHandler(0));
        } catch (final InvalidSettingsException ex) {
            throw new IOException(ex.getMessage());
        }
    }
}
Also used : InvalidSettingsException(org.knime.core.node.InvalidSettingsException) NodeSettingsRO(org.knime.core.node.NodeSettingsRO) IOException(java.io.IOException) File(java.io.File) FileInputStream(java.io.FileInputStream)

Aggregations

NodeSettingsRO (org.knime.core.node.NodeSettingsRO)208 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)125 File (java.io.File)49 FileInputStream (java.io.FileInputStream)47 IOException (java.io.IOException)43 InputStream (java.io.InputStream)22 LinkedHashMap (java.util.LinkedHashMap)20 NodeSettings (org.knime.core.node.NodeSettings)20 BufferedInputStream (java.io.BufferedInputStream)19 ArrayList (java.util.ArrayList)16 GZIPInputStream (java.util.zip.GZIPInputStream)15 DataTableSpec (org.knime.core.data.DataTableSpec)14 Map (java.util.Map)11 ReferencedFile (org.knime.core.internal.ReferencedFile)11 BufferedDataTable (org.knime.core.node.BufferedDataTable)10 HashMap (java.util.HashMap)9 DataColumnSpec (org.knime.core.data.DataColumnSpec)9 RowKey (org.knime.core.data.RowKey)9 DataType (org.knime.core.data.DataType)8 CanceledExecutionException (org.knime.core.node.CanceledExecutionException)8