Class EventTableModel<E>
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- ca.odell.glazedlists.swing.DefaultEventTableModel<E>
-
- ca.odell.glazedlists.swing.EventTableModel<E>
-
- All Implemented Interfaces:
ListEventListener<E>
,AdvancedTableModel<E>
,java.io.Serializable
,java.util.EventListener
,javax.swing.table.TableModel
public class EventTableModel<E> extends DefaultEventTableModel<E>
Deprecated.UseDefaultEventTableModel
instead. This class will be removed in the GL 2.0 release. The wrapping of the source list with an EDT safe list has been determined to be undesirable (it is better for the user to provide their own EDT safe list).ADefaultEventTableModel
that silently wraps it's source list in a SwingThreadProxyEventList to ensure that events that arrive at the TableModel do so on the EDT. ATableModel
that holds anEventList
. Each element of the list corresponds to a row in theTableModel
. The columns of the table are specified using aTableFormat
.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)
.- Author:
- Jesse Wilson
- See Also:
- Glazed Lists Tutorial,
SwingUtilities.invokeAndWait(Runnable)
, Bug 112, Bug 146, Bug 177, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected TransformedList<E,E>
swingThreadSource
Deprecated.the proxy moves events to the Swing Event Dispatch thread-
Fields inherited from class ca.odell.glazedlists.swing.DefaultEventTableModel
source
-
-
Constructor Summary
Constructors Constructor Description EventTableModel(EventList<E> source, TableFormat<? super E> tableFormat)
Deprecated.EventTableModel(EventList<E> source, java.lang.String[] propertyNames, java.lang.String[] columnLabels, boolean[] writable)
Deprecated.UseGlazedListsSwing#createEventTableModel(EventList, String[], String[], boolean[])
andGlazedListsSwing.swingThreadProxyList(EventList)
instead
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected TransformedList<E,E>
createSwingThreadProxyList(EventList<E> source)
Deprecated.This method exists as a hook for subclasses that may have custom threading needs within their EventTableModels.void
dispose()
Deprecated.Releases the resources consumed by thisEventTableModel
so that it may eventually be garbage collected.-
Methods inherited from class ca.odell.glazedlists.swing.DefaultEventTableModel
getColumnClass, getColumnCount, getColumnName, getElementAt, getMutableTableModelEvent, getRowCount, getTableFormat, getValueAt, handleListChange, isCellEditable, listChanged, setTableFormat, setValueAt
-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
-
-
-
Field Detail
-
swingThreadSource
protected TransformedList<E,E> swingThreadSource
Deprecated.the proxy moves events to the Swing Event Dispatch thread
-
-
Constructor Detail
-
EventTableModel
public EventTableModel(EventList<E> source, TableFormat<? super E> tableFormat)
Deprecated.Creates a new table model that extracts column data from the givensource
using the the giventableFormat
.- Parameters:
source
- the EventList that provides the row objectstableFormat
- the object responsible for extracting column data from the row objects
-
EventTableModel
public EventTableModel(EventList<E> source, java.lang.String[] propertyNames, java.lang.String[] columnLabels, boolean[] writable)
Deprecated.UseGlazedListsSwing#createEventTableModel(EventList, String[], String[], boolean[])
andGlazedListsSwing.swingThreadProxyList(EventList)
insteadCreates a new table that renders the specified list with an automatically generatedTableFormat
. It uses JavaBeans and reflection to create aTableFormat
as specified.Note that the classes which will be obfuscated may not work with reflection. In this case, implement a
TableFormat
manually.- Parameters:
source
- the EventList that provides the row 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 JavaBeansPropertyDescriptor
.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
-
createSwingThreadProxyList
protected TransformedList<E,E> createSwingThreadProxyList(EventList<E> source)
Deprecated.This method exists as a hook for subclasses that may have custom threading needs within their EventTableModels. By default, this method will wrap the givensource
in a SwingThreadProxyList if it is not already a SwingThreadProxyList. Subclasses may replace this logic and return either a custom ThreadProxyEventList of their choosing, or returnnull
or thesource
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.- Parameters:
source
- the EventList that provides the row objects- Returns:
- the source wrapped in some sort of ThreadProxyEventList if
Thread-proxying is desired, or either
null
or thesource
unchanged to indicate that NO Thread-proxying is desired
-
dispose
public void dispose()
Deprecated.Releases the resources consumed by thisEventTableModel
so that it may eventually be garbage collected.An
EventTableModel
will be garbage collected without a call todispose()
, but not before its sourceEventList
is garbage collected. By callingdispose()
, you allow theEventTableModel
to be garbage collected before its sourceEventList
. This is necessary for situations where anEventTableModel
is short-lived but its sourceEventList
is long-lived.Warning: It is an error to call any method on an
EventTableModel
after it has been disposed. As such, thisEventTableModel
should be detached from its corresponding Component before it is disposed.- Specified by:
dispose
in interfaceAdvancedTableModel<E>
- Overrides:
dispose
in classDefaultEventTableModel<E>
-
-