org.displaytag.model
Class RowSorter

java.lang.Object
  extended by org.displaytag.model.RowSorter
All Implemented Interfaces:
java.util.Comparator

public class RowSorter
extends java.lang.Object
implements java.util.Comparator

Comparator for rows.

Version:
$Revision: 1139 $ ($Author: fgiust $)
Author:
Fabrizio Giustina

Constructor Summary
RowSorter(int sortedColumnIndex, java.lang.String beanProperty, TableDecorator tableDecorator, boolean ascendingOrder, java.util.Comparator compar)
          Initialize a new RowSorter.
 
Method Summary
 int compare(java.lang.Object object1, java.lang.Object object2)
          Compares two objects by first fetching a property from each object and then comparing that value.
 boolean equals(java.lang.Object object)
          Is this Comparator the same as another one?
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RowSorter

public RowSorter(int sortedColumnIndex,
                 java.lang.String beanProperty,
                 TableDecorator tableDecorator,
                 boolean ascendingOrder,
                 java.util.Comparator compar)
Initialize a new RowSorter.

Parameters:
sortedColumnIndex - index of the sorted column
beanProperty - name of the property. If pProperty is null column index is used to get a static cell value from the row object
tableDecorator - TableDecorator instance
ascendingOrder - boolean ascending order?
compar - the comparator to use
Method Detail

compare

public final int compare(java.lang.Object object1,
                         java.lang.Object object2)
Compares two objects by first fetching a property from each object and then comparing that value. If there are any errors produced while trying to compare these objects then a RunTimeException will be thrown as any error found here will most likely be a programming error that needs to be quickly addressed (like trying to compare objects that are not comparable, or trying to read a property from a bean that is invalid, etc...)

Specified by:
compare in interface java.util.Comparator
Parameters:
object1 - Object
object2 - Object
Returns:
int
See Also:
Comparator.compare(Object, Object)

equals

public final boolean equals(java.lang.Object object)
Is this Comparator the same as another one?

Specified by:
equals in interface java.util.Comparator
Overrides:
equals in class java.lang.Object
Parameters:
object - Object
Returns:
boolean
See Also:
Comparator.equals(Object)

hashCode

public final int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()


Copyright © 2002-2010 the Displaytag team. All Rights Reserved.