|
Copyright © 2011 Citra Technologies. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.citra.treetable.AbstractTreeTableModel
com.citra.treetable.TreeModelMap
public abstract class TreeModelMap
TreeModelMap is a wrapper around a TreeTableModel.
Field Summary | |
---|---|
protected TreeModel |
treeModel
the underlying treemodel. |
Fields inherited from class com.citra.treetable.AbstractTreeTableModel |
---|
listenerList, root |
Fields inherited from interface com.citra.treetable.TreeTableModel |
---|
CHANGE_COLUMN_SOURCE |
Constructor Summary | |
---|---|
TreeModelMap(TreeModel treeModel)
Constructs a TreeModelMap. |
Method Summary | |
---|---|
Object |
getChild(Object parent,
int index)
Returns the child of parent at index index
in the parent's
child array. |
int |
getChildCount(Object parent)
Returns the number of children of parent . |
int |
getIndexOfChild(Object parent,
Object child)
Returns the index of child in parent. |
TreeNode[] |
getPathToRoot(TreeNode aNode)
Builds the parents of node up to and including the root node, where the original node is the last element in the returned array. |
protected TreeNode[] |
getPathToRoot(TreeNode aNode,
int depth)
Builds the parents of node up to and including the root node, where the original node is the last element in the returned array. |
Object |
getRoot()
Returns the root of the tree. Returns null
only if the tree has no nodes. |
TreeModel |
getTreeModel()
Returns the underlying tree model. |
boolean |
isLeaf(Object node)
Returns true if node is a leaf. |
void |
nodeChanged(TreeNode node)
This method should be invoked when the representation of node in the tree
has changed. |
void |
nodesChanged(TreeNode node,
int[] childIndices)
This method should be invoked when the representation of the children identified by childIndices in the tree has changed. |
void |
nodeStructureChanged(TreeNode node)
This method should be invoked when the children of node and its children children have
completely changed. |
void |
setTreeModel(TreeModel newModel)
Sets the underlying tree model to newModel |
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. |
void |
valueForPathChanged(TreePath path,
Object newValue)
Messaged when the user has altered the value for the item identified by path to newValue . |
Methods inherited from class com.citra.treetable.AbstractTreeTableModel |
---|
addTreeModelListener, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, fireTreeTableStructureChanged, fireTreeTableStructureChanged, 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 com.citra.treetable.TreeTableModel |
---|
getColumnClass, getColumnCount, getColumnName, getValueAt, isCellEditable, setValueAt |
Field Detail |
---|
protected TreeModel treeModel
Constructor Detail |
---|
public TreeModelMap(TreeModel treeModel)
Method Detail |
---|
public Object getChild(Object parent, int index)
parent
at index index
in the parent's
child array. parent
must be a node previously obtained
from this data source. This should not return null
if index
is a valid index for parent
(that is index >= 0 &&
index < getChildCount(parent
)).
getChild
in interface TreeModel
parent
- a node in the tree, obtained from this data source
parent
at index index
public int getChildCount(Object parent)
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.
getChildCount
in interface TreeModel
parent
- a node in the tree, obtained from this data source
parent
public int getIndexOfChild(Object parent, Object child)
parent
is null
or child
is null
,
returns -1.
getIndexOfChild
in interface TreeModel
parent
- a note in the tree, obtained from this data sourcechild
- the node we are interested in
child
or parent
are null
public TreeNode[] getPathToRoot(TreeNode aNode)
protected TreeNode[] getPathToRoot(TreeNode aNode, int depth)
public Object getRoot()
null
only if the tree has no nodes.
getRoot
in interface TreeModel
getRoot
in class AbstractTreeTableModel
public TreeModel getTreeModel()
public boolean isLeaf(Object node)
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.
isLeaf
in interface TreeModel
node
- a node in the tree, obtained from this data source
node
is a leafpublic void nodeChanged(TreeNode node)
node
in the tree
has changed.
public void nodesChanged(TreeNode node, int[] childIndices)
childIndices
in the tree has changed.
public void nodeStructureChanged(TreeNode node)
node
and its children children have
completely changed. This will post a treeStructureChanged event.
public void setTreeModel(TreeModel newModel)
newModel
newModel
- the new tree model to assign.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.
treeStructureChanged
in interface TreeModelListener
public void valueForPathChanged(TreePath path, Object newValue)
path
to newValue
.
If newValue
signifies a truly new value
the model should post a treeNodesChanged
event.
valueForPathChanged
in interface TreeModel
path
- path to the node that the user has alterednewValue
- the new value from the TreeCellEditorpublic 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).
treeNodesChanged
in interface TreeModelListener
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.
treeNodesInserted
in interface TreeModelListener
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.
treeNodesRemoved
in interface TreeModelListener
|
Copyright © 2011 Citra Technologies. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |