public class EventTableColumnModel<T extends TableColumn> extends Object implements TableColumnModel, PropertyChangeListener, ListSelectionListener, ListEventListener<T>
TableColumnModel
that holds an EventList
. Each element of
the list corresponds to a TableColumn
in the model.
The EventTableColumnModel 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)
.
Modifier and Type | Field and Description |
---|---|
protected TransformedList<T,T> |
swingThreadSource
the proxy moves events to the Swing Event Dispatch thread
|
Constructor and Description |
---|
EventTableColumnModel(EventList<T> source)
Creates a new model that contains the
TableColumn objects from
the given source . |
Modifier and Type | Method and Description |
---|---|
void |
addColumn(TableColumn column) |
void |
addColumnModelListener(TableColumnModelListener listener) |
protected ListSelectionModel |
createSelectionModel()
Creates a new default list selection model.
|
void |
dispose()
Releases the resources consumed by this
EventTableColumnModel so that it
may eventually be garbage collected. |
protected void |
fireColumnAdded(TableColumnModelEvent e) |
protected void |
fireColumnMarginChanged() |
protected void |
fireColumnMoved(TableColumnModelEvent e) |
protected void |
fireColumnRemoved(TableColumnModelEvent e) |
protected void |
fireColumnSelectionChanged(ListSelectionEvent e) |
TableColumn |
getColumn(int columnIndex) |
int |
getColumnCount() |
int |
getColumnIndex(Object identifier) |
int |
getColumnIndexAtX(int x) |
int |
getColumnMargin() |
Enumeration<TableColumn> |
getColumns() |
boolean |
getColumnSelectionAllowed() |
int |
getSelectedColumnCount() |
int[] |
getSelectedColumns() |
ListSelectionModel |
getSelectionModel() |
int |
getTotalColumnWidth() |
void |
listChanged(ListEvent<T> listChanges)
When the underlying list changes, this notification allows the object to repaint itself or
update itself as necessary.
|
void |
moveColumn(int columnIndex,
int newIndex) |
void |
propertyChange(PropertyChangeEvent evt)
Watch for changes to the column width or preferred column width and
trigger a relayout of the table header when they change.
|
void |
removeColumn(TableColumn column) |
void |
removeColumnModelListener(TableColumnModelListener listener) |
void |
setColumnMargin(int newMargin) |
void |
setColumnSelectionAllowed(boolean flag) |
void |
setSelectionModel(ListSelectionModel newModel) |
void |
valueChanged(ListSelectionEvent e) |
protected TransformedList<T extends TableColumn,T extends TableColumn> swingThreadSource
public EventTableColumnModel(EventList<T> source)
TableColumn
objects from
the given source
. Changes to the source
are
reflected in this model.public void addColumn(TableColumn column)
addColumn
in interface TableColumnModel
public void removeColumn(TableColumn column)
removeColumn
in interface TableColumnModel
public void moveColumn(int columnIndex, int newIndex)
moveColumn
in interface TableColumnModel
public void setColumnMargin(int newMargin)
setColumnMargin
in interface TableColumnModel
public int getColumnMargin()
getColumnMargin
in interface TableColumnModel
public int getColumnCount()
getColumnCount
in interface TableColumnModel
public Enumeration<TableColumn> getColumns()
getColumns
in interface TableColumnModel
public int getColumnIndex(Object identifier)
getColumnIndex
in interface TableColumnModel
public TableColumn getColumn(int columnIndex)
getColumn
in interface TableColumnModel
public int getColumnIndexAtX(int x)
getColumnIndexAtX
in interface TableColumnModel
public int getTotalColumnWidth()
getTotalColumnWidth
in interface TableColumnModel
public void setColumnSelectionAllowed(boolean flag)
setColumnSelectionAllowed
in interface TableColumnModel
public boolean getColumnSelectionAllowed()
getColumnSelectionAllowed
in interface TableColumnModel
public int[] getSelectedColumns()
getSelectedColumns
in interface TableColumnModel
public int getSelectedColumnCount()
getSelectedColumnCount
in interface TableColumnModel
public void setSelectionModel(ListSelectionModel newModel)
setSelectionModel
in interface TableColumnModel
public ListSelectionModel getSelectionModel()
getSelectionModel
in interface TableColumnModel
public void addColumnModelListener(TableColumnModelListener listener)
addColumnModelListener
in interface TableColumnModel
public void removeColumnModelListener(TableColumnModelListener listener)
removeColumnModelListener
in interface TableColumnModel
public void propertyChange(PropertyChangeEvent evt)
propertyChange
in interface PropertyChangeListener
public void valueChanged(ListSelectionEvent e)
valueChanged
in interface ListSelectionListener
public void listChanged(ListEvent<T> listChanges)
ListEventListener
It is mandatory that the calling thread has obtained the write lock on the source list. This is because the calling thread will have written to the source list to cause this event. This condition guarantees that no writes can occur while the listener is handling this event. It is an error to write to the source list while processing an event.
listChanged
in interface ListEventListener<T extends TableColumn>
listChanges
- a ListEvent
describing the changes to the listpublic void dispose()
EventTableColumnModel
so that it
may eventually be garbage collected.
An EventTableColumnModel
will be garbage collected without a
call to dispose()
, but not before its source EventList
is garbage collected. By calling dispose()
, you allow the
EventTableColumnModel
to be garbage collected before its source
EventList
. This is necessary for situations where an
EventTableColumnModel
is short-lived but its source
EventList
is long-lived.
Warning: It is an error
to call any method on an EventTableColumnModel
after it has been
disposed.
protected ListSelectionModel createSelectionModel()
protected void fireColumnAdded(TableColumnModelEvent e)
protected void fireColumnRemoved(TableColumnModelEvent e)
protected void fireColumnMoved(TableColumnModelEvent e)
protected void fireColumnSelectionChanged(ListSelectionEvent e)
protected void fireColumnMarginChanged()
Copyright © 2024 levigo holding gmbh. All rights reserved.