Package io.guise.framework.model
Interface SelectModel<V>
- Type Parameters:
V
- The type of values contained in the model.
- All Superinterfaces:
Collection<V>
,Iterable<V>
,Model
,com.globalmentor.model.MutableValued<V>
,com.globalmentor.beans.PropertyBindable
,com.globalmentor.beans.PropertyConstrainable
,com.globalmentor.model.Valued<V>
,ValueModel<V>
- All Known Subinterfaces:
CardControl
,ListSelectControl<V>
,ListSelectModel<V>
- All Known Implementing Classes:
AbstractCardPanel
,AbstractListSelectContainerControl
,AbstractListSelectControl
,AbstractListSelectTableModel
,BooleanValueControlSelectControl
,CardPanel
,CardTabControl
,DefaultListSelectModel
,ListControl
,SequenceCardPanel
,TabbedPanel
,TabContainerControl
,TabControl
A model for selecting one or more values from a collection. The model must be thread-safe, synchronized on itself. Any iteration over values should include
synchronization on the instance of this interface.
- Author:
- Garret Wilson
-
Field Summary
Fields inherited from interface io.guise.framework.model.ValueModel
VALIDATOR_PROPERTY, VALUE_PROPERTY
-
Method Summary
Modifier and TypeMethodDescriptionDetermines the selected value.V[]
Determines the selected values.boolean
Replaces the first occurrence in the of the given value with its replacement.void
setSelectedValues
(V... values) Sets the selected values.Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray
Methods inherited from interface com.globalmentor.beans.PropertyBindable
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
Methods inherited from interface com.globalmentor.beans.PropertyConstrainable
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, hasVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
Methods inherited from interface io.guise.framework.model.ValueModel
clearValue, getDefaultValue, getValidator, getValue, getValueClass, isValidValue, resetValue, setValidator, setValue, validateValue
-
Method Details
-
replace
Replaces the first occurrence in the of the given value with its replacement. This method ensures that another thread does not change the model while the search and replace operation occurs.- Parameters:
oldValue
- The value for which to search.newValue
- The replacement value.- Returns:
- Whether the operation resulted in a modification of the model.
-
getSelectedValue
V getSelectedValue()Determines the selected value. This method delegates to the selection strategy. If more than one value is selected, the lead selected value will be returned.- Returns:
- The value currently selected, or
null
if no value is currently selected.
-
getSelectedValues
V[] getSelectedValues()Determines the selected values. This method delegates to the selection strategy.- Returns:
- The values currently selected.
-
setSelectedValues
Sets the selected values. If a value occurs more than one time in the model, all occurrences of the value will be selected. Values that do not occur in the select model will be ignored. If the value change is vetoed by the installed validator, the validation exception will be accessible viaThrowable.getCause()
. This method delegates to the selection strategy.- Parameters:
values
- The values to select.- Throws:
PropertyVetoException
- if the provided value is not valid or the change has otherwise been vetoed.
-