org.cafesip.gwtcomp.client.utils
Class NumericComparator

java.lang.Object
  extended by org.cafesip.gwtcomp.client.utils.NumericComparator
All Implemented Interfaces:
Comparator<Widget[]>

public class NumericComparator
extends Object
implements Comparator<Widget[]>

A convenience class for the SuperTableProperty. The SuperTable supports sorting of columns but you have to provide the comparator. This is a ready-made comparator class that you can use to compare columns that are of the type GWT Label or HTML and needs a numeric (int and float) comparison.

Author:
Amit Chatterjee

Constructor Summary
NumericComparator(int col, boolean ascending)
          A constructor for this class.
 
Method Summary
 int compare(Widget[] o1, Widget[] o2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

NumericComparator

public NumericComparator(int col,
                         boolean ascending)
A constructor for this class.

Parameters:
col - Specifies the column index in the table (whether it is column 0, 1 , 2 etc.)
ascending - true if ascending comparator, false if this is a descending comparator.
Method Detail

compare

public int compare(Widget[] o1,
                   Widget[] o2)
Specified by:
compare in interface Comparator<Widget[]>


Copyright © 2010 Cafesip.org. All Rights Reserved.