com.guigarage.jgrid.ui
Class ListSelectionUtilities

java.lang.Object
  extended by com.guigarage.jgrid.ui.ListSelectionUtilities

public class ListSelectionUtilities
extends Object


Method Summary
static boolean isBetweenOrEqualsLeadAndAncestor(ListSelectionModel selectionModel, int index)
          Returns true is the index is between the leadIndex and the ancestorIndex.
static boolean isOnSameSideFromAncestorAsLead(ListSelectionModel selectionModel, int index)
          Returns true is both the index and the leadIndex of the selectionModel are smaller or bigger than the ancestorIndex.
static void refreshAnchorAndLead(ListSelectionModel selectionModel, int maxIndex)
          Updates the anchor and lead of the given SelectionModel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

refreshAnchorAndLead

public static void refreshAnchorAndLead(ListSelectionModel selectionModel,
                                        int maxIndex)
Updates the anchor and lead of the given SelectionModel. The complete selection of the model will bordered by anchor and lead. Examples: If your list selection looks like "---L**A**---" (- not selected / A anchor / L lead / * selected) the method will transform the selection to "---L****A---" If your list selection looks like "---A**L**---" the method will transform the selection to "---A****L---" If your list selection looks like "--A**--L**--" the method will transform the selection to "--A**--**L--" If your list selection looks like "*-**L--*A*-*" the method will transform the selection to "L-***--***-A"

Parameters:
selectionModel - the SelectionModel being updated
maxIndex - the max index of the data model

isOnSameSideFromAncestorAsLead

public static boolean isOnSameSideFromAncestorAsLead(ListSelectionModel selectionModel,
                                                     int index)
Returns true is both the index and the leadIndex of the selectionModel are smaller or bigger than the ancestorIndex.

Parameters:
index - the index of interest
Returns:
true if index and leadIndex are on the same side

isBetweenOrEqualsLeadAndAncestor

public static boolean isBetweenOrEqualsLeadAndAncestor(ListSelectionModel selectionModel,
                                                       int index)
Returns true is the index is between the leadIndex and the ancestorIndex.

Parameters:
index - the index of interest
Returns:
true if index is between the leadIndex and the ancestorIndex


Copyright © 2012. All Rights Reserved.