Package io.guise.framework.model
Interface ListSelectModel<V>
-
- Type Parameters:
V
- The type of values contained in the model.
- All Superinterfaces:
java.util.Collection<V>
,java.lang.Iterable<V>
,java.util.List<V>
,ListListenable<V>
,Model
,com.globalmentor.model.MutableValued<V>
,com.globalmentor.beans.PropertyBindable
,com.globalmentor.beans.PropertyConstrainable
,SelectModel<V>
,com.globalmentor.model.Valued<V>
,ValueModel<V>
- All Known Subinterfaces:
CardControl
,ListSelectControl<V>
- All Known Implementing Classes:
AbstractCardPanel
,AbstractListSelectContainerControl
,AbstractListSelectControl
,AbstractListSelectTableModel
,BooleanValueControlSelectControl
,CardPanel
,CardTabControl
,DefaultListSelectModel
,ListControl
,SequenceCardPanel
,TabbedPanel
,TabContainerControl
,TabControl
public interface ListSelectModel<V> extends SelectModel<V>, java.util.List<V>, ListListenable<V>
A model for selecting one or more values from a list. The model must be thread-safe, synchronized on itself. Any iteration over values should include synchronization on the instance of this interface. When the selection is changed, aListSelectionEvent
is fired. When the state of a value (besides its selection, such as its enabled status) changes, aGenericPropertyChangeEvent
event is fired referencing the value the state of which has changed.- 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 void
addListListener(ListListener<V> listListener)
Adds a list listener.void
addListSelectionListener(ListSelectionListener<V> selectionListener)
Adds a list selection listener.void
addSelectedIndexes(int... indexes)
Adds a selection at the given indices.int
getSelectedIndex()
Determines the selected index.int[]
getSelectedIndexes()
Determines the selected indices.ListSelectionPolicy<V>
getSelectionPolicy()
boolean
isIndexDisplayed(int index)
Determines the displayed status of a given index.boolean
isIndexEnabled(int index)
Determines the enabled status of a given index.boolean
isValueDisplayed(V value)
Determines the displayed status of the first occurrence of a given value.boolean
isValueEnabled(V value)
Determines the enabled status of the first occurrence of a given value.void
removeListListener(ListListener<V> listListener)
Removes a list listener.void
removeListSelectionListener(ListSelectionListener<V> selectionListener)
Removes a list selection listener.void
removeSelectedIndexes(int... indexes)
Removes a selection at the given indices.void
setIndexDisplayed(int index, boolean newDisplayed)
Sets the displayed status of a given index.void
setIndexEnabled(int index, boolean newEnabled)
Sets the enabled status of a given index.void
setSelectedIndexes(int... indexes)
Sets the selected indices.void
setValueDisplayed(V value, boolean newDisplayed)
Sets the displayed status of the first occurrence of a given value.void
setValueEnabled(V value, boolean newEnabled)
Sets the enabled status of the first occurrence of a given value.-
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, 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.SelectModel
getSelectedValue, getSelectedValues, replace, setSelectedValues
-
Methods inherited from interface io.guise.framework.model.ValueModel
clearValue, getDefaultValue, getValidator, getValue, getValueClass, isValidValue, resetValue, setValidator, setValue, validateValue
-
-
-
-
Method Detail
-
getSelectionPolicy
ListSelectionPolicy<V> getSelectionPolicy()
- Returns:
- The selection policy for this model.
-
getSelectedIndex
int getSelectedIndex()
Determines the selected index. If more than one index is selected, the lead selected index will be returned.- Returns:
- The index currently selected, or -1 if no index is selected.
- See Also:
SelectModel.getSelectedValue()
-
getSelectedIndexes
int[] getSelectedIndexes()
Determines the selected indices.- Returns:
- The indices currently selected.
- See Also:
SelectModel.getSelectedValues()
-
setSelectedIndexes
void setSelectedIndexes(int... indexes) throws java.beans.PropertyVetoException
Sets the selected indices. Invalid and duplicate indices will be ignored. If the value change is vetoed by the installed validator, the validation exception will be accessible viaThrowable.getCause()
.- Parameters:
indexes
- The indices to select.- Throws:
java.beans.PropertyVetoException
- if the provided value is not valid or the change has otherwise been vetoed.- See Also:
ListSelectionPolicy.getSetSelectedIndices(ListSelectModel, int[])
,SelectModel.setSelectedValues(Object...)
,addSelectedIndexes(int...)
-
addSelectedIndexes
void addSelectedIndexes(int... indexes) throws java.beans.PropertyVetoException
Adds a selection at the given indices. Any invalid indices will be ignored. If the value change is vetoed by the installed validator, the validation exception will be accessible viaThrowable.getCause()
.- Parameters:
indexes
- The indices to add to the selection.- Throws:
java.beans.PropertyVetoException
- if the provided value is not valid or the change has otherwise been vetoed.- See Also:
ListSelectionPolicy.getAddSelectedIndices(ListSelectModel, int[])
,setSelectedIndexes(int...)
-
removeSelectedIndexes
void removeSelectedIndexes(int... indexes) throws java.beans.PropertyVetoException
Removes a selection at the given indices. Any invalid indices will be ignored. If the value change is vetoed by the installed validator, the validation exception will be accessible viaThrowable.getCause()
.- Parameters:
indexes
- The indices to remove from the selection.- Throws:
java.beans.PropertyVetoException
- if the provided value is not valid or the change has otherwise been vetoed.- See Also:
ListSelectionPolicy.getRemoveSelectedIndices(ListSelectModel, int[])
,setSelectedIndexes(int[])
-
isValueDisplayed
boolean isValueDisplayed(V value)
Determines the displayed status of the first occurrence of a given value.- Parameters:
value
- The value for which the displayed status is to be determined.- Returns:
true
if the value is displayed, elsefalse
.- Throws:
java.lang.IndexOutOfBoundsException
- if the given value does not occur in the model.
-
setValueDisplayed
void setValueDisplayed(V value, boolean newDisplayed)
Sets the displayed status of the first occurrence of a given value. This is a bound value state property.- Parameters:
value
- The value to display.newDisplayed
- Whether the value should be displayed.- See Also:
Displayable.DISPLAYED_PROPERTY
-
isIndexDisplayed
boolean isIndexDisplayed(int index)
Determines the displayed status of a given index.- Parameters:
index
- The index of the value for which the displayed status is to be determined.- Returns:
true
if the value at the given index is displayed, elsefalse
.
-
setIndexDisplayed
void setIndexDisplayed(int index, boolean newDisplayed)
Sets the displayed status of a given index. This is a bound value state property.- Parameters:
index
- The index of the value to display.newDisplayed
- Whether the value at the given index should be displayed.- Throws:
java.lang.IndexOutOfBoundsException
- if the given index is not within the range of the list.- See Also:
Displayable.DISPLAYED_PROPERTY
-
isValueEnabled
boolean isValueEnabled(V value)
Determines the enabled status of the first occurrence of a given value.- Parameters:
value
- The value for which the enabled status is to be determined.- Returns:
true
if the value is enabled, elsefalse
.- Throws:
java.lang.IndexOutOfBoundsException
- if the given value does not occur in the model.
-
setValueEnabled
void setValueEnabled(V value, boolean newEnabled)
Sets the enabled status of the first occurrence of a given value. This is a bound value state property.- Parameters:
value
- The value to enable or disable.newEnabled
- Whether the value should be enabled.- See Also:
Enableable.ENABLED_PROPERTY
-
isIndexEnabled
boolean isIndexEnabled(int index)
Determines the enabled status of a given index.- Parameters:
index
- The index of the value for which the enabled status is to be determined.- Returns:
true
if the value at the given index is enabled, elsefalse
.
-
setIndexEnabled
void setIndexEnabled(int index, boolean newEnabled)
Sets the enabled status of a given index. This is a bound value state property.- Parameters:
index
- The index of the value to enable or disable.newEnabled
- Whether the value at the given index should be enabled.- Throws:
java.lang.IndexOutOfBoundsException
- if the given index is not within the range of the list.- See Also:
Enableable.ENABLED_PROPERTY
-
addListListener
void addListListener(ListListener<V> listListener)
Adds a list listener.- Specified by:
addListListener
in interfaceListListenable<V>
- Parameters:
listListener
- The list listener to add.
-
removeListListener
void removeListListener(ListListener<V> listListener)
Removes a list listener.- Specified by:
removeListListener
in interfaceListListenable<V>
- Parameters:
listListener
- The list listener to remove.
-
addListSelectionListener
void addListSelectionListener(ListSelectionListener<V> selectionListener)
Adds a list selection listener.- Parameters:
selectionListener
- The selection listener to add.
-
removeListSelectionListener
void removeListSelectionListener(ListSelectionListener<V> selectionListener)
Removes a list selection listener.- Parameters:
selectionListener
- The selection listener to remove.
-
-