Package io.guise.framework.model
Interface SelectModel<V>
-
- Type Parameters:
V
- The type of values contained in the model.
- All Superinterfaces:
java.util.Collection<V>
,java.lang.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
public interface SelectModel<V> extends ValueModel<V>, java.util.Collection<V>
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description V
getSelectedValue()
Determines the selected value.V[]
getSelectedValues()
Determines the selected values.boolean
replace(V oldValue, V newValue)
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 Detail
-
replace
boolean replace(V oldValue, V newValue)
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
void setSelectedValues(V... values) throws java.beans.PropertyVetoException
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:
java.beans.PropertyVetoException
- if the provided value is not valid or the change has otherwise been vetoed.
-
-