com.pcauto.gui.table
Class ProxyColumnModel

java.lang.Object
  extended byjavax.swing.table.DefaultTableColumnModel
      extended bycom.pcauto.gui.table.ProxyColumnModel
All Implemented Interfaces:
java.util.EventListener, javax.swing.event.ListSelectionListener, java.beans.PropertyChangeListener, java.io.Serializable, javax.swing.table.TableColumnModel, javax.swing.event.TableColumnModelListener
Direct Known Subclasses:
RowHeaderColumnModel

public class ProxyColumnModel
extends javax.swing.table.DefaultTableColumnModel
implements javax.swing.table.TableColumnModel, javax.swing.event.TableColumnModelListener

The ProxyColumnModel contains all columns in the table that are both visible and not locked. A locked column is a column, which is displayed on the left side of the table even when the user scrolls the other columns. See EntityTable for more information.

Both the setModel method, and the constructor, take an EntityTableColumnModel as a parameter. The EntityTableColumnModel is used to retrieve the columns that are both visible and not locked. This EntityTableColumnModel will be referred to as the original model for the remainder of this document.

See Also:
Serialized Form

Field Summary
protected  EntityTableColumnModel origModel
          The EntityTableColumnModel reference given to this ProxyColumnModel through the constructor or the setModel method.
 
Fields inherited from class javax.swing.table.DefaultTableColumnModel
changeEvent, columnMargin, columnSelectionAllowed, listenerList, selectionModel, tableColumns, totalColumnWidth
 
Constructor Summary
ProxyColumnModel()
          Constructs a new ProxyColumnModel.
ProxyColumnModel(EntityTableColumnModel m)
          Constructs a new ProxyColumnModel with the given EntityTableColumnModel.
 
Method Summary
 void columnAdded(javax.swing.event.TableColumnModelEvent e)
          Fires the change event for adding a column.
 void columnMarginChanged(javax.swing.event.ChangeEvent e)
          Fires the column margin changed event.
 void columnMoved(javax.swing.event.TableColumnModelEvent e)
          Fires the column moved event on behalf of the original model.
 void columnRemoved(javax.swing.event.TableColumnModelEvent e)
          Fires the column removed event on behalf of the original model.
 void columnSelectionChanged(javax.swing.event.ListSelectionEvent e)
          Fires the column selection changed event on behalf of the original model.
 EntityTableColumnModel getModel()
          Returns the model being used for managing the columns of the table.
protected  int getRealColumnCount()
          Returns the number of visible columns.
 void revalidate()
          Sets the properties and listeners for the original model (EntityTableColumnModel).
 void setModel(EntityTableColumnModel m)
          Sets the model that will be used to manage the columns in the table.
 
Methods inherited from class javax.swing.table.DefaultTableColumnModel
addColumn, addColumnModelListener, createSelectionModel, fireColumnAdded, fireColumnMarginChanged, fireColumnMoved, fireColumnRemoved, fireColumnSelectionChanged, getColumn, getColumnCount, getColumnIndex, getColumnIndexAtX, getColumnMargin, getColumnModelListeners, getColumns, getColumnSelectionAllowed, getListeners, getSelectedColumnCount, getSelectedColumns, getSelectionModel, getTotalColumnWidth, moveColumn, propertyChange, recalcWidthCache, removeColumn, removeColumnModelListener, setColumnMargin, setColumnSelectionAllowed, setSelectionModel, valueChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.table.TableColumnModel
addColumn, addColumnModelListener, getColumn, getColumnCount, getColumnIndex, getColumnIndexAtX, getColumnMargin, getColumns, getColumnSelectionAllowed, getSelectedColumnCount, getSelectedColumns, getSelectionModel, getTotalColumnWidth, moveColumn, removeColumn, removeColumnModelListener, setColumnMargin, setColumnSelectionAllowed, setSelectionModel
 

Field Detail

origModel

protected EntityTableColumnModel origModel
The EntityTableColumnModel reference given to this ProxyColumnModel through the constructor or the setModel method. It is used to retrieve the columns that will be displayed in the main table body.

Constructor Detail

ProxyColumnModel

public ProxyColumnModel()
Constructs a new ProxyColumnModel.


ProxyColumnModel

public ProxyColumnModel(EntityTableColumnModel m)
Constructs a new ProxyColumnModel with the given EntityTableColumnModel. The EntityTableColumnModel is used to specify all the columns and their attributes that will make up the table.

Parameters:
m - the EntityTableColumnModel that defines the table columns
Method Detail

getModel

public EntityTableColumnModel getModel()
Returns the model being used for managing the columns of the table. The EntityTableColumnModel is used to specify all the columns and their attributes that will make up the table.

Returns:
the EntityTableColumnModel that specifies the columns of the table

setModel

public void setModel(EntityTableColumnModel m)
Sets the model that will be used to manage the columns in the table. The EntityTableColumnModel is used to specify all the columns and their attributes that will make up the table.

Parameters:
m - the EntityTableColumnModel which stores the columns in the table

revalidate

public void revalidate()
Sets the properties and listeners for the original model (EntityTableColumnModel). One possible reason to call this method would be to reassign the columns to this ProxyColumnModel if some of the columns in the original model had their hidden or locked properties changed.


getRealColumnCount

protected int getRealColumnCount()
Returns the number of visible columns.

Returns:
int number of visible columns.

columnAdded

public void columnAdded(javax.swing.event.TableColumnModelEvent e)
Fires the change event for adding a column. This method is called whenever a column is added so that listeners can update accordingly.

Specified by:
columnAdded in interface javax.swing.event.TableColumnModelListener
Parameters:
e - the TableColumnModelEvent generated.

columnMarginChanged

public void columnMarginChanged(javax.swing.event.ChangeEvent e)
Fires the column margin changed event. This method is called whenever a column margin changes so that listeners can update accordingly. This method must be called whenever the column width changes so that that Table can update it's column sizes appropriately. If this method is not called then when the user changes the column size by moving the mouse onto the dividing line between column titles and attempts to resize the column, the column will not resize.

Specified by:
columnMarginChanged in interface javax.swing.event.TableColumnModelListener
Parameters:
e - the ChangeEvent generated.

columnMoved

public void columnMoved(javax.swing.event.TableColumnModelEvent e)
Fires the column moved event on behalf of the original model. This method is called whenever a column is moved so that listeners can update accordingly.

Specified by:
columnMoved in interface javax.swing.event.TableColumnModelListener
Parameters:
e - the TableColumnModeEvent generated.

columnRemoved

public void columnRemoved(javax.swing.event.TableColumnModelEvent e)
Fires the column removed event on behalf of the original model. This method is called whenever a column is removed so that listeners can update accordingly.

Specified by:
columnRemoved in interface javax.swing.event.TableColumnModelListener
Parameters:
e - the TableColumnModeEvent generated.

columnSelectionChanged

public void columnSelectionChanged(javax.swing.event.ListSelectionEvent e)
Fires the column selection changed event on behalf of the original model. This method is called whenever the column selection changes so that listeners can update accordingly.

Specified by:
columnSelectionChanged in interface javax.swing.event.TableColumnModelListener
Parameters:
e - the ListSelectionEvent generated.