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

java.lang.Object
  extended by ca.odell.glazedlists.swt.DefaultEventTableViewer<E>
All Implemented Interfaces:
ListEventListener<E>, EventListener
Direct Known Subclasses:
EventTableViewer

public class DefaultEventTableViewer<E>
extends Object
implements ListEventListener<E>

A view helper that displays an EventList in an SWT table.

This class is not thread safe. It must be used exclusively with the SWT event handler thread.

Author:
Jesse Wilson, Holger Brands

Field Summary
protected  EventList<E> source
          the actual EventList to which this EventTableViewer is listening
 
Constructor Summary
  DefaultEventTableViewer(EventList<E> source, org.eclipse.swt.widgets.Table table, TableFormat<? super E> tableFormat)
          Creates a new viewer for the given Table that updates the table contents in response to changes on the specified EventList.
  DefaultEventTableViewer(EventList<E> source, org.eclipse.swt.widgets.Table table, TableFormat<? super E> tableFormat, TableItemConfigurer<? super E> tableItemConfigurer)
          Creates a new viewer for the given Table that updates the table contents in response to changes on the specified EventList.
protected DefaultEventTableViewer(EventList<E> source, org.eclipse.swt.widgets.Table table, TableFormat<? super E> tableFormat, TableItemConfigurer<? super E> tableItemConfigurer, boolean disposeSource)
          Creates a new viewer for the given Table that updates the table contents in response to changes on the specified EventList.
 
Method Summary
 void dispose()
          Releases the resources consumed by this DefaultEventTableViewer so that it may eventually be garbage collected.
 List<E> getAllChecked()
          Gets all checked items.
 boolean getCheckedOnly()
          Get whether this is showing only checked elements.
 EventList<E> getDeselected()
          Provides access to an EventList that contains items from the viewed Table that are not currently selected.
 EventList<E> getSelected()
          Provides access to an EventList that contains items from the viewed Table that are currently selected.
 EventList<E> getSourceList()
          Get the source of this DefaultEventTableViewer.
 org.eclipse.swt.widgets.Table getTable()
          Gets the Table that is being managed by this DefaultEventTableViewer.
 TableFormat<? super E> getTableFormat()
          Gets the TableFormat.
 TableItemConfigurer<? super E> getTableItemConfigurer()
          Gets the TableItemConfigurer.
 EventList<E> getTogglingDeselected()
          Gets an EventList that contains only deselected values and modifies the selection state on mutation.
 EventList<E> getTogglingSelected()
          Gets an EventList that contains only selected values and modifies the selection state on mutation.
 void invertSelection()
          Inverts the current selection.
 void listChanged(ListEvent listChanges)
          When the source list is changed, this forwards the change to the displayed Table.
 void setCheckedOnly(boolean checkedOnly)
          Set whether this shall show only checked elements.
 void setTableFormat(TableFormat<? super E> tableFormat)
          Sets this Table to be formatted by a different TableFormat.
 void setTableItemConfigurer(TableItemConfigurer<? super E> tableItemConfigurer)
          Sets a new TableItemConfigurer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

protected EventList<E> source
the actual EventList to which this EventTableViewer is listening

Constructor Detail

DefaultEventTableViewer

public DefaultEventTableViewer(EventList<E> source,
                               org.eclipse.swt.widgets.Table table,
                               TableFormat<? super E> tableFormat)
Creates a new viewer for the given Table that updates the table contents in response to changes on the specified EventList. The Table is formatted with the specified TableFormat.

Parameters:
source - the EventList that provides the row objects
table - the Table viewing the source objects
tableFormat - the object responsible for extracting column data from the row objects

DefaultEventTableViewer

public DefaultEventTableViewer(EventList<E> source,
                               org.eclipse.swt.widgets.Table table,
                               TableFormat<? super E> tableFormat,
                               TableItemConfigurer<? super E> tableItemConfigurer)
Creates a new viewer for the given Table that updates the table contents in response to changes on the specified EventList. The Table is formatted with the specified TableFormat.

Parameters:
source - the EventList that provides the row objects
table - the Table viewing the source objects
tableFormat - the object responsible for extracting column data from the row objects
tableItemConfigurer - responsible for configuring table items

DefaultEventTableViewer

protected DefaultEventTableViewer(EventList<E> source,
                                  org.eclipse.swt.widgets.Table table,
                                  TableFormat<? super E> tableFormat,
                                  TableItemConfigurer<? super E> tableItemConfigurer,
                                  boolean disposeSource)
Creates a new viewer for the given Table that updates the table contents in response to changes on the specified EventList. The Table is formatted with the specified TableFormat.

Parameters:
source - the EventList that provides the row objects
table - the Table viewing the source objects
tableFormat - the object responsible for extracting column data from the row objects
tableItemConfigurer - responsible for configuring table items
diposeSource - true if the source list should be disposed when disposing this model, false otherwise
Method Detail

getTableFormat

public TableFormat<? super E> getTableFormat()
Gets the TableFormat.


setTableFormat

public void setTableFormat(TableFormat<? super E> tableFormat)
Sets this Table to be formatted by a different TableFormat.

Parameters:
tableFormat - the new TableFormat
Throws:
IllegalArgumentException - if tableFormat is null

getTableItemConfigurer

public TableItemConfigurer<? super E> getTableItemConfigurer()
Gets the TableItemConfigurer.


setTableItemConfigurer

public void setTableItemConfigurer(TableItemConfigurer<? super E> tableItemConfigurer)
Sets a new TableItemConfigurer. The cell values of existing, non-virtual table items will be reconfigured with the specified configurer.


getTable

public org.eclipse.swt.widgets.Table getTable()
Gets the Table that is being managed by this DefaultEventTableViewer.


setCheckedOnly

public void setCheckedOnly(boolean checkedOnly)
Set whether this shall show only checked elements.


getCheckedOnly

public boolean getCheckedOnly()
Get whether this is showing only checked elements.


getAllChecked

public List<E> getAllChecked()
Gets all checked items.


getSourceList

public EventList<E> getSourceList()
Get the source of this DefaultEventTableViewer.


getDeselected

public EventList<E> getDeselected()
Provides access to an EventList that contains items from the viewed Table that are not currently selected.


getTogglingDeselected

public EventList<E> getTogglingDeselected()
Gets an EventList that contains only deselected values and modifies the selection state on mutation. Adding an item to this list deselects it and removing an item selects it. If an item not in the source list is added an IllegalArgumentException is thrown


getSelected

public EventList<E> getSelected()
Provides access to an EventList that contains items from the viewed Table that are currently selected.


getTogglingSelected

public EventList<E> getTogglingSelected()
Gets an EventList that contains only selected values and modifies the selection state on mutation. Adding an item to this list selects it and removing an item deselects it. If an item not in the source list is added an IllegalArgumentException is thrown.


listChanged

public void listChanged(ListEvent listChanges)
When the source list is changed, this forwards the change to the displayed Table.

Specified by:
listChanged in interface ListEventListener<E>
Parameters:
listChanges - a ListEvent describing the changes to the list

invertSelection

public void invertSelection()
Inverts the current selection.


dispose

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

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

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



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