|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.core.node.NodeDialogPane
public abstract class NodeDialogPane
The base class for all node dialogs. It provides a tabbed pane to which the
derived dialog can add its own components (method
addTab(String, Component)
. Subclasses will also override
saveSettingsTo(NodeSettingsWO)
and either
loadSettingsFrom(NodeSettingsRO, DataTableSpec[])
or
loadSettingsFrom(NodeSettingsRO, PortObjectSpec[])
, whereby the
latter is only of interest when dealing with custom port types. Failing to
override one of the two load methods will result in errors during runtime.
DefaultNodeSettingsPane
Constructor Summary | |
---|---|
protected |
NodeDialogPane()
Creates a new dialog with the given title. |
Method Summary | |
---|---|
void |
addJobMgrTab(NodeContainer.NodeContainerSettings.SplitType splitType)
Creates and adds the job manager selection tab. |
(package private) void |
addMiscTab()
creates and adds the miscellaneous tab that is contained in each dialog of nodes with output ports. |
protected void |
addTab(String title,
Component comp)
Adds a new component in a new tab to the node's dialog. |
protected int |
addTabAt(int index,
String title,
Component comp)
Adds a new tab at a certain position in the tabbed pane of the node's dialog. |
protected FlowVariableModel |
createFlowVariableModel(SettingsModelFlowVariableCompatible dc)
Create model and register a new variable for a specific settings object. |
FlowVariableModel |
createFlowVariableModel(String[] keys,
FlowVariable.Type type)
Create model and register a new variable for a specific settings entry for a hierarchical settings object. |
FlowVariableModel |
createFlowVariableModel(String key,
FlowVariable.Type type)
Create model and register a new variable for a specific settings entry (in a non-hierarchical settings object). |
void |
finishEditingAndSaveSettingsTo(NodeSettingsWO settings)
Commit spinners and save settings. |
Map<String,FlowVariable> |
getAvailableFlowVariables()
|
JPanel |
getPanel()
|
protected Component |
getTab(String title)
Returns the component of the tab with the specified title. |
protected int |
getTabIndex(String title)
Returns the current index of the specified tab. |
void |
internalLoadSettingsFrom(NodeSettingsRO settings,
PortObjectSpec[] specs,
FlowObjectStack foStack)
Method being called from the node when the dialog shall load the settings from a NodeSettingsRO object. |
(package private) void |
internalSaveSettingsTo(NodeSettingsWO settings)
Called from the node when the current settings shall be writing to a NodeSettings object. |
void |
loadSettingsFrom(InputStream in)
Loads settings from an input stream (in xml format). |
protected void |
loadSettingsFrom(NodeSettingsRO settings,
DataTableSpec[] specs)
Invoked before the dialog window is opened. |
protected void |
loadSettingsFrom(NodeSettingsRO settings,
PortObjectSpec[] specs)
Invoked before the dialog window is opened. |
void |
onCancel()
Override this method in order to react on events induced by the Cancel button from the surrounding dialog. |
void |
onClose()
Override this method in order to react on events if the surrounding dialog is supposed to be closed. |
void |
onOpen()
Override this method in order to react on events if the surrounding dialog is supposed to be opened. |
protected void |
removeTab(String name)
Removes the tab and its component specified by the title
from the tabbed pane. |
protected void |
renameTab(String oldName,
String newName)
Changes the name of an existing tab. |
protected abstract void |
saveSettingsTo(NodeSettingsWO settings)
Invoked when the settings need to be applied. |
void |
saveSettingsTo(OutputStream out)
Saves current settings to an output stream (in xml format). |
protected void |
setEnabled(boolean enabled,
String tabTitle)
Sets the enable status of a certain tab in the dialog. |
protected boolean |
setSelected(String tabTitle)
Selects the tab with the specified title. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected NodeDialogPane()
#addTab(String,Component)
).
Method Detail |
---|
void addMiscTab()
public void addJobMgrTab(NodeContainer.NodeContainerSettings.SplitType splitType)
splitType
- indicates how table splitting is supported in this nodepublic final JPanel getPanel()
public final Map<String,FlowVariable> getAvailableFlowVariables()
public void internalLoadSettingsFrom(NodeSettingsRO settings, PortObjectSpec[] specs, FlowObjectStack foStack) throws NotConfigurableException
settings
- To load from.specs
- The DTSs from the inports.foStack
- Flow object stack (contains flow variables)
NotConfigurableException
- If loadSettingsFrom throws this exception.loadSettingsFrom(NodeSettingsRO, PortObjectSpec[])
void internalSaveSettingsTo(NodeSettingsWO settings) throws InvalidSettingsException
settings
- To write to. Forwarded to abstract saveSettings method.
InvalidSettingsException
- If any of the writing fails.protected void loadSettingsFrom(NodeSettingsRO settings, PortObjectSpec[] specs) throws NotConfigurableException
The implementation must be able to handle invalid or incomplete settings as the model may not have any reasonable values yet (for example when the dialog is opened for the first time). When an empty/invalid settings object is passed the dialog should set default values in its components.
settings
- The settings to load into the dialog. Could be an empty
object or contain invalid settings. But will never be null.specs
- The input data table specs. Items of the array could be null
if no spec is available from the corresponding input port.
NotConfigurableException
- if the dialog cannot be opened because
of real invalid settings or if any preconditions are not fulfilled, e.g.
no predecessor node, no nominal column in input table, etc.NodeModel.loadSettingsFrom(NodeSettingsRO)
protected void loadSettingsFrom(NodeSettingsRO settings, DataTableSpec[] specs) throws NotConfigurableException
The implementation must be able to handle invalid or incomplete settings as the model may not have any reasonable values yet (for example when the dialog is opened for the first time). When an empty/invalid settings object is passed the dialog should set default values in its components.
settings
- The settings to load into the dialog. Could be an empty
object or contain invalid settings. But will never be null.specs
- The input data table specs. Items of the array could be null
if no spec is available from the corresponding input port.
NotConfigurableException
- if the dialog cannot be opened because
of real invalid settings or if any preconditions are not fulfilled, e.g.
no predecessor node, no nominal column in input table, etc.NodeModel.loadSettingsFrom(NodeSettingsRO)
public void onCancel()
public void onClose()
public void onOpen()
protected abstract void saveSettingsTo(NodeSettingsWO settings) throws InvalidSettingsException
settings
- The settings object to write into.
InvalidSettingsException
- If the settings are not applicable to
the model.NodeModel.loadSettingsFrom(NodeSettingsRO)
public final void finishEditingAndSaveSettingsTo(NodeSettingsWO settings) throws InvalidSettingsException
saveSettingsTo(settings)
.
Derived classes should not be required to call this method. It may change in future versions without prior notice.
settings
- The settings object to write into.
InvalidSettingsException
- If the settings are not applicable to
the model.NodeModel.saveSettingsTo(NodeSettingsWO)
public final void saveSettingsTo(OutputStream out) throws InvalidSettingsException, IOException
Derived classes should not be required to call this method. It may change in future versions without prior notice.
out
- To save to.
InvalidSettingsException
- If the settings can't be save since
they are invalid
IOException
- If problems writing to the stream occur.loadSettingsFrom(InputStream)
public final void loadSettingsFrom(InputStream in) throws NotConfigurableException, IOException
Derived classes should not be required to call this method. It may change in future versions without prior notice.
in
- to load from.
NotConfigurableException
- If settings can't be loaded since the
most recent input spec does not match the settings (or is not available)
IOException
- If problems reading the stream occur.saveSettingsTo(OutputStream)
protected final void addTab(String title, Component comp)
If the specified title already exists, this method creates a new unique title for the new tab (and issues a coding problem warning). If the same title with the same component was added before, this method does nothing (but issues a coding problem warning). Also, the same component with a different title is accepted (again with a coding problem warning), the tab that was added before with this component is removed before adding the component again to the dialog.
title
- The title of the tab for the given component. Must be unique
for this dialog.comp
- The component to add to this dialog's tabbed pane.
NullPointerException
- If either the title or the component is
null
.protected final int addTabAt(int index, String title, Component comp)
NOTE: This method is more restrictive than the
addTab(String, Component)
method, in that it does not accept
duplicate titles or components.
index
- the index of the new tab after insertion. Must be greater
than or equal to zero.title
- The title of the new tab for the given component. Must be
unique for this dialog.comp
- The component to add to this dialog's tabbed pane.
NullPointerException
- If either the title or the component is
null
.
IllegalArgumentException
- if another tab with the same title or
the same component exists already
IndexOutOfBoundsException
- if the index is smaller than zero.protected final void renameTab(String oldName, String newName)
oldName
- the current name of the tab to be renamednewName
- the new name. Must be unique for this dialog. Must not be
null.
NullPointerException
- if one of the arguments is nullprotected final void setEnabled(boolean enabled, String tabTitle)
enabled
- set to true to enable the specified tab, or to false to
disable it.tabTitle
- the title of the tab to en/disable
IllegalArgumentException
- if a tab with the specified tabTitle
does not exist.protected final boolean setSelected(String tabTitle)
tabTitle
- the title to bring to front,
protected final Component getTab(String title)
title
- The name of tab to return the component from.
title
.protected final void removeTab(String name)
title
from the tabbed pane. Does nothing if a tab with the specified title
doesn't exist.
name
- The title of the tab to remove.getTabIndex(String)
,
addTabAt(int, String, Component)
protected final int getTabIndex(String title)
title
- of the tab to return the index for.
public FlowVariableModel createFlowVariableModel(String key, FlowVariable.Type type)
key
- of corresponding settings objecttype
- of variable/settings object
public FlowVariableModel createFlowVariableModel(String[] keys, FlowVariable.Type type)
keys
- hierarchy of keys of corresponding settings objecttype
- of variable/settings object
protected FlowVariableModel createFlowVariableModel(SettingsModelFlowVariableCompatible dc)
dc
- settings object of corresponding DialogComponent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |