Package io.guise.framework.model
Class SingleListSelectionPolicy<V>
- java.lang.Object
-
- io.guise.framework.model.AbstractListSelectionPolicy<V>
-
- io.guise.framework.model.SingleListSelectionPolicy<V>
-
- Type Parameters:
V
- The type of values contained in the select model.
- All Implemented Interfaces:
ListSelectionPolicy<V>
public final class SingleListSelectionPolicy<V> extends AbstractListSelectionPolicy<V>
An implementation of a selection strategy for a select model allowing only a single selection at a time. This class is marked final because it demarcates certain selection semantics that, if they can be assumed, may be offloaded to a component's view in certain circumstances. This class is thread-safe, and assumes that the corresponding select model is thread-safe, synchronized on itself.- Author:
- Garret Wilson
- See Also:
ListSelectModel
-
-
Constructor Summary
Constructors Constructor Description SingleListSelectionPolicy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]
getAddSelectedIndices(ListSelectModel<V> selectModel, int[] indices)
Determines which requested indices may be added to the selection.int[]
getSetSelectedIndices(ListSelectModel<V> selectModel, int[] indices)
Determines which requested indices may be set as the selection.-
Methods inherited from class io.guise.framework.model.AbstractListSelectionPolicy
getRemoveSelectedIndices
-
-
-
-
Method Detail
-
getSetSelectedIndices
public int[] getSetSelectedIndices(ListSelectModel<V> selectModel, int[] indices)
Determines which requested indices may be set as the selection. This implementation allows the setting of all requested indices.This implementation allows the setting of all requested indices.
This implementation only allows the first index to be set.
- Specified by:
getSetSelectedIndices
in interfaceListSelectionPolicy<V>
- Overrides:
getSetSelectedIndices
in classAbstractListSelectionPolicy<V>
- Parameters:
selectModel
- The model containing the values to be selected.indices
- The requested indices to set as the selection.- Returns:
- The indices that can be set as the selection.
-
getAddSelectedIndices
public int[] getAddSelectedIndices(ListSelectModel<V> selectModel, int[] indices)
Determines which requested indices may be added to the selection. This implementation allows the addition of all requested indices.This implementation allows the addition of all requested indices.
This implementation allows the addition of all requested indices.
- Specified by:
getAddSelectedIndices
in interfaceListSelectionPolicy<V>
- Overrides:
getAddSelectedIndices
in classAbstractListSelectionPolicy<V>
- Parameters:
selectModel
- The model containing the values to be selected.indices
- The requested indices to add to the selection.- Returns:
- The indices that can be added to the selection.
-
-