Default Dialog Components

Default dialog components provide a convenient way to obtain user input for a few basic settings through a dialog that can be easily created without going through the pain of working with swing components and layouts.

KNIME provides a couple of components that can be added to a default settings pane and that allow the user to enter values. These values can be easily retrieved in the NodeModel then. There is no way (and no need) to layout these components - they will automatically show in the dialog below each other (or next to each other, depending on the currently active orientation, see setHorizontalPlacement,) in the order they have been added. You can surround them with a border to make the dialog look nicer and you can create new tabs to organize them, but that's all.

Though we do not go into it here in more detail, there is also support for enabling/disabling the components through the mechanism of registered ChangeListeners.

Each default component uses a swing component (like a JTextField or JSpinner) as input field, and allows for adding a label to that field, to add an explanatory text for the user. Besides that each dialog component needs a SettingsModel. This settings model holds the actual value of the component and does the storing, loading and validation. When you instantiate the component you must provide a settings model - when you want to load the entered value in your NodeModel, you use an instance of that same SettingsModel. To identify the value handled by the settings model, you must provide a unique configName (i.e. a string ID).

Here is an example of a default dialog with a few components grouped into two groups:

An example of a default dialog. It shows a selection of available components, grouped into two groups, each surrounded by titled border.

For a complete list of available components (and settings models they require), please refer to the default dialog component overview.


What are you looking for?