org.kuali.rice.krad.uif.util
Class MultiColumnComparator

java.lang.Object
  extended by org.kuali.rice.krad.uif.util.MultiColumnComparator
All Implemented Interfaces:
Comparator<Integer>

public class MultiColumnComparator
extends Object
implements Comparator<Integer>

Comparator used for server side sorting of CollectionGroup data.

This may include DataFields, as well as Fields that don't map directly to elements in the model collection, such as LinkFields that may contain expressions.

NOTE: This class is not thread safe, and each instance is intended to be used only once.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Constructor Summary
MultiColumnComparator(List<Object> modelCollection, CollectionGroup collectionGroup, List<ColumnSort> columnSorts, View view)
          Constructs a MultiColumnComparator instance
 
Method Summary
 int compare(Integer index1, Integer index2)
          Compares the modelCollecton element at index1 to the element at index2 based on the provided ColumnSorts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

MultiColumnComparator

public MultiColumnComparator(List<Object> modelCollection,
                             CollectionGroup collectionGroup,
                             List<ColumnSort> columnSorts,
                             View view)
Constructs a MultiColumnComparator instance

Parameters:
modelCollection - the model collection that the CollectionGroup is associated with
collectionGroup - the CollectionGroup whose columns are being sorted
columnSorts - A list from highest to lowest precedence of the column sorts to apply
view - The view
Method Detail

compare

public int compare(Integer index1,
                   Integer index2)
Compares the modelCollecton element at index1 to the element at index2 based on the provided ColumnSorts.

Specified by:
compare in interface Comparator<Integer>
Parameters:
index1 - the index of the first modelCollection element used for comparison
index2 - the index of the second modelCollection element used for comparison
Returns:
0 if the two elements are considered equal, a positive integer if the element at index1 is considered greater, else a negative integer


Copyright © 2005-2013 The Kuali Foundation. All Rights Reserved.