public abstract class NodeDialogPane extends Object
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
Modifier | Constructor and Description |
---|---|
protected |
NodeDialogPane()
Creates a new dialog with the given title.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addFlowVariablesTab()
Add the flow variables tab.
|
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 void |
addTab(String title,
Component comp,
boolean wrapInScrollPane)
As
addTab(String, Component) but with an additional option to wrap the entire panel
into a scroll pane. |
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 int |
addTabAt(int index,
String title,
Component comp,
boolean wrapInScrollPane)
As
addTabAt(int, String, Component) but with an additional option to wrap the entire panel
into a scroll pane. |
(package private) void |
callDerivedLoadSettingsFrom(NodeSettingsRO settings,
PortObjectSpec[] specs,
PortObject[] data)
Calls abstract method
loadSettingsFrom(NodeSettingsRO, PortObjectSpec[]) . |
void |
callOnCancel()
This method calls
onCancel() after having set a NodeContext if none exists yet. |
void |
callOnClose()
Does some cleanup and finally calls the
onClose() method. |
(package private) void |
callOnOpen()
This method calls
onOpen() after having set a NodeContext if none exists yet. |
boolean |
closeOnESC()
Controls the behavior of the dialog when the ESC key is pressed.
|
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() |
(package private) Map<String,FlowVariable> |
getAvailableFlowVariables(FlowVariable.Type... types) |
Collection<String> |
getCredentialsNames()
Get a list of available credentials identifiers.
|
protected CredentialsProvider |
getCredentialsProvider()
Accessor to credentials defined on a workflow.
|
protected NodeLogger |
getLogger()
A logger initialized with the concrete runtime class.
|
protected NodeContext |
getNodeContext()
Returns the node context with which this dialog pane has been created.
|
JPanel |
getPanel()
Returns the panel holding the different tabs shown in the dialog.
|
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.
|
(package private) void |
internalLoadSettingsFrom(NodeSettingsRO settings,
PortObjectSpec[] specs,
PortObject[] data,
FlowObjectStack foStack,
CredentialsProvider credentialsProvider,
boolean isWriteProtected)
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 written to
a NodeSettings object.
|
boolean |
isWriteProtected()
Returns true if the underlying node is write protected.
|
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.
|
protected NodeDialogPane()
#addTab(String,Component)
).protected final NodeLogger getLogger()
void addMiscTab()
public void addJobMgrTab(NodeContainer.NodeContainerSettings.SplitType splitType)
splitType
- indicates how table splitting is supported in this nodepublic final JPanel getPanel()
public final boolean isWriteProtected()
NodeContainer.getNodeLocks()
) and
is executed at the same time, or it has a configure lock (NodeContainer.getNodeLocks()
).
Client code usually does not need to evaluate this flag, the
framework will disable the OK/Apply button for write protected nodes.public final Map<String,FlowVariable> getAvailableFlowVariables()
final Map<String,FlowVariable> getAvailableFlowVariables(FlowVariable.Type... types)
types
- Type filter (include)public final Collection<String> getCredentialsNames()
protected final CredentialsProvider getCredentialsProvider()
CredentialsProvider.get(String)
method will
register this node as client to the requested credentials.
The credentials identifier (its ICredentials.getName()
should be
part of the configuration, i.e. chosen by the user in the configuration
dialog.final void internalLoadSettingsFrom(NodeSettingsRO settings, PortObjectSpec[] specs, PortObject[] data, FlowObjectStack foStack, CredentialsProvider credentialsProvider, boolean isWriteProtected) throws NotConfigurableException
settings
- To load from.specs
- Specs at input portsdata
- Data from input portsfoStack
- Flow object stack (contains flow variables)credentialsProvider
- The credentials available in the flowisWriteProtected
- Whether ok/apply should be disabled
(write protected metanode)NotConfigurableException
- If loadSettingsFrom throws this exception.loadSettingsFrom(NodeSettingsRO, PortObjectSpec[])
void callDerivedLoadSettingsFrom(NodeSettingsRO settings, PortObjectSpec[] specs, PortObject[] data) throws NotConfigurableException
loadSettingsFrom(NodeSettingsRO, PortObjectSpec[])
. Overwritten
by DataAwareNodeDialogPane
to forward the input data.settings
- ...specs
- ...data
- ...NotConfigurableException
- ...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
(i.e. not connected or upstream node does not produce an
output spec). If a port is of type
BufferedDataTable.TYPE
and no spec is available the
framework will replace null by an empty DataTableSpec
(no columns) unless the port is marked as optional.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. If no spec is available for any
given port (because the port is not connected or the previous
node does not produce a spec) the framework will pass an
empty DataTableSpec
(no columns) unless the port is
marked as optional
(in which
case the array element is null).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 final void callOnCancel()
onCancel()
after having set a NodeContext
if none exists yet.public final void callOnClose()
onClose()
method.public void onClose()
public void onOpen()
final void callOnOpen()
onOpen()
after having set a NodeContext
if none exists yet.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 invalidIOException
- 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 void addFlowVariablesTab()
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 void addTab(String title, Component comp, boolean wrapInScrollPane)
addTab(String, Component)
but with an additional option to wrap the entire panel
into a scroll pane. Default is true as this is often neglected by the node author.title
- ... see referring method.comp
- ... see referring method.wrapInScrollPane
- true if the panel is to be wrapped in a scroll pane.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 alreadyIndexOutOfBoundsException
- if the index is smaller than zero.protected final int addTabAt(int index, String title, Component comp, boolean wrapInScrollPane)
addTabAt(int, String, Component)
but with an additional option to wrap the entire panel
into a scroll pane. Default is true as this is often neglected by the node authorindex
- ... see referring method.title
- ... see referring method.comp
- ... see referring method.wrapInScrollPane
- true if the panel is to be wrapped in a scroll pane.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/disableIllegalArgumentException
- 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 boolean closeOnESC()
public FlowVariableModel createFlowVariableModel(String key, FlowVariable.Type type)
key
- of corresponding settings objecttype
- of variable/settings objectpublic FlowVariableModel createFlowVariableModel(String[] keys, FlowVariable.Type type)
keys
- hierarchy of keys of corresponding settings objecttype
- of variable/settings objectprotected FlowVariableModel createFlowVariableModel(SettingsModelFlowVariableCompatible dc)
dc
- settings object of corresponding DialogComponentprotected final NodeContext getNodeContext()
KNIME GmbH, Konstanz, Germany
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.