|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectca.odell.glazedlists.swt.EventTableViewer<E>
public class EventTableViewer<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.
Field Summary | |
---|---|
protected EventList<E> |
source
the actual EventList to which this EventTableViewer is listening |
protected TransformedList<E,E> |
swtThreadSource
the proxy that moves events to the SWT user interface thread |
Constructor Summary | |
---|---|
EventTableViewer(EventList<E> source,
Table table,
String[] propertyNames,
String[] columnLabels)
Deprecated. use a combination of GlazedLists.tableFormat(String[], String[]) and
EventTableViewer(EventList, Table, TableFormat)
instead |
|
EventTableViewer(EventList<E> source,
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 . |
|
EventTableViewer(EventList<E> source,
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 . |
Method Summary | |
---|---|
protected TransformedList<E,E> |
createSwtThreadProxyList(EventList<E> source,
Display display)
This method exists as a hook for subclasses that may have custom threading needs within their EventTableViewers. |
void |
dispose()
Releases the resources consumed by this EventTableViewer 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 EventTableViewer . |
Table |
getTable()
Gets the Table that is being managed by this
EventTableViewer . |
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<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 |
---|
protected TransformedList<E,E> swtThreadSource
protected EventList<E> source
Constructor Detail |
---|
public EventTableViewer(EventList<E> source, Table table, String[] propertyNames, String[] columnLabels)
GlazedLists.tableFormat(String[], String[])
and
EventTableViewer(EventList, Table, TableFormat)
instead
Table
that updates the table
contents in response to changes on the specified EventList
. The
Table
is formatted with an automatically generated
TableFormat
. It uses JavaBeans and Reflection to create a
TableFormat
as specified.
source
- the EventList that provides the row objectstable
- the Table viewing the source objectspropertyNames
- an array of property names in the JavaBeans format.
For example, if your list contains Objects with the methods
getFirstName(), setFirstName(String), getAge(), setAge(Integer),
then this array should contain the two strings "firstName" and
"age". This format is specified by the JavaBeans
PropertyDescriptor
.columnLabels
- the corresponding column names for the listed
property names. For example, if your columns are "firstName" and
"age", then your labels might be "First Name" and "Age".public EventTableViewer(EventList<E> source, Table table, TableFormat<? super E> tableFormat)
Table
that updates the table
contents in response to changes on the specified EventList
. The
Table
is formatted with the specified TableFormat
.
source
- the EventList that provides the row objectstable
- the Table viewing the source objectstableFormat
- the object responsible for extracting column data
from the row objectspublic EventTableViewer(EventList<E> source, Table table, TableFormat<? super E> tableFormat, TableItemConfigurer<? super E> tableItemConfigurer)
Table
that updates the table
contents in response to changes on the specified EventList
. The
Table
is formatted with the specified TableFormat
.
source
- the EventList that provides the row objectstable
- the Table viewing the source objectstableFormat
- the object responsible for extracting column data
from the row objectstableItemConfigurer
- responsible for configuring table itemsMethod Detail |
---|
protected TransformedList<E,E> createSwtThreadProxyList(EventList<E> source, Display display)
source
in a SWTThreadProxyList if it
is not already a SWTThreadProxyList. Subclasses may replace this logic
and return either a custom ThreadProxyEventList of their choosing, or
return null
or the source
unchanged in order
to indicate that NO ThreadProxyEventList is desired.
In these cases it is expected that some external mechanism will ensure
that threading is handled correctly.
source
- the EventList that provides the row objects
null
or the
source
unchanged to indicate that NO
Thread-proxying is desiredpublic TableFormat<? super E> getTableFormat()
TableFormat
.
public void setTableFormat(TableFormat<E> tableFormat)
Table
to be formatted by a different
TableFormat
. This method is not yet implemented for SWT.
public TableItemConfigurer<? super E> getTableItemConfigurer()
TableItemConfigurer
.
public void setTableItemConfigurer(TableItemConfigurer<? super E> tableItemConfigurer)
TableItemConfigurer
. The cell values of existing,
non-virtual table items will be reconfigured with the specified configurer.
public Table getTable()
Table
that is being managed by this
EventTableViewer
.
public void setCheckedOnly(boolean checkedOnly)
public boolean getCheckedOnly()
public List<E> getAllChecked()
public EventList<E> getSourceList()
EventTableViewer
.
public EventList<E> getDeselected()
EventList
that contains items from the
viewed Table
that are not currently selected.
public EventList<E> getTogglingDeselected()
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
public EventList<E> getSelected()
EventList
that contains items from the
viewed Table
that are currently selected.
public EventList<E> getTogglingSelected()
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.
public void listChanged(ListEvent listChanges)
Table
.
listChanged
in interface ListEventListener<E>
public void invertSelection()
public void dispose()
EventTableViewer
so that it
may eventually be garbage collected.
An EventTableViewer
will be garbage collected without a call to
dispose()
, but not before its source EventList
is garbage
collected. By calling dispose()
, you allow the EventTableViewer
to be garbage collected before its source EventList
. This is
necessary for situations where an EventTableViewer
is short-lived but
its source EventList
is long-lived.
Warning: It is an error
to call any method on a EventTableViewer
after it has been disposed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |