org.knime.core.node.defaultnodesettings
Class DefaultNodeSettingsPane

java.lang.Object
  extended by org.knime.core.node.NodeDialogPane
      extended by org.knime.core.node.defaultnodesettings.DefaultNodeSettingsPane
Direct Known Subclasses:
CAIMDiscretizationNodeDialog, CellSplitterByPosNodeDialog, ClusterNodeDialog, CollectionCreateNodeDialogPane, ColorAppender2NodeDialogPane, ColumnFilterRefNodeDialogPane, DBConnectionWriterDialogPane, DBQueryNodeDialogPane, DecisionTreeLearnerNodeDialog, DefaultVisualizationNodeDialog, DoubleToIntNodeDialog, HierarchicalClusterNodeDialog, HistogramNodeDialogPane, LiftChartNodeDialog, Many2OneColNodeDialog, MDSNodeDialog, MDSProjectionNodeDialog, NaiveBayesLearnerNodeDialog, NaiveBayesPredictorNodeDialog, NumberToStringNodeDialog, One2ManyColNodeDialog, PCAApplyNodeDialog, PCAComputeNodeDialog, PCANodeDialog, PCAReverseNodeDialog, PieNodeDialogPane, PivotNodeDialogPane, PMCCNodeDialogPane, PMMLReaderNodeDialog, PMMLWriterNodeDialog, PortObjectReaderNodeDialog, PortObjectWriterNodeDialog, ReadTableNodeDialogPane, RowFilterRefNodeDialogPane, RowKeyNodeDialog, RPropNodeDialog, SetOperatorNodeDialog, ShapeAppenderNodeDialogPane, SizeAppenderNodeDialogPane, SizeManager2NodeDialogPane, Statistics2NodeDialogPane, SubgroupMinerDialog, TransposeTableNodeDialogPane, UnpivotNodeDialogPane, WriteTableNodeDialogPane

public class DefaultNodeSettingsPane
extends NodeDialogPane

Default implementation for a NodeDialogPane that allows to add standard DialogComponents which will be displayed in a standard way and automatically stored and retrieved in the node settings objects.

Author:
M. Berthold, University of Konstanz

Constructor Summary
DefaultNodeSettingsPane()
          Constructor for DefaultNodeDialogPane.
 
Method Summary
 void addDialogComponent(DialogComponent diaC)
          Add a new DialogComponent to the underlying dialog.
 void closeCurrentGroup()
          Closes the current group.
 void createNewGroup(String title)
          Creates a new dialog component group and closes the current one.
 void createNewTab(String tabTitle)
          Creates a new tab in the dialog.
 void createNewTabAt(String tabTitle, int index)
          Creates a new tab in the dialog.
 void loadAdditionalSettingsFrom(NodeSettingsRO settings, DataTableSpec[] specs)
          Override hook to load additional settings when all input ports are data ports.
 void loadAdditionalSettingsFrom(NodeSettingsRO settings, PortObjectSpec[] specs)
          This method can be overridden to load additional settings.
 void loadSettingsFrom(NodeSettingsRO settings, PortObjectSpec[] specs)
          Load settings for all registered components.
 void saveAdditionalSettingsTo(NodeSettingsWO settings)
          This method can be overridden to save additional settings to the given settings object.
 void saveSettingsTo(NodeSettingsWO settings)
          Save settings of all registered DialogComponents into the configuration object.
 void selectTab(String tabTitle)
          Brings the specified tab to front and shows its components.
 void setDefaultTabTitle(String tabTitle)
          Sets the title of the default tab that is created and used until you call createNewTab(java.lang.String).
 void setHorizontalPlacement(boolean horizontal)
          Changes the orientation the components get placed in the dialog.
 
Methods inherited from class org.knime.core.node.NodeDialogPane
addJobMgrTab, addTab, addTabAt, createFlowVariableModel, createFlowVariableModel, createFlowVariableModel, finishEditingAndSaveSettingsTo, getAvailableFlowVariables, getPanel, getTab, getTabIndex, internalLoadSettingsFrom, loadSettingsFrom, loadSettingsFrom, onCancel, onClose, onOpen, removeTab, renameTab, saveSettingsTo, setEnabled, setSelected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultNodeSettingsPane

public DefaultNodeSettingsPane()
Constructor for DefaultNodeDialogPane.

Method Detail

setDefaultTabTitle

public void setDefaultTabTitle(String tabTitle)
Sets the title of the default tab that is created and used until you call createNewTab(java.lang.String).

Parameters:
tabTitle - the new title of the first tab. Can't be null or empty.
Throws:
IllegalArgumentException - if the title is already used by another tab, or if the specified title is null or empty.

createNewTabAt

public void createNewTabAt(String tabTitle,
                           int index)
Creates a new tab in the dialog. All components added from now on are placed in that new tab. After creating a new tab the previous tab is no longer accessible. If a tab with the same name was created before an Exception is thrown. The new panel in the new tab has no group set (i.e. has no border). The new tab is placed at the specified position (or at the right most position, if the index is too big).

Parameters:
tabTitle - the title of the new tab to use from now on. Can't be null or empty.
index - the index to place the new tab at. Can't be negative.
Throws:
IllegalArgumentException - if you specify a title that is already been used by another tab. Or if the specified title is null or empty.
See Also:
setDefaultTabTitle(String)

createNewTab

public void createNewTab(String tabTitle)
Creates a new tab in the dialog. All components added from now on are placed in that new tab. After creating a new tab the previous tab is no longer accessible. If a tab with the same name was created before an Exception is thrown. The new panel in the new tab has no group set (i.e. has no border). The tab is placed at the right most position.

Parameters:
tabTitle - the title of the new tab to use from now on. Can't be null or empty.
Throws:
IllegalArgumentException - if you specify a title that is already been used by another tab. Or if the specified title is null or empty.
See Also:
setDefaultTabTitle(String)

selectTab

public void selectTab(String tabTitle)
Brings the specified tab to front and shows its components.

Parameters:
tabTitle - the title of the tab to select. If the specified title doesn't exist, this method does nothing.

createNewGroup

public void createNewGroup(String title)
Creates a new dialog component group and closes the current one. From now on the dialog components added with the addDialogComponent method are added to the current group. The group is a bordered and titled panel.

Parameters:
title - - the title of the new group.

closeCurrentGroup

public void closeCurrentGroup()
Closes the current group. Further added dialog components are added to the default panel outside any border.


addDialogComponent

public void addDialogComponent(DialogComponent diaC)
Add a new DialogComponent to the underlying dialog. It will automatically be added in the dialog and saved/loaded from/to the config.

Parameters:
diaC - component to be added

setHorizontalPlacement

public void setHorizontalPlacement(boolean horizontal)
Changes the orientation the components get placed in the dialog.

Parameters:
horizontal - true if the next components should be placed next to each other or false if the next components should be placed below each other.

loadSettingsFrom

public final void loadSettingsFrom(NodeSettingsRO settings,
                                   PortObjectSpec[] specs)
                            throws NotConfigurableException
Load settings for all registered components.

Overrides:
loadSettingsFrom in class NodeDialogPane
Parameters:
settings - the NodeSettings to read from
specs - the input specs
Throws:
NotConfigurableException - if the node can currently not be configured
See Also:
NodeModel.loadSettingsFrom(NodeSettingsRO)

saveSettingsTo

public final void saveSettingsTo(NodeSettingsWO settings)
                          throws InvalidSettingsException
Save settings of all registered DialogComponents into the configuration object.

Specified by:
saveSettingsTo in class NodeDialogPane
Parameters:
settings - the NodeSettings to write into
Throws:
InvalidSettingsException - if the user has entered wrong values
See Also:
NodeModel.loadSettingsFrom(NodeSettingsRO)

loadAdditionalSettingsFrom

public void loadAdditionalSettingsFrom(NodeSettingsRO settings,
                                       PortObjectSpec[] specs)
                                throws NotConfigurableException
This method can be overridden to load additional settings. Override this method if you have mixed input types (different port types). Alternatively, if your node only has ordinary data inputs, consider to overwrite the loadAdditionalSettingsFrom(NodeSettingsRO, DataTableSpec[]) method, which does the type casting already.

Parameters:
settings - the NodeSettings to read from
specs - the input specs
Throws:
NotConfigurableException - if the node can currently not be configured

loadAdditionalSettingsFrom

public void loadAdditionalSettingsFrom(NodeSettingsRO settings,
                                       DataTableSpec[] specs)
                                throws NotConfigurableException
Override hook to load additional settings when all input ports are data ports. This method is the specific implementation to loadAdditionalSettingsFrom(NodeSettingsRO, PortObjectSpec[]) if all input ports are data ports. All elements in the specs argument are guaranteed to be non-null.

Parameters:
settings - The settings of the node
specs - The DataTableSpec of the input tables.
Throws:
NotConfigurableException - If not configurable

saveAdditionalSettingsTo

public void saveAdditionalSettingsTo(NodeSettingsWO settings)
                              throws InvalidSettingsException
This method can be overridden to save additional settings to the given settings object.

Parameters:
settings - the NodeSettings to write into
Throws:
InvalidSettingsException - if the user has entered wrong values


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.