com.levigo.util.swing.glazedlists
Class EventTableColumnModel<T extends TableColumn>

java.lang.Object
  extended by com.levigo.util.swing.glazedlists.EventTableColumnModel<T>
All Implemented Interfaces:
ListEventListener<T>, PropertyChangeListener, EventListener, ListSelectionListener, TableColumnModel

public class EventTableColumnModel<T extends TableColumn>
extends Object
implements TableColumnModel, PropertyChangeListener, ListSelectionListener, ListEventListener<T>

A 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).

Author:
James Lemieux

Field Summary
protected  TransformedList<T,T> swingThreadSource
          the proxy moves events to the Swing Event Dispatch thread
 
Constructor Summary
EventTableColumnModel(EventList<T> source)
          Creates a new model that contains the TableColumn objects from the given source.
 
Method Summary
 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

swingThreadSource

protected TransformedList<T extends TableColumn,T extends TableColumn> swingThreadSource
the proxy moves events to the Swing Event Dispatch thread

Constructor Detail

EventTableColumnModel

public EventTableColumnModel(EventList<T> source)
Creates a new model that contains the TableColumn objects from the given source. Changes to the source are reflected in this model.

Method Detail

addColumn

public void addColumn(TableColumn column)

Specified by:
addColumn in interface TableColumnModel

removeColumn

public void removeColumn(TableColumn column)

Specified by:
removeColumn in interface TableColumnModel

moveColumn

public void moveColumn(int columnIndex,
                       int newIndex)

Specified by:
moveColumn in interface TableColumnModel

setColumnMargin

public void setColumnMargin(int newMargin)

Specified by:
setColumnMargin in interface TableColumnModel

getColumnMargin

public int getColumnMargin()

Specified by:
getColumnMargin in interface TableColumnModel

getColumnCount

public int getColumnCount()

Specified by:
getColumnCount in interface TableColumnModel

getColumns

public Enumeration<TableColumn> getColumns()

Specified by:
getColumns in interface TableColumnModel

getColumnIndex

public int getColumnIndex(Object identifier)

Specified by:
getColumnIndex in interface TableColumnModel

getColumn

public TableColumn getColumn(int columnIndex)

Specified by:
getColumn in interface TableColumnModel

getColumnIndexAtX

public int getColumnIndexAtX(int x)

Specified by:
getColumnIndexAtX in interface TableColumnModel

getTotalColumnWidth

public int getTotalColumnWidth()

Specified by:
getTotalColumnWidth in interface TableColumnModel

setColumnSelectionAllowed

public void setColumnSelectionAllowed(boolean flag)

Specified by:
setColumnSelectionAllowed in interface TableColumnModel

getColumnSelectionAllowed

public boolean getColumnSelectionAllowed()

Specified by:
getColumnSelectionAllowed in interface TableColumnModel

getSelectedColumns

public int[] getSelectedColumns()

Specified by:
getSelectedColumns in interface TableColumnModel

getSelectedColumnCount

public int getSelectedColumnCount()

Specified by:
getSelectedColumnCount in interface TableColumnModel

setSelectionModel

public void setSelectionModel(ListSelectionModel newModel)

Specified by:
setSelectionModel in interface TableColumnModel

getSelectionModel

public ListSelectionModel getSelectionModel()

Specified by:
getSelectionModel in interface TableColumnModel

addColumnModelListener

public void addColumnModelListener(TableColumnModelListener listener)

Specified by:
addColumnModelListener in interface TableColumnModel

removeColumnModelListener

public void removeColumnModelListener(TableColumnModelListener listener)

Specified by:
removeColumnModelListener in interface TableColumnModel

propertyChange

public 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.

Specified by:
propertyChange in interface PropertyChangeListener

valueChanged

public void valueChanged(ListSelectionEvent e)
Specified by:
valueChanged in interface ListSelectionListener

listChanged

public void listChanged(ListEvent<T> listChanges)
Description copied from interface: ListEventListener
When the underlying list changes, this notification allows the object to repaint itself or update itself as necessary.

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.

Specified by:
listChanged in interface ListEventListener<T extends TableColumn>

dispose

public void dispose()
Releases the resources consumed by this 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.


createSelectionModel

protected ListSelectionModel createSelectionModel()
Creates a new default list selection model.


fireColumnAdded

protected void fireColumnAdded(TableColumnModelEvent e)

fireColumnRemoved

protected void fireColumnRemoved(TableColumnModelEvent e)

fireColumnMoved

protected void fireColumnMoved(TableColumnModelEvent e)

fireColumnSelectionChanged

protected void fireColumnSelectionChanged(ListSelectionEvent e)

fireColumnMarginChanged

protected void fireColumnMarginChanged()


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.