public class ColumnComparator extends java.lang.Object implements java.util.Comparator
SimpleTableColumn introduces the concept of "column value" and allows one to extract that "column value" from the row using the getColumnValue() method. In practice comparisons are also typically done between these values rather than the full row objects.
This comparator extracts the column values from the rows passed and uses the provided comparator to compare the values. It therefore allows a comparator designed for comparing column values to be quickly wrapped and used as a comparator comparing rows, which is what ITableColumn is expected to return.
Example:
objColumn.setComparator(new ColumnComparator(objColumn, objBeanComparator));
Constructor and Description |
---|
ColumnComparator(SimpleTableColumn objColumn,
java.util.Comparator objComparator) |
Modifier and Type | Method and Description |
---|---|
int |
compare(java.lang.Object objRow1,
java.lang.Object objRow2) |
public ColumnComparator(SimpleTableColumn objColumn, java.util.Comparator objComparator)
public int compare(java.lang.Object objRow1, java.lang.Object objRow2)
compare
in interface java.util.Comparator
Comparator.compare(Object, Object)