pl.edu.agh.cast.ui.util
Class AbstractColumnSorter

java.lang.Object
  extended by org.eclipse.jface.viewers.ViewerComparator
      extended by org.eclipse.jface.viewers.ViewerSorter
          extended by pl.edu.agh.cast.ui.util.AbstractColumnSorter
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
DataTableColumnSorter

public abstract class AbstractColumnSorter
extends org.eclipse.jface.viewers.ViewerSorter
implements Cloneable

Abstract column sorter. Class based on ColumnViewerSorter from Eclipse JFaceSnippets (http://wiki.eclipse.org/JFaceSnippets#Snippet040TableViewerSorting)

Author:
AGH CAST Team

Field Summary
static int ASC
          Constant indicating the ascending sort order.
protected  org.eclipse.swt.widgets.TableColumn column
          Column, by which the viewer is to be sorted.
protected  int columnNo
          Number of the column, by which the viewer is to be sorted..
static int DESC
          Constant indicating the descending sort order.
protected  int direction
          Direction of sort.
static int NONE
          Constant indicating that the data should NOT be sorted.
protected  org.eclipse.jface.viewers.ColumnViewer viewer
          Viewer to be sorted.
 
Fields inherited from class org.eclipse.jface.viewers.ViewerSorter
collator
 
Constructor Summary
AbstractColumnSorter()
          The default constructor.
AbstractColumnSorter(org.eclipse.jface.viewers.ColumnViewer view, org.eclipse.swt.widgets.TableColumn col, int colNo)
          Constructor.
AbstractColumnSorter(org.eclipse.jface.viewers.ColumnViewer view, org.eclipse.jface.viewers.TableViewerColumn colView, int colNo)
          Constructor.
 
Method Summary
 Object clone()
          
 int compare(org.eclipse.jface.viewers.Viewer view, Object e1, Object e2)
          
protected abstract  int doCompare(Object e1, Object e2)
           
 void doSort(AbstractColumnSorter sorter, int dir)
          Performs the sort action.
 void setColumnNo(int columnNo)
           
 void setSorterData(org.eclipse.jface.viewers.ColumnViewer view, org.eclipse.swt.widgets.TableColumn col, int colNo)
          Sets the sorter's data.
 
Methods inherited from class org.eclipse.jface.viewers.ViewerSorter
getCollator
 
Methods inherited from class org.eclipse.jface.viewers.ViewerComparator
category, getComparator, isSorterProperty, sort
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ASC

public static final int ASC
Constant indicating the ascending sort order.

See Also:
Constant Field Values

NONE

public static final int NONE
Constant indicating that the data should NOT be sorted.

See Also:
Constant Field Values

DESC

public static final int DESC
Constant indicating the descending sort order.

See Also:
Constant Field Values

direction

protected int direction
Direction of sort.


column

protected org.eclipse.swt.widgets.TableColumn column
Column, by which the viewer is to be sorted.


viewer

protected org.eclipse.jface.viewers.ColumnViewer viewer
Viewer to be sorted.


columnNo

protected int columnNo
Number of the column, by which the viewer is to be sorted..

Constructor Detail

AbstractColumnSorter

public AbstractColumnSorter()
The default constructor.


AbstractColumnSorter

public AbstractColumnSorter(org.eclipse.jface.viewers.ColumnViewer view,
                            org.eclipse.jface.viewers.TableViewerColumn colView,
                            int colNo)
Constructor.

Parameters:
view - viewer to be sorted
colView - sort viewer column
colNo - index of sort column

AbstractColumnSorter

public AbstractColumnSorter(org.eclipse.jface.viewers.ColumnViewer view,
                            org.eclipse.swt.widgets.TableColumn col,
                            int colNo)
Constructor.

Parameters:
view - viewer to be sorted
col - sort column
colNo - index of sort column
Method Detail

setSorterData

public void setSorterData(org.eclipse.jface.viewers.ColumnViewer view,
                          org.eclipse.swt.widgets.TableColumn col,
                          int colNo)
Sets the sorter's data.

Parameters:
view - viewer to be sorted
col - sort column
colNo - index of sort column

setColumnNo

public void setColumnNo(int columnNo)

doSort

public void doSort(AbstractColumnSorter sorter,
                   int dir)
Performs the sort action.

Parameters:
sorter - sorter that performs the sort
dir - sort direction

compare

public int compare(org.eclipse.jface.viewers.Viewer view,
                   Object e1,
                   Object e2)

Overrides:
compare in class org.eclipse.jface.viewers.ViewerComparator
See Also:
ViewerComparator.compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)

clone

public Object clone()

Overrides:
clone in class Object
See Also:
Object.clone()

doCompare

protected abstract int doCompare(Object e1,
                                 Object e2)


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.