com.mindtree.techworks.insight.model
Class ModelDataSorter
java.lang.Object
com.mindtree.techworks.insight.model.ModelDataSorter
- All Implemented Interfaces:
- java.util.Comparator
public class ModelDataSorter
- extends java.lang.Object
- implements java.util.Comparator
The ModelDataSorter
class implements sorting of data held by the
TableModel that it refers to. Provides methods to invoke sorting by specifying
the column index and the data list. Maintains map of sorted columns and their sorting
order such that consecutive calls to sort on a column flips the sorting order.
- Version:
- 1.0, 04/11/03
- Author:
- Regunath B
- See Also:
LoggingEvent
Method Summary |
int |
compare(java.lang.Object arg0,
java.lang.Object arg1)
Comparator interface method implementation |
int |
getSortOrder(int columnIndex)
Returns the sort order for the column specified by the columnIndex |
void |
resetSortParams()
Resets the parameters that define the sorting of this ModelDataSorter |
void |
sortData(int columnIndex,
java.util.List data)
Sorts the specified column data in the specified list. |
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 |
ASCENDING
public static final int ASCENDING
- See Also:
- Constant Field Values
DESCENDING
public static final int DESCENDING
- See Also:
- Constant Field Values
NOTSORTED
public static final int NOTSORTED
- See Also:
- Constant Field Values
ModelDataSorter
public ModelDataSorter()
sortData
public void sortData(int columnIndex,
java.util.List data)
- Sorts the specified column data in the specified list. Toggles the sort
order if the column had been sorted previously.
Does nothing if this sorter is already sorting data
- Parameters:
columnIndex
- index of the column whose data needs to be sorteddata
- List containing data to be sorted
getSortOrder
public int getSortOrder(int columnIndex)
- Returns the sort order for the column specified by the columnIndex
- Parameters:
columnIndex
- the index of the column whose sort order is needed
- Returns:
- the valid sort order as defined by this class
compare
public int compare(java.lang.Object arg0,
java.lang.Object arg1)
- Comparator interface method implementation
- Specified by:
compare
in interface java.util.Comparator
- See Also:
Comparator.compare(java.lang.Object, java.lang.Object)
resetSortParams
public void resetSortParams()
- Resets the parameters that define the sorting of this ModelDataSorter
Copyright © 2003-2008 MindTree Consulting Ltd.. All Rights Reserved.