ca.odell.glazedlists.swing
Class EventTableModel<E>
AbstractTableModel
ca.odell.glazedlists.swing.EventTableModel<E>
- EventListener, ListEventListener<E>
public class EventTableModel<E>
extends AbstractTableModel
A
TableModel
that holds an
EventList
. Each element of the list
corresponds to a row in the
TableModel
. The columns of the table must
be specified using a
TableFormat
.
The EventTableModel class is
not thread-safe. Unless otherwise
noted, all methods are only safe to be called from the event dispatch thread.
To do this programmatically, use
SwingUtilities.invokeAndWait(Runnable)
.
protected TransformedList | swingThreadSource - the proxy moves events to the Swing Event Dispatch thread
|
EventTableModel(EventList source, String[] propertyNames, String[] columnLabels, boolean[] writable) - Creates a new table that renders the specified list with an automatically
generated
TableFormat .
|
EventTableModel(EventList source, TableFormat tableFormat) - Creates a new table that renders the specified list in the specified
format.
|
void | dispose() - Releases the resources consumed by this
EventTableModel so that it
may eventually be garbage collected.
|
Class | getColumnClass(int columnIndex) - Gets the class of elements in the specified column.
|
int | getColumnCount() - Get the column count as specified by the table format.
|
String | getColumnName(int column) - Fetch the name for the specified column.
|
E | getElementAt(int index) - Retrieves the value at the specified location from the table.
|
int | getRowCount() - The number of rows equals the number of entries in the source event list.
|
TableFormat | getTableFormat() - Gets the Table Format.
|
Object | getValueAt(int row, int column) - Retrieves the value at the specified location from the table.
|
boolean | isCellEditable(int row, int column) - The list table is not editable.
|
void | listChanged(ListEvent listChanges) - For implementing the ListEventListener interface.
|
void | setTableFormat(TableFormat tableFormat) - Sets this table to be rendered by a different table format.
|
void | setValueAt(Object editedValue, int row, int column) - The list table is not editable.
|
swingThreadSource
protected TransformedList swingThreadSource
the proxy moves events to the Swing Event Dispatch thread
EventTableModel
public EventTableModel(EventList source,
String[] propertyNames,
String[] columnLabels,
boolean[] writable)
Creates a new table that renders the specified list with an automatically
generated
TableFormat
. It uses JavaBeans and reflection to create
a
TableFormat
as specified.
Note that the classes which will be obfuscated may not work with
reflection. In this case, implement a
TableFormat
manually.
propertyNames
- 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 java.beans.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".writable
- an array of booleans specifying which of the columns in
your table are writable.
EventTableModel
public EventTableModel(EventList source,
TableFormat tableFormat)
Creates a new table that renders the specified list in the specified
format.
dispose
public void dispose()
getColumnClass
public Class getColumnClass(int columnIndex)
Gets the class of elements in the specified column. This behaviour can be
customized by implementing the
AdvancedTableFormat
interface.
getColumnCount
public int getColumnCount()
Get the column count as specified by the table format.
getColumnName
public String getColumnName(int column)
Fetch the name for the specified column.
getElementAt
public E getElementAt(int index)
Retrieves the value at the specified location from the table.
This may be used by renderers to paint the cells of a row differently
based on the entire value for that row.
getRowCount
public int getRowCount()
The number of rows equals the number of entries in the source event list.
getTableFormat
public TableFormat getTableFormat()
Gets the Table Format.
getValueAt
public Object getValueAt(int row,
int column)
Retrieves the value at the specified location from the table.
Before every get, we need to validate the row because there may be an
update waiting in the event queue. For example, it is possible that
the source list has been updated by a database thread. Such a change
may have been sent as notification, but after this request in the
event queue. In the case where a row is no longer available, null is
returned. The value returned is insignificant in this case because the
Event queue will very shortly be repainting (or removing) the row
anyway.
isCellEditable
public boolean isCellEditable(int row,
int column)
The list table is not editable. For an editable list table, use the
WritableListTable instead.
listChanged
public void listChanged(ListEvent listChanges)
For implementing the ListEventListener interface. This sends changes
to the table which repaint the table cells. Because this class is backed
by GlazedListsSwing
, all natural calls to
this method are guaranteed to occur on the Swing EDT.
- listChanged in interface ListEventListener<E>
setTableFormat
public void setTableFormat(TableFormat tableFormat)
Sets this table to be rendered by a different table format. This has
some very important consequences. The selection will be lost - this is
due to the fact that the table formats may have different numbers of
columns, and JTable has no event to specify columns changing without
rows.
setValueAt
public void setValueAt(Object editedValue,
int row,
int column)
The list table is not editable. For an editable list table, use the
WritableListTable instead.
Glazed Lists, Copyright © 2003-2006 publicobject.com, O'Dell Engineering.
Documentation build by buildd at 2008-01-04 14:38