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

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

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

A view helper that displays an EventList in a List.

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

Author:
Kevin Maltby, Holger Brands

Field Summary
protected  EventList<E> source
          the proxy moves events to the SWT user interface thread
 
Constructor Summary
  DefaultEventListViewer(EventList<E> source, org.eclipse.swt.widgets.List list)
          Creates a new List that displays and responds to changes in the source list.
  DefaultEventListViewer(EventList<E> source, org.eclipse.swt.widgets.List list, ItemFormat<? super E> itemFormat)
          Creates a new List that displays and responds to changes in the source list.
protected DefaultEventListViewer(EventList<E> source, org.eclipse.swt.widgets.List list, ItemFormat<? super E> itemFormat, boolean disposeSource)
          Creates a new List that displays and responds to changes in the source list.
 
Method Summary
 void dispose()
          Releases the resources consumed by this DefaultEventListViewer so that it may eventually be garbage collected.
 EventList<E> getDeselected()
          Provides access to an EventList that contains items from the viewed Table that are not currently selected.
 ItemFormat<? super E> getItemFormat()
          Gets the List's ItemFormat.
 org.eclipse.swt.widgets.List getList()
          Gets the List being managed by this DefaultEventListViewer.
 EventList<E> getSelected()
          Provides access to an EventList that contains items from the viewed Table that are currently selected.
 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<E> listChanges)
          When the source list is changed, this forwards the change to the displayed List.
 
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 proxy moves events to the SWT user interface thread

Constructor Detail

DefaultEventListViewer

public DefaultEventListViewer(EventList<E> source,
                              org.eclipse.swt.widgets.List list)
Creates a new List that displays and responds to changes in the source list. List elements will simply be displayed as the result of calling toString() on the contents of the source list.

Parameters:
source - the EventList that provides the elements
list - the list

DefaultEventListViewer

public DefaultEventListViewer(EventList<E> source,
                              org.eclipse.swt.widgets.List list,
                              ItemFormat<? super E> itemFormat)
Creates a new List that displays and responds to changes in the source list. List elements are formatted using the provided ItemFormat.

Parameters:
source - the EventList that provides the elements
list - the list
itemFormat - an ItemFormat for formatting the displayed values
See Also:
ItemFormat, GlazedListsSWT.beanItemFormat(String)

DefaultEventListViewer

protected DefaultEventListViewer(EventList<E> source,
                                 org.eclipse.swt.widgets.List list,
                                 ItemFormat<? super E> itemFormat,
                                 boolean disposeSource)
Creates a new List that displays and responds to changes in the source list. List elements are formatted using the provided ItemFormat.

Parameters:
source - the EventList that provides the elements
list - the list
itemFormat - an optional ItemFormat for formatting the displayed values
diposeSource - true if the source list should be disposed when disposing this model, false otherwise
See Also:
ItemFormat, GlazedListsSWT.beanItemFormat(String)
Method Detail

getItemFormat

public ItemFormat<? super E> getItemFormat()
Gets the List's ItemFormat.


getList

public org.eclipse.swt.widgets.List getList()
Gets the List being managed by this DefaultEventListViewer.


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<E> listChanges)
When the source list is changed, this forwards the change to the displayed List.

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 DefaultEventListViewer so that it may eventually be garbage collected.

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

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



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