Package docking.widgets.table.sort
Class RowBasedColumnComparator<T>
- java.lang.Object
-
- docking.widgets.table.sort.RowBasedColumnComparator<T>
-
- Type Parameters:
T
- the row type
- All Implemented Interfaces:
java.util.Comparator<T>
- Direct Known Subclasses:
ThreadedTableColumnComparator
public class RowBasedColumnComparator<T> extends java.lang.Object implements java.util.Comparator<T>
A comparator for a specific column that will take in a T row object, extract the value for the given column and then call the give comparator
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Comparator<java.lang.Object>
backupRowComparator
protected java.util.Comparator<java.lang.Object>
columnComparator
protected RowObjectTableModel<T>
model
protected int
sortColumn
-
Constructor Summary
Constructors Constructor Description RowBasedColumnComparator(RowObjectTableModel<T> model, int sortColumn, java.util.Comparator<java.lang.Object> comparator)
Constructs this class with the given column comparator that will get called after the given row is converted to the column value for the given sort columnRowBasedColumnComparator(RowObjectTableModel<T> model, int sortColumn, java.util.Comparator<java.lang.Object> comparator, java.util.Comparator<java.lang.Object> backupRowComparator)
This version of the constructor is used for the default case where the client will supply a backup row comparator that will get called if the given column comparator returns a '0' value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(T t1, T t2)
protected java.lang.Object
getColumnValue(T t)
-
-
-
Field Detail
-
model
protected RowObjectTableModel<T> model
-
sortColumn
protected int sortColumn
-
columnComparator
protected java.util.Comparator<java.lang.Object> columnComparator
-
backupRowComparator
protected java.util.Comparator<java.lang.Object> backupRowComparator
-
-
Constructor Detail
-
RowBasedColumnComparator
public RowBasedColumnComparator(RowObjectTableModel<T> model, int sortColumn, java.util.Comparator<java.lang.Object> comparator)
Constructs this class with the given column comparator that will get called after the given row is converted to the column value for the given sort column- Parameters:
model
- the table model using this comparatorsortColumn
- the column being sortedcomparator
- the column comparator to use for sorting
-
RowBasedColumnComparator
public RowBasedColumnComparator(RowObjectTableModel<T> model, int sortColumn, java.util.Comparator<java.lang.Object> comparator, java.util.Comparator<java.lang.Object> backupRowComparator)
This version of the constructor is used for the default case where the client will supply a backup row comparator that will get called if the given column comparator returns a '0' value.- Parameters:
model
- the table model using this comparatorsortColumn
- the column being sortedcomparator
- the column comparator to use for sortingbackupRowComparator
- the backup row comparator
-
-