com.guiseframework.model
Class AbstractListSelectionPolicy<V>

java.lang.Object
  extended by com.guiseframework.model.AbstractListSelectionPolicy<V>
Type Parameters:
V - The type of values contained in the select model.
All Implemented Interfaces:
ListSelectionPolicy<V>
Direct Known Subclasses:
MultipleListSelectionPolicy, SingleListSelectionPolicy

public abstract class AbstractListSelectionPolicy<V>
extends java.lang.Object
implements ListSelectionPolicy<V>

An abstract implementation of a list selection strategy for a list select model. 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
AbstractListSelectionPolicy()
           
 
Method Summary
 int[] getAddSelectedIndices(ListSelectModel<V> selectModel, int[] indices)
          Determines which requested indices may be added to the selection.
 int[] getRemoveSelectedIndices(ListSelectModel<V> selectModel, int[] indices)
          Determines which requested indices may be removed from the selection.
 int[] getSetSelectedIndices(ListSelectModel<V> selectModel, int[] indices)
          Determines which requested indices may be set as the selection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractListSelectionPolicy

public AbstractListSelectionPolicy()
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.

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

getRemoveSelectedIndices

public int[] getRemoveSelectedIndices(ListSelectModel<V> selectModel,
                                      int[] indices)
Determines which requested indices may be removed from the selection. This implementation allows the removal of all requested indices.

Specified by:
getRemoveSelectedIndices in interface ListSelectionPolicy<V>
Parameters:
selectModel - The model containing the values to be removed.
indices - The requested indices to remove to the selection.
Returns:
The indices that can be removed from the selection.


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