com.guiseframework.model
Class SingleListSelectionPolicy<V>

java.lang.Object
  extended by com.guiseframework.model.AbstractListSelectionPolicy<V>
      extended by com.guiseframework.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
SingleListSelectionPolicy()
           
 
Method Summary
 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 com.guiseframework.model.AbstractListSelectionPolicy
getRemoveSelectedIndices
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleListSelectionPolicy

public SingleListSelectionPolicy()
Method Detail

getSetSelectedIndices

public int[] getSetSelectedIndices(ListSelectModel<V> selectModel,
                                   int[] indices)
Determines which requested indices may be set as the selection. This implementation only allows the first index to be set.

Specified by:
getSetSelectedIndices in interface ListSelectionPolicy<V>
Overrides:
getSetSelectedIndices in class AbstractListSelectionPolicy<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.

Specified by:
getAddSelectedIndices in interface ListSelectionPolicy<V>
Overrides:
getAddSelectedIndices in class AbstractListSelectionPolicy<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.


Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.