Search in sources :

Example 6 with AbstractConfigEntry

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

the class NodeContainerProperties method getPropertyValue.

/**
 * {@inheritDoc}
 */
@Override
public Object getPropertyValue(final Object id) {
    if (id instanceof String) {
        String hierID = (String) id;
        // cut off our prefix from the ID
        if (!hierID.startsWith(m_prefix)) {
            return "ERROR: Unexpected property id: " + hierID + " (while in sub-config " + m_prefix + ")";
        }
        String ourID = hierID;
        if (!m_prefix.isEmpty()) {
            assert hierID.charAt(m_prefix.length()) == CONFIG_SEPARATOR.charAt(0);
            // + 1 for removing the separator
            ourID = hierID.substring(m_prefix.length() + 1);
        }
        AbstractConfigEntry entry = m_settings.getEntry(ourID);
        if (entry instanceof Config) {
            return new NodeContainerProperties(getNode(), (Config) entry, m_prefix.isEmpty() ? ourID : m_prefix + CONFIG_SEPARATOR + ourID);
        } else {
            if (entry == null) {
                return "ERROR: No value for key " + ourID;
            }
            return TokenizerSettings.printableStr(entry.toStringValue());
        }
    }
    return null;
}
Also used : AbstractConfigEntry(org.knime.core.node.config.base.AbstractConfigEntry) Config(org.knime.core.node.config.Config)

Aggregations

AbstractConfigEntry (org.knime.core.node.config.base.AbstractConfigEntry)6 Config (org.knime.core.node.config.Config)3 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)2 NodeSettings (org.knime.core.node.NodeSettings)2 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 Stack (java.util.Stack)1 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)1 Icon (javax.swing.Icon)1 TreeNode (javax.swing.tree.TreeNode)1 Point (org.eclipse.swt.graphics.Point)1 TableColumn (org.eclipse.swt.widgets.TableColumn)1 TableItem (org.eclipse.swt.widgets.TableItem)1 IPropertyDescriptor (org.eclipse.ui.views.properties.IPropertyDescriptor)1 PropertyDescriptor (org.eclipse.ui.views.properties.PropertyDescriptor)1 TextPropertyDescriptor (org.eclipse.ui.views.properties.TextPropertyDescriptor)1 ConfigBase (org.knime.core.node.config.base.ConfigBase)1 FlowObjectStack (org.knime.core.node.workflow.FlowObjectStack)1 FlowVariable (org.knime.core.node.workflow.FlowVariable)1 Type (org.knime.core.node.workflow.FlowVariable.Type)1