Search in sources :

Example 11 with DropPaneConfig

use of org.knime.base.node.preproc.draganddroppanel.droppanes.DropPaneConfig in project knime-core by knime.

the class TypeSelectionConfiguration method saveSettingsTo.

/**
 * {@inheritDoc}
 */
@Override
public void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
    settings.addInt("numberOfPanels", m_panelList.size());
    List<DropPaneConfig> values = Arrays.asList(m_panelList.values().toArray(new DropPaneConfig[m_panelList.size()]));
    Collections.sort(values);
    for (int i = 0; i < values.size(); i++) {
        DropPaneConfig dpc = values.get(i);
        PaneConfigurationDialog p = dpc.getDialog();
        NodeSettings n = new NodeSettings("dialogSettings_" + i);
        p.saveSettingsTo(n);
        settings.addNodeSettings(n);
        settings.addString("panelIndex_" + i, dpc.getSelectionAsString());
    // settings.addInt("panelIndex" + i, p.getIndex());
    }
}
Also used : NodeSettings(org.knime.core.node.NodeSettings) DropPaneConfig(org.knime.base.node.preproc.draganddroppanel.droppanes.DropPaneConfig)

Example 12 with DropPaneConfig

use of org.knime.base.node.preproc.draganddroppanel.droppanes.DropPaneConfig in project knime-core by knime.

the class TypeSelectionConfiguration method loadValidatedSettingsFrom.

/**
 * {@inheritDoc}
 */
@Override
public void loadValidatedSettingsFrom(final NodeSettingsRO settings) throws InvalidSettingsException {
    int size = settings.getInt("numberOfPanels");
    for (int i = 0; i < size; i++) {
        DropPaneConfig dpc = new DropPaneConfig();
        dpc.getSelection().addAll(Arrays.asList(settings.getString("panelIndex_" + i).split("\n")));
        PaneConfigurationDialog dp = m_fac.getNewInstance();
        NodeSettingsRO n = settings.getNodeSettings("dialogSettings_" + i);
        dp.loadValidatedSettings(n);
        dpc.setDialog(dp);
        dpc.setPosition(i);
        m_panelList.put(dpc.getPosition(), dpc);
    }
}
Also used : DropPaneConfig(org.knime.base.node.preproc.draganddroppanel.droppanes.DropPaneConfig) NodeSettingsRO(org.knime.core.node.NodeSettingsRO)

Example 13 with DropPaneConfig

use of org.knime.base.node.preproc.draganddroppanel.droppanes.DropPaneConfig in project knime-core by knime.

the class TypeSelectionConfiguration method validateSettings.

/**
 * {@inheritDoc}
 */
@Override
public void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
    int size = settings.getInt("numberOfPanels");
    for (int i = 0; i < size; i++) {
        DropPaneConfig dpc = new DropPaneConfig();
        dpc.getSelection().addAll(Arrays.asList(settings.getString("panelIndex_" + i).split("\n")));
        PaneConfigurationDialog dp = m_fac.getNewInstance();
        NodeSettingsRO n = settings.getNodeSettings("dialogSettings_" + i);
        dp.validateSettings(n);
        dpc.setDialog(dp);
        dpc.setPosition(i);
    }
}
Also used : DropPaneConfig(org.knime.base.node.preproc.draganddroppanel.droppanes.DropPaneConfig) NodeSettingsRO(org.knime.core.node.NodeSettingsRO)

Aggregations

DropPaneConfig (org.knime.base.node.preproc.draganddroppanel.droppanes.DropPaneConfig)13 NodeSettingsRO (org.knime.core.node.NodeSettingsRO)6 NodeSettings (org.knime.core.node.NodeSettings)4 ArrayList (java.util.ArrayList)3 DataColumnSpec (org.knime.core.data.DataColumnSpec)2 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)2 DataColumnSpecCreator (org.knime.core.data.DataColumnSpecCreator)1 DataType (org.knime.core.data.DataType)1 Pair (org.knime.core.util.Pair)1