ca.odell.glazedlists.swt
Class TableComparatorChooser<E>

java.lang.Object
  extended by ca.odell.glazedlists.gui.AbstractTableComparatorChooser<E>
      extended by ca.odell.glazedlists.swt.TableComparatorChooser<E>

public final class TableComparatorChooser<E>
extends AbstractTableComparatorChooser<E>

A TableComparatorChooser is a tool that allows the user to sort a ListTable by clicking on the table's headers. It requires that the ListTable has a SortedList as a source as the sorting on that list is used.

Author:
Jesse Wilson
See Also:
Snippet 2

Field Summary
 
Fields inherited from class ca.odell.glazedlists.gui.AbstractTableComparatorChooser
MULTIPLE_COLUMN_KEYBOARD, MULTIPLE_COLUMN_MOUSE, MULTIPLE_COLUMN_MOUSE_WITH_UNDO, SINGLE_COLUMN, sortedList, sortedListComparator, sortingState
 
Constructor Summary
TableComparatorChooser(DefaultEventTableViewer<E> eventTableViewer, SortedList<E> sortedList, boolean multipleColumnSort)
          Deprecated. replaced with install(ca.odell.glazedlists.swt.DefaultEventTableViewer, ca.odell.glazedlists.SortedList, boolean), which is functionally identical but uses a more fitting name to convey the action that is performed.
 
Method Summary
 void addSortListener(org.eclipse.swt.widgets.Listener sortListener)
          Registers the specified Listener to receive notification whenever the Table is sorted by this TableComparatorChooser.
 void dispose()
          Releases the resources consumed by this TableComparatorChooser so that it may eventually be garbage collected.
static
<E> TableComparatorChooser<E>
install(DefaultEventTableViewer<E> eventTableViewer, SortedList<E> sortedList, boolean multipleColumnSort)
          Installs a new TableComparatorChooser that responds to clicks on the specified table and uses them to sort the specified list.
protected  void rebuildComparator()
          Updates the comparator in use and applies it to the table.
 void removeSortActionListener(org.eclipse.swt.widgets.Listener sortListener)
          Deregisters the specified Listener to no longer receive events.
protected  void updateTableSortColumn()
          Updates the SWT table to indicate sorting icon on the primary sort column.
 
Methods inherited from class ca.odell.glazedlists.gui.AbstractTableComparatorChooser
appendComparator, clearComparator, createComparatorForElement, createSortingState, fromString, getColumnComparatorIndex, getComparatorsForColumn, getSortingColumns, getSortingStyle, isColumnReverse, redetectComparator, setTableFormat, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TableComparatorChooser

public TableComparatorChooser(DefaultEventTableViewer<E> eventTableViewer,
                              SortedList<E> sortedList,
                              boolean multipleColumnSort)
Deprecated. replaced with install(ca.odell.glazedlists.swt.DefaultEventTableViewer, ca.odell.glazedlists.SortedList, boolean), which is functionally identical but uses a more fitting name to convey the action that is performed.

Creates and installs a TableComparatorChooser.

Method Detail

install

public static <E> TableComparatorChooser<E> install(DefaultEventTableViewer<E> eventTableViewer,
                                                    SortedList<E> sortedList,
                                                    boolean multipleColumnSort)
Installs a new TableComparatorChooser that responds to clicks on the specified table and uses them to sort the specified list.

Parameters:
eventTableViewer - the table viewer for the table to be sorted
sortedList - the sorted list to update.
multipleColumnSort - true to sort by multiple columns at a time, or false to sort by a single column. Although sorting by multiple columns is more powerful, the user interface is not as simple and this strategy should only be used where necessary.

addSortListener

public void addSortListener(org.eclipse.swt.widgets.Listener sortListener)
Registers the specified Listener to receive notification whenever the Table is sorted by this TableComparatorChooser.


removeSortActionListener

public void removeSortActionListener(org.eclipse.swt.widgets.Listener sortListener)
Deregisters the specified Listener to no longer receive events.


updateTableSortColumn

protected final void updateTableSortColumn()
Updates the SWT table to indicate sorting icon on the primary sort column.


rebuildComparator

protected final void rebuildComparator()
Updates the comparator in use and applies it to the table.

This method is called when the sorting state changed.

Overrides:
rebuildComparator in class AbstractTableComparatorChooser<E>

dispose

public void dispose()
Releases the resources consumed by this TableComparatorChooser so that it may eventually be garbage collected.

A TableComparatorChooser will be garbage collected without a call to dispose(), but not before its source EventList is garbage collected. By calling dispose(), you allow the TableComparatorChooser to be garbage collected before its source EventList. This is necessary for situations where an TableComparatorChooser is short-lived but its source EventList is long-lived.

Warning: It is an error to call any method on a TableComparatorChooser after it has been disposed.

Overrides:
dispose in class AbstractTableComparatorChooser<E>


Glazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by hbrands at 2013-02-12 20:58