|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.kupzog.ktable.KTableSortComparator
public abstract class KTableSortComparator
Implementations of this class are used when sorting a tablemodel.
KTableSortedModel
Field Summary | |
---|---|
static int |
SORT_DOWN
|
static int |
SORT_NONE
|
static int |
SORT_UP
|
Constructor Summary | |
---|---|
KTableSortComparator(KTableSortedModel model,
int columnIndex,
int direction)
Creates a new comparator on the given KTableSortedModel. |
Method Summary | |
---|---|
int |
compare(java.lang.Object o1,
java.lang.Object o2)
Compares two cells. |
abstract int |
doCompare(java.lang.Object o1,
java.lang.Object o2,
int row1,
int row2)
Implement this method to do the actual compare between the two cell contents. |
int |
getColumnToSortOn()
|
KTableSortedModel |
getModel()
|
int |
getSortDirection()
|
void |
setColumnToCompare(int column)
Sets the column index this comparator operates on. |
void |
setModel(KTableSortedModel model)
Sets the tablemodel to work on. |
void |
setSortDirection(int direction)
Sets the sorting direction. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
equals |
Field Detail |
---|
public static final int SORT_NONE
public static final int SORT_UP
public static final int SORT_DOWN
Constructor Detail |
---|
public KTableSortComparator(KTableSortedModel model, int columnIndex, int direction)
model
- The mode to compare on.Method Detail |
---|
public final int compare(java.lang.Object o1, java.lang.Object o2)
The given objects are of type Integer and represent the row numbers to use.
compare
in interface java.util.Comparator
java.lang.ClassCastException
- if the arguments' types prevent them from
being compared by this Comparator.Comparator.compare(java.lang.Object, java.lang.Object)
public abstract int doCompare(java.lang.Object o1, java.lang.Object o2, int row1, int row2)
o1
- The cell content of the first cello2
- The cell content of the second cellrow1
- The row index where o1 was found in the model.row2
- The row index where o2 was found in the model.
public void setColumnToCompare(int column)
column
- the column index to use.public int getSortDirection()
public void setSortDirection(int direction)
direction
- The sort direction, either
SORT_NONE, SORT_UP or SORT_DOWN.public int getColumnToSortOn()
public KTableSortedModel getModel()
public void setModel(KTableSortedModel model)
model
- The
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |