Interface OptionModel
- All Superinterfaces:
ComboBoxModel
,Iterable<Option>
,ListModel
Interface for a model on options.
- Since:
- 4.0.17
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Test, if the model contains an option with the given value.getChildModel
(boolean strict) Get a child model, i.e., a reference to the option model that can store a separate option as selection.
A child model can be said to operate strict, i.e., only values contained in the model can be set as selected.Get the option corresponding to the given value.Get the selected option.int
Get the index of the option matching the given value.void
setSelectedOption
(Option option) Set the selected option.Methods inherited from interface javax.swing.ComboBoxModel
getSelectedItem, setSelectedItem
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface javax.swing.ListModel
addListDataListener, getElementAt, getSize, removeListDataListener
-
Method Details
-
getOption
Get the option corresponding to the given value.- Parameters:
value
- The value to look up.- Returns:
- The matching option or null.
- Since:
- 4.0.17
-
contains
Test, if the model contains an option with the given value.- Parameters:
value
- The value to check.- Returns:
true
, if the model contains a matching option.- Since:
- 4.0.17
-
indexOf
Get the index of the option matching the given value.- Parameters:
value
- The value to find an option for.- Returns:
- The index of the option or -1, if no such option exists.
- Since:
- 4.0.17
-
getSelectedOption
Option getSelectedOption()Get the selected option.- Returns:
- The selected option (maybe null).
- Since:
- 4.0.17
-
setSelectedOption
Set the selected option.- Parameters:
option
- The option to set as selected (maybe null).- Since:
- 4.0.17
-
getChildModel
Get a child model, i.e., a reference to the option model that can store a separate option as selection.
A child model can be said to operate strict, i.e., only values contained in the model can be set as selected. If not strict, foreign options may be set, too.- Parameters:
strict
- Iftrue
, only defined options are allowed.- Returns:
- The child model.
- Since:
- 4.0.17
-