ca.odell.glazedlists.swing
Class EventTableColumnModel<T extends javax.swing.table.TableColumn>

java.lang.Object
  extended by ca.odell.glazedlists.swing.EventTableColumnModel<T>
All Implemented Interfaces:
ListEventListener<T>, java.beans.PropertyChangeListener, java.util.EventListener, javax.swing.event.ListSelectionListener, javax.swing.table.TableColumnModel

public class EventTableColumnModel<T extends javax.swing.table.TableColumn>
extends java.lang.Object
implements javax.swing.table.TableColumnModel, java.beans.PropertyChangeListener, javax.swing.event.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(javax.swing.table.TableColumn column)
           
 void addColumnModelListener(javax.swing.event.TableColumnModelListener listener)
           
protected  javax.swing.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(javax.swing.event.TableColumnModelEvent e)
           
protected  void fireColumnMarginChanged()
           
protected  void fireColumnMoved(javax.swing.event.TableColumnModelEvent e)
           
protected  void fireColumnRemoved(javax.swing.event.TableColumnModelEvent e)
           
protected  void fireColumnSelectionChanged(javax.swing.event.ListSelectionEvent e)
           
 javax.swing.table.TableColumn getColumn(int columnIndex)
           
 int getColumnCount()
           
 int getColumnIndex(java.lang.Object identifier)
           
 int getColumnIndexAtX(int x)
           
 int getColumnMargin()
           
 java.util.Enumeration<javax.swing.table.TableColumn> getColumns()
           
 boolean getColumnSelectionAllowed()
           
 int getSelectedColumnCount()
           
 int[] getSelectedColumns()
           
 javax.swing.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(java.beans.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(javax.swing.table.TableColumn column)
           
 void removeColumnModelListener(javax.swing.event.TableColumnModelListener listener)
           
 void setColumnMargin(int newMargin)
           
 void setColumnSelectionAllowed(boolean flag)
           
 void setSelectionModel(javax.swing.ListSelectionModel newModel)
           
 void valueChanged(javax.swing.event.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 javax.swing.table.TableColumn,T extends javax.swing.table.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(javax.swing.table.TableColumn column)
Specified by:
addColumn in interface javax.swing.table.TableColumnModel

removeColumn

public void removeColumn(javax.swing.table.TableColumn column)
Specified by:
removeColumn in interface javax.swing.table.TableColumnModel

moveColumn

public void moveColumn(int columnIndex,
                       int newIndex)
Specified by:
moveColumn in interface javax.swing.table.TableColumnModel

setColumnMargin

public void setColumnMargin(int newMargin)
Specified by:
setColumnMargin in interface javax.swing.table.TableColumnModel

getColumnMargin

public int getColumnMargin()
Specified by:
getColumnMargin in interface javax.swing.table.TableColumnModel

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface javax.swing.table.TableColumnModel

getColumns

public java.util.Enumeration<javax.swing.table.TableColumn> getColumns()
Specified by:
getColumns in interface javax.swing.table.TableColumnModel

getColumnIndex

public int getColumnIndex(java.lang.Object identifier)
Specified by:
getColumnIndex in interface javax.swing.table.TableColumnModel

getColumn

public javax.swing.table.TableColumn getColumn(int columnIndex)
Specified by:
getColumn in interface javax.swing.table.TableColumnModel

getColumnIndexAtX

public int getColumnIndexAtX(int x)
Specified by:
getColumnIndexAtX in interface javax.swing.table.TableColumnModel

getTotalColumnWidth

public int getTotalColumnWidth()
Specified by:
getTotalColumnWidth in interface javax.swing.table.TableColumnModel

setColumnSelectionAllowed

public void setColumnSelectionAllowed(boolean flag)
Specified by:
setColumnSelectionAllowed in interface javax.swing.table.TableColumnModel

getColumnSelectionAllowed

public boolean getColumnSelectionAllowed()
Specified by:
getColumnSelectionAllowed in interface javax.swing.table.TableColumnModel

getSelectedColumns

public int[] getSelectedColumns()
Specified by:
getSelectedColumns in interface javax.swing.table.TableColumnModel

getSelectedColumnCount

public int getSelectedColumnCount()
Specified by:
getSelectedColumnCount in interface javax.swing.table.TableColumnModel

setSelectionModel

public void setSelectionModel(javax.swing.ListSelectionModel newModel)
Specified by:
setSelectionModel in interface javax.swing.table.TableColumnModel

getSelectionModel

public javax.swing.ListSelectionModel getSelectionModel()
Specified by:
getSelectionModel in interface javax.swing.table.TableColumnModel

addColumnModelListener

public void addColumnModelListener(javax.swing.event.TableColumnModelListener listener)
Specified by:
addColumnModelListener in interface javax.swing.table.TableColumnModel

removeColumnModelListener

public void removeColumnModelListener(javax.swing.event.TableColumnModelListener listener)
Specified by:
removeColumnModelListener in interface javax.swing.table.TableColumnModel

propertyChange

public void propertyChange(java.beans.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 java.beans.PropertyChangeListener

valueChanged

public void valueChanged(javax.swing.event.ListSelectionEvent e)
Specified by:
valueChanged in interface javax.swing.event.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 javax.swing.table.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 javax.swing.ListSelectionModel createSelectionModel()
Creates a new default list selection model.


fireColumnAdded

protected void fireColumnAdded(javax.swing.event.TableColumnModelEvent e)

fireColumnRemoved

protected void fireColumnRemoved(javax.swing.event.TableColumnModelEvent e)

fireColumnMoved

protected void fireColumnMoved(javax.swing.event.TableColumnModelEvent e)

fireColumnSelectionChanged

protected void fireColumnSelectionChanged(javax.swing.event.ListSelectionEvent e)

fireColumnMarginChanged

protected void fireColumnMarginChanged()


Glazed Lists, Copyright © 2003 publicobject.com, O'Dell Engineering.
Documentation build by pbuilder at 2012-05-29 19:21