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

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

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

A view helper that displays an EventList in a Combo component.

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 EventList to respond to
 
Constructor Summary
  DefaultEventComboViewer(EventList<E> source, org.eclipse.swt.widgets.Combo combo)
          Binds the contents of a Combo component to an EventList source.
  DefaultEventComboViewer(EventList<E> source, org.eclipse.swt.widgets.Combo combo, ItemFormat<? super E> itemFormat)
          Binds the contents of a Combo component to an EventList source.
protected DefaultEventComboViewer(EventList<E> source, org.eclipse.swt.widgets.Combo combo, ItemFormat<? super E> itemFormat, boolean disposeSource)
          Binds the contents of a Combo component to an EventList source.
 
Method Summary
 void dispose()
          Releases the resources consumed by this DefaultEventComboViewer so that it may eventually be garbage collected.
 org.eclipse.swt.widgets.Combo getCombo()
          Gets the Combo being managed by this DefaulEventComboViewer.
 ItemFormat<? super E> getItemFormat()
          Gets the Combo's ItemFormat.
 void listChanged(ListEvent<E> listChanges)
          When the source combo is changed, this forwards the change to the displayed combo.
 
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 EventList to respond to

Constructor Detail

DefaultEventComboViewer

public DefaultEventComboViewer(EventList<E> source,
                               org.eclipse.swt.widgets.Combo combo)
Binds the contents of a Combo component to an EventList source. This allows the selection choices in a Combo to change dynamically to reflect chances to the source EventList. The String values displayed in the Combo component will be the result of calling toString() on the Objects found in source.

Parameters:
source - the EventList that provides the elements
combo - the combo box

DefaultEventComboViewer

public DefaultEventComboViewer(EventList<E> source,
                               org.eclipse.swt.widgets.Combo combo,
                               ItemFormat<? super E> itemFormat)
Binds the contents of a Combo component to an EventList source. This allows the selection choices in a Combo to change dynamically to reflect chances to the source EventList. The String values displayed in the Combo component will be formatted using the provided ItemFormat.

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

DefaultEventComboViewer

protected DefaultEventComboViewer(EventList<E> source,
                                  org.eclipse.swt.widgets.Combo combo,
                                  ItemFormat<? super E> itemFormat,
                                  boolean disposeSource)
Binds the contents of a Combo component to an EventList source. This allows the selection choices in a Combo to change dynamically to reflect chances to the source EventList. The String values displayed in the Combo component will be formatted using the provided ItemFormat.

Parameters:
source - the EventList that provides the elements
combo - the combo box
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

getCombo

public org.eclipse.swt.widgets.Combo getCombo()
Gets the Combo being managed by this DefaulEventComboViewer.


getItemFormat

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


listChanged

public void listChanged(ListEvent<E> listChanges)
When the source combo is changed, this forwards the change to the displayed combo.

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

dispose

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

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

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



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