org.eclipse.nebula.widgets.nattable.extension.glazedlists
Class GlazedListsSortModel<T>

java.lang.Object
  extended by org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsSortModel<T>
All Implemented Interfaces:
ILayerListener, ISortModel

public class GlazedListsSortModel<T>
extends Object
implements ISortModel, ILayerListener


Field Summary
protected  IColumnAccessor<T> columnAccessor
           
protected  ILayer columnHeaderDataLayer
           
protected  IColumnPropertyResolver columnPropertyResolver
           
protected  IConfigRegistry configRegistry
           
protected  ca.odell.glazedlists.SortedList<T> sortedList
           
 
Constructor Summary
GlazedListsSortModel(ca.odell.glazedlists.SortedList<T> sortedList, IColumnAccessor<T> columnAccessor, IColumnPropertyResolver columnPropertyResolver, IConfigRegistry configRegistry, ILayer dataLayer)
           
GlazedListsSortModel(ca.odell.glazedlists.SortedList<T> sortedList, IColumnPropertyAccessor<T> columnPropertyAccessor, IConfigRegistry configRegistry, ILayer dataLayer)
           
 
Method Summary
 void clear()
          Remove all sorting
 Comparator<?> getColumnComparator(int columnIndex)
           
protected  NatTableComparatorChooser<T> getComparatorChooser()
           
 List<Comparator> getComparatorsForColumnIndex(int columnIndex)
           
 SortDirectionEnum getSortDirection(int columnIndex)
           
 List<Integer> getSortedColumnIndexes()
           
 int getSortOrder(int columnIndex)
           
 void handleLayerEvent(ILayerEvent event)
          Handle an event notification from an ILayer
 boolean isColumnIndexSorted(int columnIndex)
           
 void sort(int columnIndex, SortDirectionEnum sortDirection, boolean accumulate)
          This method is called by the SortCommandHandler in response to a sort command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sortedList

protected final ca.odell.glazedlists.SortedList<T> sortedList

columnAccessor

protected final IColumnAccessor<T> columnAccessor

columnPropertyResolver

protected final IColumnPropertyResolver columnPropertyResolver

configRegistry

protected final IConfigRegistry configRegistry

columnHeaderDataLayer

protected final ILayer columnHeaderDataLayer
Constructor Detail

GlazedListsSortModel

public GlazedListsSortModel(ca.odell.glazedlists.SortedList<T> sortedList,
                            IColumnPropertyAccessor<T> columnPropertyAccessor,
                            IConfigRegistry configRegistry,
                            ILayer dataLayer)

GlazedListsSortModel

public GlazedListsSortModel(ca.odell.glazedlists.SortedList<T> sortedList,
                            IColumnAccessor<T> columnAccessor,
                            IColumnPropertyResolver columnPropertyResolver,
                            IConfigRegistry configRegistry,
                            ILayer dataLayer)
Method Detail

getComparatorChooser

protected NatTableComparatorChooser<T> getComparatorChooser()

getSortedColumnIndexes

public List<Integer> getSortedColumnIndexes()
Specified by:
getSortedColumnIndexes in interface ISortModel
Returns:
List of column indexes that are sorted.

getSortOrder

public int getSortOrder(int columnIndex)
Specified by:
getSortOrder in interface ISortModel
Returns:
when multiple columns are sorted, this returns the order of the column index in the sort

Example: If column indexes 3, 6, 9 are sorted (in that order) the sort order for index 6 is 1.


getSortDirection

public SortDirectionEnum getSortDirection(int columnIndex)
Specified by:
getSortDirection in interface ISortModel
Returns:
the direction in which the column with the given index is currently sorted

isColumnIndexSorted

public boolean isColumnIndexSorted(int columnIndex)
Specified by:
isColumnIndexSorted in interface ISortModel
Returns:
TRUE if the column with the given index is sorted at the moment.

getComparatorsForColumnIndex

public List<Comparator> getComparatorsForColumnIndex(int columnIndex)
Specified by:
getComparatorsForColumnIndex in interface ISortModel
Parameters:
columnIndex - The index of the column for which the row objects should be sorted.
Returns:
The collection of Comparators used to sort row objects by column values.

getColumnComparator

public Comparator<?> getColumnComparator(int columnIndex)
Specified by:
getColumnComparator in interface ISortModel
Parameters:
columnIndex - The index of the column for which the Comparator is requested.
Returns:
The Comparator that is used for sorting the values of a specified column. Needed in case of data model wrapping, e.g. GroupBy

sort

public void sort(int columnIndex,
                 SortDirectionEnum sortDirection,
                 boolean accumulate)
Description copied from interface: ISortModel
This method is called by the SortCommandHandler in response to a sort command. It is responsible for sorting the requested column.

Specified by:
sort in interface ISortModel
accumulate - flag indicating if the column should added to a previous sort.

clear

public void clear()
Description copied from interface: ISortModel
Remove all sorting

Specified by:
clear in interface ISortModel

handleLayerEvent

public void handleLayerEvent(ILayerEvent event)
Description copied from interface: ILayerListener
Handle an event notification from an ILayer

Specified by:
handleLayerEvent in interface ILayerListener
Parameters:
event - the event


Copyright © 2015. All rights reserved.