|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.table.AbstractTableModel
ca.odell.glazedlists.swing.EventTableModel<E>
public class EventTableModel<E>
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).
SwingUtilities.invokeAndWait(Runnable),
Bug 112,
Bug 146,
Bug 177,
Serialized Form| Field Summary |
|---|
| Fields inherited from class javax.swing.table.AbstractTableModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
EventTableModel(EventList<E> source,
String[] propertyNames,
String[] columnLabels,
boolean[] writable)
Creates a new table that renders the specified list with an automatically generated TableFormat. |
|
EventTableModel(EventList<E> source,
TableFormat<E> tableFormat)
Creates a new table that renders the specified list in the specified format. |
|
| Method Summary | |
|---|---|
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<E> |
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<E> listChanges)
For implementing the ListEventListener interface. |
void |
setTableFormat(TableFormat<E> 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. |
| Methods inherited from class javax.swing.table.AbstractTableModel |
|---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public EventTableModel(EventList<E> source,
TableFormat<E> tableFormat)
public EventTableModel(EventList<E> source,
String[] propertyNames,
String[] columnLabels,
boolean[] writable)
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 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.| Method Detail |
|---|
public TableFormat<E> getTableFormat()
public void setTableFormat(TableFormat<E> tableFormat)
public E getElementAt(int index)
This may be used by renderers to paint the cells of a row differently based on the entire value for that row.
getValueAt(int,int)public void listChanged(ListEvent<E> listChanges)
GlazedListsSwing.swingThreadProxyList(ca.odell.glazedlists.EventList) , all natural calls to
this method are guaranteed to occur on the Swing EDT.
listChanged in interface ListEventListener<E>public String getColumnName(int column)
getColumnName in interface TableModelgetColumnName in class AbstractTableModelpublic int getRowCount()
getRowCount in interface TableModelpublic int getColumnCount()
getColumnCount in interface TableModelpublic Class getColumnClass(int columnIndex)
AdvancedTableFormat interface.
getColumnClass in interface TableModelgetColumnClass in class AbstractTableModel
public Object getValueAt(int row,
int column)
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.
getValueAt in interface TableModel
public boolean isCellEditable(int row,
int column)
isCellEditable in interface TableModelisCellEditable in class AbstractTableModel
public void setValueAt(Object editedValue,
int row,
int column)
setValueAt in interface TableModelsetValueAt in class AbstractTableModelpublic void dispose()
EventTableModel so that it
may eventually be garbage collected.
An EventTableModel will be garbage collected without a call to
dispose(), but not before its source EventList is garbage
collected. By calling dispose(), you allow the EventTableModel
to be garbage collected before its source EventList. This is
necessary for situations where an EventTableModel is short-lived but
its source EventList is long-lived.
Warning: It is an error
to call any method on a EventTableModel after it has been disposed.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||