Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.table.group
Class TreeColumnModelMask

java.lang.Object
  extended by com.citra.treetable.AbstractTreeTableModel
      extended by com.citra.treetable.MutableTreeTableModel
          extended by com.citra.treetable.ComparableTreeTableModel
              extended by com.citra.treetable.ObjectTreeTableModel
                  extended by com.citra.table.group.DefaultTreeTableColumnModel
                      extended by com.citra.table.group.TreeColumnModelMask
All Implemented Interfaces:
ReorderListener, TreeTableColumnModel, ReorderModel, TreeTableModel, Serializable, EventListener, TreeModelListener, TreeModel

public class TreeColumnModelMask
extends DefaultTreeTableColumnModel
implements TreeModelListener, ReorderListener

TreeColumnModelMask wraps around a TreeTableColumnModel.

See Also:
Serialized Form

Field Summary
protected  TreeTableColumnModel model
          the underlying treetable column model
 
Fields inherited from class com.citra.treetable.ComparableTreeTableModel
addChildForGroup, comparators, defaultComparatorsByColumnClass
 
Fields inherited from class com.citra.treetable.MutableTreeTableModel
classes, columns
 
Fields inherited from class com.citra.treetable.AbstractTreeTableModel
listenerList, root
 
Fields inherited from interface com.citra.treetable.TreeTableModel
CHANGE_COLUMN_SOURCE
 
Constructor Summary
TreeColumnModelMask(TreeTableColumnModel model)
          Constructs a TreeColumnModelMask.
 
Method Summary
protected  DefaultMutableTreeNode createLeafNode(Object o)
          Creates and returns a new instance of a leaf node whose 'column data' is identified by data. data in this framework is either DefaultMutableTreeNode's user object attribute or the aggregate values of a TreeTableRow.
 int getChildCount(Object parent)
          Returns the number of children of parent. Returns 0 if the node is a leaf or if it has no children. parent must be a node previously obtained from this data source.
 TableColumn getColumn(Object node)
          Returns the table column at the specified node.
 Object getMaskedNode(Object node)
          Returns the enclosed node of the underlying model, that node represents.
 TreeTableColumnModel getTreeTableColumnModel()
          Returns the underlying treetable column model.
 void insertNodeInto(MutableTreeNode newChild, MutableTreeNode parent, int index)
          Inserts a node at a specific location index in its parents children.
 boolean isLeaf(Object node)
          Returns true if node is a leaf. It is possible for this method to return false even if node has no children. A directory in a filesystem, for example, may contain no files; the node representing the directory is not a leaf, but it also has no children.
 void rowsReordered(ReorderEvent e)
          Called whenever the rows of a JTable have been restructured.
 void setTreeTableColumnModel(TreeTableColumnModel model)
          Assigns a new underlying treetable column model
 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.

 void treeNodesRemoved(TreeModelEvent e)
          

Invoked after nodes have been removed from the tree.

 void treeStructureChanged(TreeModelEvent e)
          

Invoked after the tree has drastically changed structure from a given node down.

 
Methods inherited from class com.citra.table.group.DefaultTreeTableColumnModel
addColumnInvalidatorListener, fireColumnsInvalidated, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, fireTreeTableStructureChanged, getColumnClass, getObjectAt, getValueAt, insertColumnInto, removeColumnFrom, removeColumnInvalidatorListener
 
Methods inherited from class com.citra.treetable.ObjectTreeTableModel
createNonLeafNode, replicateLeafNode, setObjectAt, setValueAt
 
Methods inherited from class com.citra.treetable.ComparableTreeTableModel
add, add, addNode, addRowComparator, clearComparators, comparatorsChanged, createDefaultComparators, findTreeNode, getAddChildForGroup, getDefaultComparator, getRowComparator, getRowComparators, getRowComparatorSize, insertRowComparator, loadComparators, refreshComparators, removeRowComparator, removeRowComparator, saveComparators, setAddChildForGroup, setDefaultComparator, setRowComparator
 
Methods inherited from class com.citra.treetable.MutableTreeTableModel
addColumn, addColumn, addReorderListener, clear, fireRowsMapped, fireRowsReordered, getChild, getColumnCount, getColumnName, getIndexOfChild, getPathToRoot, getPathToRoot, isCellEditable, moveNode, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, removeNodeFromParent, removeReorderListener, setColumnClasses, setColumnNames, valueForPathChanged
 
Methods inherited from class com.citra.treetable.AbstractTreeTableModel
addTreeModelListener, fireTreeNodesChanged, fireTreeTableStructureChanged, getRoot, isAggregate, isFooter, isHeader, 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, getIndexOfChild, getRoot, removeTreeModelListener, valueForPathChanged
 

Field Detail

model

protected TreeTableColumnModel model
the underlying treetable column model

Constructor Detail

TreeColumnModelMask

public TreeColumnModelMask(TreeTableColumnModel model)
Constructs a TreeColumnModelMask.

Method Detail

createLeafNode

protected DefaultMutableTreeNode createLeafNode(Object o)
Creates and returns a new instance of a leaf node whose 'column data' is identified by data. data in this framework is either DefaultMutableTreeNode's user object attribute or the aggregate values of a TreeTableRow.

Overrides:
createLeafNode in class ObjectTreeTableModel
Parameters:
o - the node's 'column data'.
Returns:
the newly created leaf node.

getChildCount

public int getChildCount(Object parent)
Returns the number of children of parent. Returns 0 if the node is a leaf or if it has no children. parent must be a node previously obtained from this data source.

Specified by:
getChildCount in interface TreeModel
Overrides:
getChildCount in class MutableTreeTableModel
Parameters:
parent - a node in the tree, obtained from this data source
Returns:
the number of children of the node parent

getColumn

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

Specified by:
getColumn in interface TreeTableColumnModel
Overrides:
getColumn in class DefaultTreeTableColumnModel
Returns:
the table column

getMaskedNode

public Object getMaskedNode(Object node)
Returns the enclosed node of the underlying model, that node represents.

Parameters:
node - a node of this model
Returns:
the masked node - referring to a node of the underlying model

getTreeTableColumnModel

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

Returns:
the underlying treetable column model

insertNodeInto

public void insertNodeInto(MutableTreeNode newChild,
                           MutableTreeNode parent,
                           int index)
Inserts a node at a specific location index in its parents children. The appropriate event is also created.

Overrides:
insertNodeInto in class MutableTreeTableModel
Parameters:
newChild - the node to insert
parent - the parent node to remove node from
index - the location in the parent node's childrens

isLeaf

public boolean isLeaf(Object node)
Returns true if node is a leaf. It is possible for this method to return false even if node has no children. A directory in a filesystem, for example, may contain no files; the node representing the directory is not a leaf, but it also has no children.

Specified by:
isLeaf in interface TreeModel
Overrides:
isLeaf in class MutableTreeTableModel
Parameters:
node - a node in the tree, obtained from this data source
Returns:
true if node is a leaf

rowsReordered

public void rowsReordered(ReorderEvent e)
Called whenever the rows of a JTable have been restructured.

Specified by:
rowsReordered in interface ReorderListener
Parameters:
e - the ReorderEvent object

setTreeTableColumnModel

public void setTreeTableColumnModel(TreeTableColumnModel model)
Assigns a new underlying treetable column model

Parameters:
model - the new treetable column model to assign

treeNodesChanged

public void treeNodesChanged(TreeModelEvent e)

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

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

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

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

Copyright © 2011 Citra Technologies. All Rights Reserved.