gr.zeus.ui.table.sort
Class TableSorter

java.lang.Object
  extended by gr.zeus.ui.table.sort.TableSorter

public final class TableSorter
extends java.lang.Object

JTable sorter. Original code from: http://www.senun.com/Left/Programming/Java_old/Examples_swing/SwingExamples.html

Since:
1.02
Author:
Gregory Kotsaftis

Constructor Summary
TableSorter(SortableTableModel model)
          Constructor.
 
Method Summary
 int compare(java.lang.Boolean o1, java.lang.Boolean o2)
          Compares two boolean values.
 int compare(java.util.Date o1, java.util.Date o2)
          Compares two dates.
 int compare(int column, int row1, int row2)
          Comparaters.
 int compare(java.lang.Number o1, java.lang.Number o2)
          Compares two numbers for higher or lower values.
 void sort(int column, boolean isAscent)
          n2 selection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableSorter

public TableSorter(SortableTableModel model)
Constructor.

Parameters:
model - Instance of SortableTableModel.
Method Detail

sort

public void sort(int column,
                 boolean isAscent)
n2 selection.

Parameters:
column - The column to sort.
isAscent - Check if ascending.

compare

public int compare(int column,
                   int row1,
                   int row2)
Comparaters.

Parameters:
column - The column number.
row1 - The first row number to compare.
row2 - The second row number to compare.

Returns:
Higher or lower number by comparison.

compare

public int compare(java.lang.Number o1,
                   java.lang.Number o2)
Compares two numbers for higher or lower values.

Parameters:
o1 - The first Number.
o2 - The second Number.

Returns:
0, 1 or -1 depending on the result.

compare

public int compare(java.util.Date o1,
                   java.util.Date o2)
Compares two dates.

Parameters:
o1 - The first Date.
o2 - The second Date.

Returns:
0, 1 or -1 depending on the result.

compare

public int compare(java.lang.Boolean o1,
                   java.lang.Boolean o2)
Compares two boolean values.

Parameters:
o1 - The first Boolean.
o2 - The second Boolean.

Returns:
0, 1 or -1 depending on the result.