|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.core.node.defaultnodesettings.DialogComponent
org.knime.core.node.defaultnodesettings.DialogComponentStringListSelection
public final class DialogComponentStringListSelection
Provide a standard component for a dialog that allows to select one or more strings from a list of strings.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.knime.core.node.defaultnodesettings.DialogComponent |
---|
DialogComponent.EmptySettingsModel |
Field Summary |
---|
Fields inherited from class org.knime.core.node.defaultnodesettings.DialogComponent |
---|
DEFAULT_BG, DEFAULT_FG |
Constructor Summary | |
---|---|
DialogComponentStringListSelection(SettingsModelStringArray stringModel,
String label,
Collection<String> list,
boolean required,
int visibleRowCount)
Constructor that puts label and select box into panel. |
|
DialogComponentStringListSelection(SettingsModelStringArray stringModel,
String label,
Collection<String> list,
int selectionMode,
boolean required,
int visibleRowCount)
Constructor that puts label and select box into panel. |
|
DialogComponentStringListSelection(SettingsModelStringArray stringModel,
String label,
String... list)
Constructor that puts label and select box into panel. |
|
DialogComponentStringListSelection(SettingsModelStringArray stringModel,
String label,
StringIconOption[] list,
int selectionMode,
boolean required,
int visibleRowCount)
Constructor that puts label and select box into panel. |
Method Summary | |
---|---|
protected void |
checkConfigurabilityBeforeLoad(PortObjectSpec[] specs)
Will be called before the new values are loaded from the NodeSettings object. |
void |
replaceListItems(Collection<String> newItems,
String... select)
Replaces the list of selectable strings in the component. |
void |
replaceListItems(StringIconOption[] newItems,
String... select)
Replaces the list of selectable options in the component. |
protected void |
setEnabledComponents(boolean enabled)
This method is called by the above (final) DialogComponent.setEnabled(boolean)
method. |
void |
setSizeComponents(int width,
int height)
Sets the preferred size of the internal component. |
void |
setToolTipText(String text)
Implement this so it sets the tooltip on your component(s). |
void |
setVisibleRowCount(int visibleRowCount)
Sets the preferred number of rows in the list that can be displayed. |
protected void |
updateComponent()
Read the value from the DialogComponent.EmptySettingsModel and set/display it in the
component. |
(package private) void |
updateModel(boolean checkRequired)
Transfers the current value from the component into the model. |
protected void |
validateSettingsBeforeSave()
Will be called before the value of the component is saved into the NodeSettings object. |
Methods inherited from class org.knime.core.node.defaultnodesettings.DialogComponent |
---|
clearError, getComponentPanel, getLastTableSpec, getLastTableSpecs, getModel, loadSettingsFrom, saveSettingsTo, setEnabled, showError |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DialogComponentStringListSelection(SettingsModelStringArray stringModel, String label, String... list)
stringModel
- the model that stores the values for this component.label
- the optional label of the select box.
Set to null
for none label. Set an empty
String
for a border.list
- list of items for the select boxpublic DialogComponentStringListSelection(SettingsModelStringArray stringModel, String label, Collection<String> list, boolean required, int visibleRowCount)
stringModel
- the model that stores the values for this component.label
- the optional label of the select box.
Set to null
for none label. Set an empty
String
for a border.list
- list of items for the select boxrequired
- if at least one item must be selectedvisibleRowCount
- the number of visible rowspublic DialogComponentStringListSelection(SettingsModelStringArray stringModel, String label, Collection<String> list, int selectionMode, boolean required, int visibleRowCount)
selectionMode
values are allowed:
ListSelectionModel.SINGLE_SELECTION
Only one list index can be selected at a time. In this
mode the setSelectionInterval
and
addSelectionInterval
methods are equivalent, and only the second index
argument is used.
ListSelectionModel.SINGLE_INTERVAL_SELECTION
One contiguous index interval can be selected at a time.
In this mode setSelectionInterval
and
addSelectionInterval
are equivalent.
ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
In this mode, there's no restriction on what can be selected.
This is the default.
stringModel
- the model that stores all selected strings.label
- the optional label of the select box.
Set to null
for none label. Set an empty
String
for a border.list
- list (not empty) of strings (not null) for the select box.selectionMode
- an integer specifying the type of selections
that are permissiblerequired
- if at least one item must be selectedvisibleRowCount
- the number of visible rows
NullPointerException
- if one of the strings in the list is null
IllegalArgumentException
- if the list is empty or null.public DialogComponentStringListSelection(SettingsModelStringArray stringModel, String label, StringIconOption[] list, int selectionMode, boolean required, int visibleRowCount)
selectionMode
values are allowed:
ListSelectionModel.SINGLE_SELECTION
Only one list
index can be selected at a time. In this mode the
setSelectionInterval
and addSelectionInterval
methods are equivalent, and only the second index argument is used.
ListSelectionModel.SINGLE_INTERVAL_SELECTION
One
contiguous index interval can be selected at a time. In this mode
setSelectionInterval
and addSelectionInterval
are equivalent.
ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
In
this mode, there's no restriction on what can be selected. This is the
default.
stringModel
- the model that stores all selected strings.label
- the optional label of the select box. Set to
null
for none label. Set an empty
String
for a border.list
- list (not empty) of StringIconOptions (not null) for the
select box.selectionMode
- an integer specifying the type of selections that
are permissiblerequired
- if at least one item must be selectedvisibleRowCount
- the number of visible rows
NullPointerException
- if one of the strings in the list is null
IllegalArgumentException
- if the list is empty or null.Method Detail |
---|
protected 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.
updateComponent
in class DialogComponent
void updateModel(boolean checkRequired) throws InvalidSettingsException
checkRequired
- if the method should check the required flag
InvalidSettingsException
- if a selection is required and no item
is selectedprotected void validateSettingsBeforeSave() throws InvalidSettingsException
validateSettingsBeforeSave
in class DialogComponent
InvalidSettingsException
- if the entered values are invalidprotected void checkConfigurabilityBeforeLoad(PortObjectSpec[] specs)
checkConfigurabilityBeforeLoad
in class DialogComponent
specs
- the specs from the input ports.protected void setEnabledComponents(boolean enabled)
DialogComponent.setEnabled(boolean)
method. Derived classes should disable all the contained components in
here.
setEnabledComponents
in class DialogComponent
enabled
- the new status of the componentDialogComponent.setEnabled(boolean)
public void setSizeComponents(int width, int height)
width
- The width.height
- The height.public void setVisibleRowCount(int visibleRowCount)
The default value of this property is 8.
visibleRowCount
- an integer specifying the preferred number of
visible rowspublic void setToolTipText(String text)
setToolTipText
in class DialogComponent
text
- the tool tip text to set.JComponent.setToolTipText(java.lang.String)
public void replaceListItems(Collection<String> newItems, String... select)
select
is specified (not null) and it exists in the
collection it will be selected. If select
is null, the
previous value will stay selected (if it exists in the new list).
newItems
- new strings for the select boxselect
- the item to select after the replace. Can be null, in which
case the previous selection remains - if it exists in the new
list.public void replaceListItems(StringIconOption[] newItems, String... select)
select
is specified (not null) and it exists in the
collection it will be selected. If select
is null, the
previous value will stay selected (if it exists in the new list).
newItems
- new StringIconOption
s for the select boxselect
- the item to select after the replace. Can be null, in which
case the previous selection remains - if it exists in the new
list.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |