Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.table.group
Class DefaultTreeTableColumnModelAdapter

java.lang.Object
  extended by com.citra.table.group.AbstractTreeTableColumnModelAdapter
      extended by com.citra.table.group.DefaultTreeTableColumnModelAdapter
All Implemented Interfaces:
ColumnInvalidatorListener, TreeTableColumnModelAdapter, VetoableTableColumnModel, PropertyChangeListener, Serializable, EventListener, ListSelectionListener, TableColumnModel
Direct Known Subclasses:
DefaultPivotColumnAdapter

public class DefaultTreeTableColumnModelAdapter
extends AbstractTreeTableColumnModelAdapter
implements ColumnInvalidatorListener

DefaultTreeTableColumnModelAdapter is the default implementation of a TreeTableColumnModelAdapter.

Since:
3.4.4
See Also:
Serialized Form

Field Summary
protected  int cc
          a local cache of the model's column count
protected  JTree tree
          the tree
protected  TreeTableColumnModel treeColumnModel
          the treetable column model
 
Fields inherited from class com.citra.table.group.AbstractTreeTableColumnModelAdapter
changeEvent, changeSupport, columnMargin, columnSelectionAllowed, listenerList, selectionModel, totalColumnWidth
 
Fields inherited from interface com.citra.table.group.TreeTableColumnModelAdapter
TREE_PROPERTY, TREE_TABLE_COLUMN_MODEL_PROPERTY
 
Constructor Summary
DefaultTreeTableColumnModelAdapter()
          Constructs a DefaultTreeTableColumnModelAdapter.
DefaultTreeTableColumnModelAdapter(TreeTableColumnModel treeTableModel)
          Constructs a DefaultTreeTableColumnModelAdapter.
DefaultTreeTableColumnModelAdapter(TreeTableColumnModel treeTableModel, JTree tree)
          Constructs a DefaultTreeTableColumnModelAdapter.
 
Method Summary
 void addColumn(TableColumn aColumn)
          Appends aColumn to the end of the tableColumns array.
 void collapseAll()
          Convenience method to collapse all columns.
protected  void columnAdded(TableColumn tc, int index)
          Invoke this method after columns were added.
protected  void columnRemoved(TableColumn tc, int index)
          Invoke this method after columns were removed.
 void columnsInvalidated()
          Method that is called when the columns of a TreeTableColumnModel have changed in some way via additions or removals.
protected  JTree createDefaultTree()
          Returns a new instance of the JTree that will be associated with this TreeTableColumnModelAdapter.
protected  TreeTableColumnModel createDefaultTreeColumnModel()
          Creates and returns a new instance of the hierarchical column model that will be used.
 void expandAll()
          Convenience method to expand all columns.
protected  void fireColumnAdded(TableColumnModelEvent e)
          Notify all listeners that have registered interest for notification on this event type.
protected  void fireColumnRemoved(TableColumnModelEvent e)
          Notify all listeners that have registered interest for notification on this event type.
 TableColumn getColumn(int columnIndex)
          Returns the TableColumn object for the column at columnIndex.
 int getColumnCount()
          Returns the number of columns in the model.
 int getColumnCountFromTree()
          Returns the uncached models' column count.
 TableColumn getColumnFromModel(int columnIndex)
          Returns the column at columnIndex by delegating to the model.
 Enumeration getColumns()
          Returns an Enumeration of all the columns in the model.
protected  int getPreviousColumnCount()
          Called from subclasses during events to find what was the column count before the event.
 JTree getTree()
          Returns the associated tree.
 TreeTableColumnModel getTreeTableColumnModel()
          Returns the associated treetable column model.
protected  void invalidateColumns()
          Invalidates the cached column store and count.
 void moveColumn(int columnIndex, int newIndex)
          Moves the column and its header at columnIndex to newIndex.
protected  void nodeCollapsed(TreePath path)
          Notification that the specified path was collapsed.
protected  void nodeExpanded(TreePath path)
          Notification that the specified path was expanded.
 Object nodeForRow(int rowIndex)
          Returns the node found at row rowIndex of the tree.
protected  void nodesChanged(TreeModelEvent e)
          Notification that children nodes at the specified path have changed.
protected  void nodesInserted(TreeModelEvent e)
          Notification that children nodes at the specified path have been added.
protected  void nodesRemoved(TreeModelEvent e)
          Notification that children nodes at the specified path have been removed.
 void removeColumn(TableColumn column)
          Deletes the TableColumn column from the tableColumns array.
 void setTree(JTree newTree)
          Sets a new tree.
 void setTreeTableColumnModel(TreeTableColumnModel newModel)
          Sets a new treetable column model.
protected  void structureChanged(TreeModelEvent e)
          Notification that the structure of the nodes at the specified path has changed.
 
Methods inherited from class com.citra.table.group.AbstractTreeTableColumnModelAdapter
addColumnModelListener, addPropertyChangeListener, addVetoableColumnModelListener, createSelectionModel, fireColumnMarginChanged, fireColumnMoved, fireColumnSelectionChanged, fireColumnWillBeAdded, fireColumnWillBeMoved, fireColumnWillBeRemoved, getColumnIndex, getColumnIndexAtX, getColumnMargin, getColumnSelectionAllowed, getListeners, getSelectedColumnCount, getSelectedColumns, getSelectionModel, getTotalColumnWidth, invalidateWidthCache, propertyChange, recalcWidthCache, removeColumnModelListener, removePropertyChangeListener, removeVetoableColumnModelListener, setColumnMargin, setColumnSelectionAllowed, setSelectionModel, valueChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cc

protected int cc
a local cache of the model's column count


tree

protected JTree tree
the tree


treeColumnModel

protected TreeTableColumnModel treeColumnModel
the treetable column model

Constructor Detail

DefaultTreeTableColumnModelAdapter

public DefaultTreeTableColumnModelAdapter()
Constructs a DefaultTreeTableColumnModelAdapter.


DefaultTreeTableColumnModelAdapter

public DefaultTreeTableColumnModelAdapter(TreeTableColumnModel treeTableModel)
Constructs a DefaultTreeTableColumnModelAdapter.


DefaultTreeTableColumnModelAdapter

public DefaultTreeTableColumnModelAdapter(TreeTableColumnModel treeTableModel,
                                          JTree tree)
Constructs a DefaultTreeTableColumnModelAdapter.

Method Detail

addColumn

public void addColumn(TableColumn aColumn)
Appends aColumn to the end of the tableColumns array. This method posts a columnAdded event to its listeners.

Specified by:
addColumn in interface TableColumnModel
Parameters:
aColumn - the TableColumn to be added
See Also:
TableColumnModel.removeColumn(javax.swing.table.TableColumn)

collapseAll

public void collapseAll()
Convenience method to collapse all columns.


columnAdded

protected void columnAdded(TableColumn tc,
                           int index)
Invoke this method after columns were added.

Parameters:
tc - the table column that was added
index - the index at which the column was added

columnRemoved

protected void columnRemoved(TableColumn tc,
                             int index)
Invoke this method after columns were removed.

Parameters:
tc - the table column that was removed
index - the index at which the column was removed

columnsInvalidated

public void columnsInvalidated()
Method that is called when the columns of a TreeTableColumnModel have changed in some way via additions or removals.

Specified by:
columnsInvalidated in interface ColumnInvalidatorListener

createDefaultTree

protected JTree createDefaultTree()
Returns a new instance of the JTree that will be associated with this TreeTableColumnModelAdapter.

Returns:
a new JTree instance

createDefaultTreeColumnModel

protected TreeTableColumnModel createDefaultTreeColumnModel()
Creates and returns a new instance of the hierarchical column model that will be used.

By default, this method returns a DefaultTreeTableColumnModel.


expandAll

public void expandAll()
Convenience method to expand all columns.


fireColumnAdded

protected void fireColumnAdded(TableColumnModelEvent e)
Notify all listeners that have registered interest for notification on this event type.

Overrides:
fireColumnAdded in class AbstractTreeTableColumnModelAdapter
Parameters:
e - the event that is propagated to listeners

fireColumnRemoved

protected void fireColumnRemoved(TableColumnModelEvent e)
Notify all listeners that have registered interest for notification on this event type.

Overrides:
fireColumnRemoved in class AbstractTreeTableColumnModelAdapter
Parameters:
e - the event that is propagated to listeners

getColumn

public TableColumn getColumn(int columnIndex)
Returns the TableColumn object for the column at columnIndex.

Specified by:
getColumn in interface TableColumnModel
Parameters:
columnIndex - the index of the desired column
Returns:
the TableColumn object for the column at columnIndex

getColumnCount

public int getColumnCount()
Returns the number of columns in the model.

Specified by:
getColumnCount in interface TableColumnModel
Returns:
the number of columns in the model

getColumnCountFromTree

public int getColumnCountFromTree()
Returns the uncached models' column count.

Returns:
the column count (uncached)

getColumnFromModel

public TableColumn getColumnFromModel(int columnIndex)
Returns the column at columnIndex by delegating to the model.

Parameters:
columnIndex - the index of the column
Returns:
the table column

getColumns

public Enumeration getColumns()
Returns an Enumeration of all the columns in the model.

Specified by:
getColumns in interface TableColumnModel
Returns:
an Enumeration of all the columns in the model

getPreviousColumnCount

protected int getPreviousColumnCount()
Called from subclasses during events to find what was the column count before the event.

Returns:
the previous column count

getTree

public JTree getTree()
Returns the associated tree.

Specified by:
getTree in interface TreeTableColumnModelAdapter
Returns:
the tree.

getTreeTableColumnModel

public TreeTableColumnModel getTreeTableColumnModel()
Returns the associated treetable column model.

Specified by:
getTreeTableColumnModel in interface TreeTableColumnModelAdapter
Returns:
the treetable column model.

invalidateColumns

protected void invalidateColumns()
Invalidates the cached column store and count.


moveColumn

public void moveColumn(int columnIndex,
                       int newIndex)
Moves the column and its header at columnIndex to newIndex. The old column at columnIndex will now be found at newIndex. The column that used to be at newIndex is shifted left or right to make room. This will not move any columns if columnIndex equals newIndex. This method posts a columnMoved event to its listeners.

Specified by:
moveColumn in interface TableColumnModel
Parameters:
columnIndex - the index of column to be moved
newIndex - index of the column's new location

nodeCollapsed

protected void nodeCollapsed(TreePath path)
Notification that the specified path was collapsed.

Parameters:
path - the path that was collapsed

nodeExpanded

protected void nodeExpanded(TreePath path)
Notification that the specified path was expanded.

Parameters:
path - the path that was expanded

nodeForRow

public Object nodeForRow(int rowIndex)
Returns the node found at row rowIndex of the tree.

Parameters:
rowIndex - the row number of the tree
Returns:
the node at rowIndex

nodesChanged

protected void nodesChanged(TreeModelEvent e)
Notification that children nodes at the specified path have changed.

Parameters:
e - the event identifying the change

nodesInserted

protected void nodesInserted(TreeModelEvent e)
Notification that children nodes at the specified path have been added.

Parameters:
e - the event identifying the insertion

nodesRemoved

protected void nodesRemoved(TreeModelEvent e)
Notification that children nodes at the specified path have been removed.

Parameters:
e - the event identifying the removal

removeColumn

public void removeColumn(TableColumn column)
Deletes the TableColumn column from the tableColumns array. This method will do nothing if column is not in the table's column list. This method posts a columnRemoved event to its listeners.

Specified by:
removeColumn in interface TableColumnModel
Parameters:
column - the TableColumn to be removed
See Also:
TableColumnModel.addColumn(javax.swing.table.TableColumn)

setTree

public void setTree(JTree newTree)
Sets a new tree.

Parameters:
newTree - the new tree to assign.

setTreeTableColumnModel

public void setTreeTableColumnModel(TreeTableColumnModel newModel)
Sets a new treetable column model. A property change event is fired with the TREE_TABLE_COLUMN_MODEL_PROPERTY.

Parameters:
newModel - the new treetable column model to assign.

structureChanged

protected void structureChanged(TreeModelEvent e)
Notification that the structure of the nodes at the specified path has changed.

Parameters:
e - the event identifying the structure change

Copyright © 2011 Citra Technologies. All Rights Reserved.