Interface NodeSettingsService

All Known Implementing Classes:
DefaultNodeSettingsServiceWithVariables

public interface NodeSettingsService
Functionality around NodeSettings as required by the NodeDialog. Translates text-based settings (strings) used on the frontend-side from and to the backend-side settings representation (i.e. NodeSettings). Also provides default node settings.
Author:
Martin Horn, KNIME GmbH, Konstanz, Germany, Marc Bux, KNIME GmbH, Berlin, Germany
  • Method Details

    • fromNodeSettings

      String fromNodeSettings(Map<SettingsType,NodeAndVariableSettingsRO> settings, org.knime.core.node.port.PortObjectSpec[] specs)
      Called when a dialog is initialized. Infers a single text-based settings representation from possibly multiple NodeAndVariableSettingsRO-instances (one per SettingsType).
      Parameters:
      settings - the settings to read from; if there are no settings with the node stored, yet, the default node settings will be supplied (see #getDefaultNodeSettings(Map, PortObjectSpec[]))
      specs - the specs for configuring the settings (includes the flow variable port). NOTE: can contain null-values, e.g., in case an input port is not connected
      Returns:
      a new text-based settings representation
    • toNodeSettings

      void toNodeSettings(String textSettings, Map<SettingsType,NodeAndVariableSettingsWO> settings)
      Called when dialog settings are applied. Translates text-based settings to NodeAndVariableSettingsWO-instances of certain SettingsType.
      Parameters:
      textSettings - the text-based settings object
      settings - the settings instances to write into
    • validateNodeSettingsAndVariables

      default void validateNodeSettingsAndVariables(Map<SettingsType,NodeAndVariableSettingsRO> settings) throws org.knime.core.node.InvalidSettingsException
      An optional validation method which is meant to be called before fromNodeSettings(java.util.Map<org.knime.core.webui.node.dialog.SettingsType, org.knime.core.webui.node.dialog.NodeAndVariableSettingsRO>, org.knime.core.node.port.PortObjectSpec[]) in order to adjust the node settings (e.g. to not overwrite with flow variables when the overwritten settings do not validate). Per default, there is no validation.
      Parameters:
      settings - the settings to read from
      Throws:
      org.knime.core.node.InvalidSettingsException - in case the validation fails
    • deactivate

      default void deactivate()
      TODO UIEXT-1376 rethink if this method is necessary and if we can avoid the use of singletons here. Method called on deactivation of the dialog. The NodeContext provides the current node container here.