swingx
Version 2005-08-19

org.jdesktop.swingx.table
Class DefaultTableColumnModelExt

java.lang.Object
  extended by javax.swing.table.DefaultTableColumnModel
      extended by org.jdesktop.swingx.table.DefaultTableColumnModelExt
All Implemented Interfaces:
PropertyChangeListener, Serializable, EventListener, ListSelectionListener, TableColumnModel, TableColumnModelExt

public class DefaultTableColumnModelExt
extends DefaultTableColumnModel
implements TableColumnModelExt

A default implementation supporting invisible columns. Note (JW): hot fixed issues #156, #157. To really do it need enhanced TableColumnModelEvent and -Listeners that are aware of the event.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.DefaultTableColumnModel
changeEvent, columnMargin, columnSelectionAllowed, listenerList, selectionModel, tableColumns, totalColumnWidth
 
Constructor Summary
DefaultTableColumnModelExt()
          Creates a new instance of DefaultTableColumnModelExt
 
Method Summary
 void addColumn(TableColumn aColumn)
           
 int getColumnCount(boolean includeHidden)
          returns the number of contained columns including invisible if the parameter is true.
 TableColumnExt getColumnExt(Object identifier)
          returns the first TableColumnExt with the given identifier or null if none is found.
 List getColumns(boolean includeHidden)
          Returns all of the columns in the TableColumnModel, including invisible ones if the parameter is true.
 Set getInvisibleColumns()
          Returns a list containing all of the columns that are invisible.
 boolean isAddedFromInvisibleEvent(int newIndex)
          hot fix for #157: listeners that are aware of the possible existence of invisible columns should check if the received columnAdded originated from moving a column from invisible to visible.
 boolean isRemovedToInvisibleEvent(int oldIndex)
          hot fix for #157: listeners that are aware of the possible existence of invisible columns should check if the received columnRemoved originated from moving a column from visible to invisible.
protected  void moveToInvisible(TableColumnExt col)
           
protected  void moveToVisible(TableColumnExt col)
           
 void removeColumn(TableColumn column)
           
 
Methods inherited from class javax.swing.table.DefaultTableColumnModel
addColumnModelListener, createSelectionModel, fireColumnAdded, fireColumnMarginChanged, fireColumnMoved, fireColumnRemoved, fireColumnSelectionChanged, getColumn, getColumnCount, getColumnIndex, getColumnIndexAtX, getColumnMargin, getColumnModelListeners, getColumns, getColumnSelectionAllowed, getListeners, getSelectedColumnCount, getSelectedColumns, getSelectionModel, getTotalColumnWidth, moveColumn, propertyChange, recalcWidthCache, 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
addColumnModelListener, getColumn, getColumnCount, getColumnIndex, getColumnIndexAtX, getColumnMargin, getColumns, getColumnSelectionAllowed, getSelectedColumnCount, getSelectedColumns, getSelectionModel, getTotalColumnWidth, moveColumn, removeColumnModelListener, setColumnMargin, setColumnSelectionAllowed, setSelectionModel
 

Constructor Detail

DefaultTableColumnModelExt

public DefaultTableColumnModelExt()
Creates a new instance of DefaultTableColumnModelExt

Method Detail

getColumns

public List getColumns(boolean includeHidden)
Description copied from interface: TableColumnModelExt
Returns all of the columns in the TableColumnModel, including invisible ones if the parameter is true.

Specified by:
getColumns in interface TableColumnModelExt
Parameters:
includeHidden - if true the returned list contains all columns otherwise only the subset of visible columns.

getColumnCount

public int getColumnCount(boolean includeHidden)
Description copied from interface: TableColumnModelExt
returns the number of contained columns including invisible if the parameter is true.

Specified by:
getColumnCount in interface TableColumnModelExt
Returns:
the number of contained columns including the invisible ones if specified

getColumnExt

public TableColumnExt getColumnExt(Object identifier)
returns the first TableColumnExt with the given identifier or null if none is found. The returned column may be visible or hidden.

Specified by:
getColumnExt in interface TableColumnModelExt
Returns:
first TableColumnExt with the given identifier or null if none is found

getInvisibleColumns

public Set getInvisibleColumns()
Description copied from interface: TableColumnModelExt
Returns a list containing all of the columns that are invisible. If no columns in this model are invisible, then this will be an empty list.

Specified by:
getInvisibleColumns in interface TableColumnModelExt

isRemovedToInvisibleEvent

public boolean isRemovedToInvisibleEvent(int oldIndex)
hot fix for #157: listeners that are aware of the possible existence of invisible columns should check if the received columnRemoved originated from moving a column from visible to invisible.

Parameters:
oldIndex - the fromIndex of the columnEvent
Returns:
true if the column was moved to invisible

isAddedFromInvisibleEvent

public boolean isAddedFromInvisibleEvent(int newIndex)
hot fix for #157: listeners that are aware of the possible existence of invisible columns should check if the received columnAdded originated from moving a column from invisible to visible.

Parameters:
newIndex - the toIndex of the columnEvent
Returns:
true if the column was moved to visible

removeColumn

public void removeColumn(TableColumn column)
Specified by:
removeColumn in interface TableColumnModel
Overrides:
removeColumn in class DefaultTableColumnModel

addColumn

public void addColumn(TableColumn aColumn)
Specified by:
addColumn in interface TableColumnModel
Overrides:
addColumn in class DefaultTableColumnModel

moveToInvisible

protected void moveToInvisible(TableColumnExt col)

moveToVisible

protected void moveToVisible(TableColumnExt col)

swingx
Version 2005-08-19