Package org.kuali.rice.krad.uif.util
Class MultiColumnComparator
java.lang.Object
org.kuali.rice.krad.uif.util.MultiColumnComparator
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionMultiColumnComparator(List<Object> modelCollection, CollectionGroup collectionGroup, List<ColumnSort> columnSorts, ViewModel form, View view) Constructs a MultiColumnComparator instance -
Method Summary
Modifier and TypeMethodDescriptionBuild a List of prototype Fields representing a row of the table.intCompares the modelCollecton element at index1 to the element at index2 based on the providedColumnSorts.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
MultiColumnComparator
public MultiColumnComparator(List<Object> modelCollection, CollectionGroup collectionGroup, List<ColumnSort> columnSorts, ViewModel form, View view) Constructs a MultiColumnComparator instance- Parameters:
modelCollection- the model collection that the CollectionGroup is associated withcollectionGroup- the CollectionGroup whose columns are being sortedcolumnSorts- A list from highest to lowest precedence of the column sorts to applyform- object containing the view's dataview- The view
-
-
Method Details
-
compare
Compares the modelCollecton element at index1 to the element at index2 based on the providedColumnSorts.- Specified by:
comparein interfaceComparator<Integer>- Parameters:
index1- the index of the first modelCollection element used for comparisonindex2- 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
-
buildPrototypeRow
Build a List of prototype Fields representing a row of the table.Any DataFields will have their binding paths shortened to access the model collection elements directly, instead of via the data object
- Returns:
- a List of prototype Fields representing a row in the table
-