|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.core.node.defaultnodesettings.DialogComponent
public abstract class DialogComponent
Abstract implementation of a component handling a standard type in a
NodeDialog. Actual implementations will make sure the label and editable
components are placed nicely in the underlying JPanel and their models will
handle save/load to and from config objects. Using the
DefaultNodeSettingsPane
it is easy to add such Component to quickly
assemble a dialog dealing with typical parameters.
Each component has a DialogComponent.EmptySettingsModel
associated with it, which stores
the current value of the component and handles all value related operations,
like loading, saving, etc.
DefaultNodeSettingsPane
,
DialogComponent.EmptySettingsModel
Nested Class Summary | |
---|---|
protected static class |
DialogComponent.EmptySettingsModel
------------------------------------------------------------------------- Components deriving from DialogComponent can use this model if
they don't need or want to store any value (but are only displaying
stuff). |
Field Summary | |
---|---|
protected static Color |
DEFAULT_BG
default background color for editable components. |
protected static Color |
DEFAULT_FG
default foreground color for editable components. |
Constructor Summary | |
---|---|
DialogComponent(SettingsModel model)
Abstract constructor expecting the model for this component. |
Method Summary | |
---|---|
protected abstract void |
checkConfigurabilityBeforeLoad(PortObjectSpec[] specs)
Will be called before the new values are loaded from the NodeSettings object. |
protected void |
clearError(JTextField field)
Sets the foreground and background colors of the specified component back to the normal default colors. |
JPanel |
getComponentPanel()
|
protected PortObjectSpec |
getLastTableSpec(int portID)
|
protected PortObjectSpec[] |
getLastTableSpecs()
|
SettingsModel |
getModel()
|
void |
loadSettingsFrom(NodeSettingsRO settings,
PortObjectSpec[] specs)
Read value(s) of this dialog component from the configuration object. |
void |
saveSettingsTo(NodeSettingsWO settings)
Write value(s) of this dialog component to the configuration object. |
void |
setEnabled(boolean enabled)
Deprecated. rather use the component's DialogComponent.EmptySettingsModel to
enable/disable the component. |
protected abstract void |
setEnabledComponents(boolean enabled)
This method is called by the above (final) setEnabled(boolean)
method. |
abstract void |
setToolTipText(String text)
Implement this so it sets the tooltip on your component(s). |
protected void |
showError(JTextField field)
Colors the component red, and registers a listener to the edit field that sets the colors back to the default as soon as the user edits something in the field. |
protected abstract void |
updateComponent()
Read the value from the DialogComponent.EmptySettingsModel and set/display it in the
component. |
protected abstract void |
validateSettingsBeforeSave()
Will be called before the value of the component is saved into the NodeSettings object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Color DEFAULT_FG
protected static final Color DEFAULT_BG
Constructor Detail |
---|
public DialogComponent(SettingsModel model)
model
- the value model for this componentMethod Detail |
---|
public JPanel getComponentPanel()
public final SettingsModel getModel()
protected final PortObjectSpec getLastTableSpec(int portID)
portID
- the id of the port the spec should be returned for
loadSettingsFrom(NodeSettingsRO, PortObjectSpec[])
protected final PortObjectSpec[] getLastTableSpecs()
loadSettingsFrom(NodeSettingsRO, PortObjectSpec[])
public final void loadSettingsFrom(NodeSettingsRO settings, PortObjectSpec[] specs) throws NotConfigurableException
settings
- the NodeSettings
to read fromspecs
- the input specs
NotConfigurableException
- If there is no chance for the dialog
component to be valid (i.e. the settings are valid), e.g. if
the given specs lack some important columns or column types.protected abstract void updateComponent()
DialogComponent.EmptySettingsModel
and set/display it in the
component. (Called after loading new values in the model to ensure they
are transfered into the component.) Implementations should set the new
value(s) in the components, should clear any possible error indications,
and should also take over the enable state.
public final void saveSettingsTo(NodeSettingsWO settings) throws InvalidSettingsException
settings
- the NodeSettings
to read from
InvalidSettingsException
- if the user has entered wrong values.protected abstract void validateSettingsBeforeSave() throws InvalidSettingsException
InvalidSettingsException
- if the entered values are invalidprotected abstract void checkConfigurabilityBeforeLoad(PortObjectSpec[] specs) throws NotConfigurableException
specs
- the specs from the input ports.
NotConfigurableException
- if the component can't be used due to
inappropriate table specs. (Prevents the dialog from being
opened.)@Deprecated public final void setEnabled(boolean enabled)
DialogComponent.EmptySettingsModel
to
enable/disable the component.
enabled
- if true
the contained components will be
enabledComponent.setEnabled(boolean)
protected abstract void setEnabledComponents(boolean enabled)
setEnabled(boolean)
method. Derived classes should disable all the contained components in
here.
enabled
- the new status of the componentsetEnabled(boolean)
protected void showError(JTextField field)
field
- the component to set the color inprotected void clearError(JTextField field)
field
- the textfield to clear the error forpublic abstract void setToolTipText(String text)
text
- the tool tip text to set.JComponent.setToolTipText(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |