Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.table.group
Class TreeTableColumnModelMap

java.lang.Object
  extended by com.citra.treetable.AbstractTreeTableModel
      extended by com.citra.treetable.TreeModelMap
          extended by com.citra.treetable.TreeTableModelMap
              extended by com.citra.table.group.TreeTableColumnModelMap
All Implemented Interfaces:
ReorderListener, CacheableTreeTableModel, TreeTableColumnModel, ReorderModel, TreeTableModel, Serializable, EventListener, TreeModelListener, TreeModel

public class TreeTableColumnModelMap
extends TreeTableModelMap
implements TreeTableColumnModel

TreeTableColumnModelMap is used for transparently transforming an underlying TreeTableColumnModel. You can use this class in combination with a DefaultFilterTreeTableModel and DefaultSortTreeTableModel.
For example:

DefaultFilterTreeTableModel ftm = new DefaultFilterTreeTableModel(treeColumnModel);
DefaultSortTreeTableModel stm = new DefaultSortTreeTableModel(ftm);
TreeTableColumnModelMap model = new TreeTableColumnModelMap(stm);
TreeTableHeader treeHeader = new TreeTableHeader(model);

In the example above, we have created a filterable and sortable treetable header.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.citra.treetable.TreeTableModelMap
treeTableModel
 
Fields inherited from class com.citra.treetable.TreeModelMap
treeModel
 
Fields inherited from class com.citra.treetable.AbstractTreeTableModel
listenerList, root
 
Fields inherited from interface com.citra.treetable.TreeTableModel
CHANGE_COLUMN_SOURCE
 
Constructor Summary
TreeTableColumnModelMap(TreeTableModel treeTableModel)
          Constructs a ColumnModelMapper.
 
Method Summary
 void addColumnInvalidatorListener(ColumnInvalidatorListener x)
          Adds a listener that is notified when the columns of the model were changed (via additions or removals).
protected  MutableTreeNode createMutableColumnNode(TableColumn aColumn)
          Creates and returns a tree-node containing the table column passed as argument.
 void fireColumnsInvalidated()
          Notifies all listeners that have registered interest for notification on this event type.
 TableColumn getColumn(Object node)
          Returns the table column at the specified node.
protected  TableColumn getColumnFromModel(MutableTreeTableModel model, Object node)
          Returns the column from the mutable treetable model's node passed as argument.
 Object insertColumnInto(TableColumn aColumn, Object columnNode, Object parentNode, int index)
          Inserts a table column at the specified node's index.
 void removeColumnFrom(Object node)
          Removes a node from the model.
 void removeColumnInvalidatorListener(ColumnInvalidatorListener x)
          Removes a listener that is notified when the columns of the model were changed (via additions or removals).
 void treeNodesChanged(TreeModelEvent e)
          

Invoked after a node (or a set of siblings) has changed in some way.

 void treeNodesInserted(TreeModelEvent e)
          

Invoked after nodes have been inserted into the tree.

Use e.getPath() to get the parent of the new node(s). e.getChildIndices() returns the index(es) of the new node(s) in ascending order.

 void treeNodesRemoved(TreeModelEvent e)
          

Invoked after nodes have been removed from the tree. Note that if a subtree is removed from the tree, this method may only be invoked once for the root of the removed subtree, not once for each individual set of siblings removed.

Use e.getPath() to get the former parent of the deleted node(s). e.getChildIndices() returns, in ascending order, the index(es) the node(s) had before being deleted.

 void treeStructureChanged(TreeModelEvent e)
          

Invoked after the tree has drastically changed structure from a given node down. If the path returned by e.getPath() is of length one and the first element does not identify the current root node the first element should become the new root of the tree.

Use e.getPath() to get the path to the node. e.getChildIndices() returns null.

 
Methods inherited from class com.citra.treetable.TreeTableModelMap
addReorderListener, fireRowsMapped, fireRowsReordered, getColumnClass, getColumnCount, getColumnName, getInnerTreeTableModel, getMappedIndexes, getTreeTableModel, getUncachedChildren, getUncachedGroupCount, getUncachedGroups, getValueAt, isAggregate, isCellEditable, isCountCached, isFooter, isHeader, isRangedModel, isValueCached, removeReorderListener, rowsReordered, setTreeModel, setTreeTableModel, setValueAt
 
Methods inherited from class com.citra.treetable.TreeModelMap
getChild, getChildCount, getIndexOfChild, getPathToRoot, getPathToRoot, getRoot, getTreeModel, isLeaf, nodeChanged, nodesChanged, nodeStructureChanged, valueForPathChanged
 
Methods inherited from class com.citra.treetable.AbstractTreeTableModel
addTreeModelListener, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, fireTreeTableStructureChanged, fireTreeTableStructureChanged, removeTreeModelListener, setRoot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.tree.TreeModel
addTreeModelListener, getChild, getChildCount, getIndexOfChild, getRoot, isLeaf, removeTreeModelListener, valueForPathChanged
 

Constructor Detail

TreeTableColumnModelMap

public TreeTableColumnModelMap(TreeTableModel treeTableModel)
Constructs a ColumnModelMapper.

Method Detail

addColumnInvalidatorListener

public void addColumnInvalidatorListener(ColumnInvalidatorListener x)
Adds a listener that is notified when the columns of the model were changed (via additions or removals).

Specified by:
addColumnInvalidatorListener in interface TreeTableColumnModel
Parameters:
x - the listener to be added

createMutableColumnNode

protected MutableTreeNode createMutableColumnNode(TableColumn aColumn)
Creates and returns a tree-node containing the table column passed as argument.

Parameters:
aColumn - the column for which a tree-node is being added
Returns:
a tree-node containing the supplied column

fireColumnsInvalidated

public void fireColumnsInvalidated()
Notifies all listeners that have registered interest for notification on this event type.


treeNodesChanged

public void treeNodesChanged(TreeModelEvent e)
Description copied from class: TreeModelMap

Invoked after a node (or a set of siblings) has changed in some way. The node(s) have not changed locations in the tree or altered their children arrays, but other attributes have changed and may affect presentation. Example: the name of a file has changed, but it is in the same location in the file system.

To indicate the root has changed, childIndices and children will be null.

Use e.getPath() to get the parent of the changed node(s). e.getChildIndices() returns the index(es) of the changed node(s).

Specified by:
treeNodesChanged in interface TreeModelListener
Overrides:
treeNodesChanged in class TreeModelMap

treeNodesInserted

public void treeNodesInserted(TreeModelEvent e)

Invoked after nodes have been inserted into the tree.

Use e.getPath() to get the parent of the new node(s). e.getChildIndices() returns the index(es) of the new node(s) in ascending order.

Specified by:
treeNodesInserted in interface TreeModelListener
Overrides:
treeNodesInserted in class TreeModelMap

treeNodesRemoved

public void treeNodesRemoved(TreeModelEvent e)

Invoked after nodes have been removed from the tree. Note that if a subtree is removed from the tree, this method may only be invoked once for the root of the removed subtree, not once for each individual set of siblings removed.

Use e.getPath() to get the former parent of the deleted node(s). e.getChildIndices() returns, in ascending order, the index(es) the node(s) had before being deleted.

Specified by:
treeNodesRemoved in interface TreeModelListener
Overrides:
treeNodesRemoved in class TreeModelMap

treeStructureChanged

public void treeStructureChanged(TreeModelEvent e)

Invoked after the tree has drastically changed structure from a given node down. If the path returned by e.getPath() is of length one and the first element does not identify the current root node the first element should become the new root of the tree.

Use e.getPath() to get the path to the node. e.getChildIndices() returns null.

Specified by:
treeStructureChanged in interface TreeModelListener
Overrides:
treeStructureChanged in class TreeModelMap

getColumn

public TableColumn getColumn(Object node)
Returns the table column at the specified node.

Specified by:
getColumn in interface TreeTableColumnModel
Returns:
the table column

getColumnFromModel

protected TableColumn getColumnFromModel(MutableTreeTableModel model,
                                         Object node)
Returns the column from the mutable treetable model's node passed as argument.

Parameters:
model - the mutable treetable model
node - the model's node
Returns:
the table column at node

insertColumnInto

public Object insertColumnInto(TableColumn aColumn,
                               Object columnNode,
                               Object parentNode,
                               int index)
Inserts a table column at the specified node's index.

Specified by:
insertColumnInto in interface TreeTableColumnModel
Parameters:
aColumn - the table column to insert
columnNode - the node that 'contains' the column. If this is null, a new node should be created.
parentNode - the node under which the column is to be inserted
index - the parent node's index to insert the column into
Returns:
the newly created node or columnNode if this wasn't null

removeColumnFrom

public void removeColumnFrom(Object node)
Removes a node from the model. The node presumably 'contains' a table column.

Specified by:
removeColumnFrom in interface TreeTableColumnModel
Parameters:
node - the node at which the column is found

removeColumnInvalidatorListener

public void removeColumnInvalidatorListener(ColumnInvalidatorListener x)
Removes a listener that is notified when the columns of the model were changed (via additions or removals).

Specified by:
removeColumnInvalidatorListener in interface TreeTableColumnModel
Parameters:
x - the listener to be removed

Copyright © 2011 Citra Technologies. All Rights Reserved.