|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dsto.dfc.swt.viewers.TableColumnSorter
public class TableColumnSorter
Adds click-column-to-sort behaviour to a table viewer. Clicking a column sorts it if a sorter is defined. Clicking again inverts sort order. Clicking a third time clears sort.
Example use:
TableColumnSorter columnSorter = new TableColumnSorter (tableView); TableColumn column = new TableColumn (tableView.getTable (), SWT.LEFT); column.setText ("Name"); column.setWidth (40); columnSorter.addColumn (column, "name", new DataObjectViewerSorter ("name")); column = new TableColumn (tableView.getTable (), SWT.RIGHT); column.setText ("Age"); column.setWidth (20); columnSorter.addColumn (column, "age", new DataObjectViewerSorter ("age")); ... columnSorter.setSortColumn ("name"); tableView.setColumnProperties (columnSorter.getColumnProperties ());
Field Summary | |
---|---|
static int |
ASCENDING
|
static int |
DESCENDING
|
static int |
UNSORTED
|
Constructor Summary | |
---|---|
TableColumnSorter(org.eclipse.jface.viewers.TableViewer viewer)
|
|
TableColumnSorter(org.eclipse.jface.viewers.TableViewer viewer,
boolean allowUnsorted)
Instantiate a TableColumnSorter, specifying whether the sort column may be 'UNSORTED'. |
Method Summary | |
---|---|
org.eclipse.swt.widgets.TableColumn |
addColumn(String property,
String title,
int columns)
Shortcut to add a left-aligned column with a set property, title and suggested column width. |
org.eclipse.swt.widgets.TableColumn |
addColumn(String property,
String title,
int columns,
int style)
Shortcut to add a column with a set property, title and suggested column width. |
org.eclipse.swt.widgets.TableColumn |
addColumn(String property,
String title,
org.eclipse.jface.viewers.ViewerSorter sorter,
int columns,
int style)
Shortcut to add a column with a set property, title, sorter and suggested column width. |
void |
addColumn(org.eclipse.swt.widgets.TableColumn column,
String property)
Add a column with no sorter. |
void |
addColumn(org.eclipse.swt.widgets.TableColumn column,
String property,
org.eclipse.jface.viewers.ViewerSorter sorter)
Add a column. |
String[] |
getColumnProperties()
Shortcut to get the array of properties associated with the columns using addColumn(TableColumn, String, ViewerSorter) . |
void |
handleEvent(org.eclipse.swt.widgets.Event e)
|
void |
setSortColumn(String property)
Set the currently sorted column to be the one displaying a given property. |
void |
setSortColumn(String property,
int newOrdering)
Set the currently sorted column to be the one displaying a given property. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int UNSORTED
public static final int ASCENDING
public static final int DESCENDING
Constructor Detail |
---|
public TableColumnSorter(org.eclipse.jface.viewers.TableViewer viewer)
public TableColumnSorter(org.eclipse.jface.viewers.TableViewer viewer, boolean allowUnsorted)
UNSORTED
viewer
- allowUnsorted
- Specify whether the sort column can be 'UNSORTED'. Note if passed
in as false, it is equivalent to calling TableColumnSorter(TableViewer)
Method Detail |
---|
public String[] getColumnProperties()
addColumn(TableColumn, String, ViewerSorter)
. This can
be passed into
ColumnViewer.setColumnProperties(java.lang.String[])
.
public void addColumn(org.eclipse.swt.widgets.TableColumn column, String property)
column
- The column.property
- The property associated with the column.public void addColumn(org.eclipse.swt.widgets.TableColumn column, String property, org.eclipse.jface.viewers.ViewerSorter sorter)
column
- The column.property
- The property associated with the column.sorter
- The sorter for the column. May be null.public org.eclipse.swt.widgets.TableColumn addColumn(String property, String title, int columns)
property
- The property the column is displaying.title
- The title of the column.columns
- The suggested column width in characters.
addColumn(String, String, ViewerSorter, int, int)
public org.eclipse.swt.widgets.TableColumn addColumn(String property, String title, int columns, int style)
property
- The property the column is displaying.title
- The title of the column.columns
- The suggested column width in characters.style
- The column style (SWT.LEFT, SWT.RIGHT, SWT.CENTER).
addColumn(String, String, ViewerSorter, int, int)
public org.eclipse.swt.widgets.TableColumn addColumn(String property, String title, org.eclipse.jface.viewers.ViewerSorter sorter, int columns, int style)
property
- The property the column is displaying.title
- The title of the column.sorter
- The sorter for the column (may be null).columns
- The suggested column width in characters.style
- The column style (SWT.LEFT, SWT.RIGHT, SWT.CENTER).
public void setSortColumn(String property)
setSortColumn(String, int)
public void setSortColumn(String property, int newOrdering)
property
- The property for the sorted column.newOrdering
- The new sort order: UNSORTED, ASCENDING, DESCENDING.public void handleEvent(org.eclipse.swt.widgets.Event e)
handleEvent
in interface org.eclipse.swt.widgets.Listener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |