|
EchoPoint 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object echopoint.tree.DefaultTreeModel
A simple tree data model that uses TreeNodes.
Field Summary | |
protected boolean |
asksAllowsChildren
Determines how the isLeaf method figures
out if a node is a leaf node. |
protected nextapp.echo.event.EventListenerList |
listenerList
Listeners. |
protected TreeNode |
root
Root of the tree. |
Constructor Summary | |
DefaultTreeModel(TreeNode root)
Creates a tree in which any node can have children. |
|
DefaultTreeModel(TreeNode root,
boolean asksAllowsChildren)
Creates a tree specifying whether any node can have children, or whether only certain nodes can have children. |
Method Summary | |
void |
addTreeModelListener(TreeModelListener l)
Adds a listener for the TreeModelEvent posted after the tree changes. |
boolean |
asksAllowsChildren()
Tells how leaf nodes are determined. |
TreeNode |
findNodeById(TreeNode parent,
java.lang.String idString)
Finds a node within the tree, starting at parent, with the given idString, ie node.getId.toString().equals(idString) == true |
protected void |
fireTreeNodesChanged(java.lang.Object source,
java.lang.Object[] path,
int[] childIndices,
java.lang.Object[] children)
|
protected void |
fireTreeNodesInserted(java.lang.Object source,
java.lang.Object[] path,
int[] childIndices,
java.lang.Object[] children)
|
protected void |
fireTreeNodesRemoved(java.lang.Object source,
java.lang.Object[] path,
int[] childIndices,
java.lang.Object[] children)
|
protected void |
fireTreeStructureChanged(java.lang.Object source,
java.lang.Object[] path,
int[] childIndices,
java.lang.Object[] children)
|
java.lang.Object |
getChild(java.lang.Object parent,
int index)
Returns the child of parent at index index in the parent's child array. |
int |
getChildCount(java.lang.Object parent)
Returns the number of children of parent. |
java.lang.String |
getIdString(java.lang.Object value)
This returns a unique id string for the tree cell. |
int |
getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
Returns the index of child in parent. |
java.lang.Object |
getParent(java.lang.Object child)
Returns the parent of child. |
java.lang.Object[] |
getPathToRoot(java.lang.Object node)
Builds the parents of node up to and including the root node, where the original node is the last element in the returned array. |
java.lang.Object[] |
getPathToRoot(java.lang.String idString)
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. |
java.lang.Object |
getRoot()
Returns the root of the tree. |
void |
insertNodeInto(MutableTreeNode newChild,
MutableTreeNode parent,
int index)
Invoked this to insert newChild at location index in parents children. |
boolean |
isLeaf(java.lang.Object node)
Returns whether the specified node is a leaf node. |
void |
nodeChanged(TreeNode node)
Invoke this method after you've changed how node is to be represented in the tree. |
void |
nodesChanged(TreeNode node,
int[] childIndices)
Invoke this method after you've changed how the children identified by childIndicies are to be represented in the tree. |
void |
nodeStructureChanged(TreeNode node)
Invoke this method if you've totally changed the children of node and its childrens children... |
void |
nodesWereInserted(TreeNode node,
int[] childIndices)
Invoke this method after you've inserted some TreeNodes into node. |
void |
nodesWereRemoved(TreeNode node,
int[] childIndices,
java.lang.Object[] removedChildren)
Invoke this method after you've removed some TreeNodes from node. |
void |
reload()
Invoke this method if you've modified the TreeNodes upon which this model depends. |
void |
reload(TreeNode node)
Invoke this method if you've modified the TreeNodes upon which this model depends. |
void |
removeNodeFromParent(MutableTreeNode node)
Message this to remove node from its parent. |
void |
removeTreeModelListener(TreeModelListener l)
Removes a listener previously added with addTreeModelListener(). |
void |
setAsksAllowsChildren(boolean newValue)
Sets whether or not to test leafness by asking getAllowsChildren() or isLeaf() to the TreeNodes. |
void |
setRoot(TreeNode root)
Sets the root to root . |
void |
valueForPathChanged(TreePath path,
java.lang.Object newValue)
This sets the user object of the TreeNode identified by path and posts a node changed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected TreeNode root
protected nextapp.echo.event.EventListenerList listenerList
protected boolean asksAllowsChildren
isLeaf
method figures
out if a node is a leaf node. If true, a node is a leaf
node if it does not allow children. (If it allows
children, it is not a leaf node, even if no children
are present.) That lets you distinguish between folder
nodes and file nodes in a file system, for example.
If this value is false, then any node which has no children is a leaf node, and any node may acquire children.
Constructor Detail |
public DefaultTreeModel(TreeNode root)
root
- a TreeNode object that is the root of the treepublic DefaultTreeModel(TreeNode root, boolean asksAllowsChildren)
root
- a TreeNode object that is the root of the treeasksAllowsChildren
- a boolean, false if any node can
have children, true if each node is asked to see if
it can have childrenMethod Detail |
public void addTreeModelListener(TreeModelListener l)
TreeModel
addTreeModelListener
in interface TreeModel
l
- the listener to addpublic boolean asksAllowsChildren()
public TreeNode findNodeById(TreeNode parent, java.lang.String idString)
node.getId.toString().equals(idString) == true
protected void fireTreeNodesChanged(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
protected void fireTreeNodesInserted(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
protected void fireTreeNodesRemoved(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
protected void fireTreeStructureChanged(java.lang.Object source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
public java.lang.Object getChild(java.lang.Object parent, int index)
getChild
in interface TreeModel
parent
- a node in the tree, obtained from this data source
public int getChildCount(java.lang.Object parent)
getChildCount
in interface TreeModel
parent
- a node in the tree, obtained from this data source
public int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
getIndexOfChild
in interface TreeModel
public java.lang.Object getParent(java.lang.Object child)
getParent
in interface TreeModel
child
- a node in the tree
protected TreeNode[] getPathToRoot(TreeNode aNode, int depth)
aNode
- the TreeNode to get the path fordepth
- an int giving the number of steps already taken towards
the root (on recursive calls), used to size the returned array
public java.lang.Object[] getPathToRoot(java.lang.Object node)
getPathToRoot
in interface TreeModel
node
- the TreeNode to get the path forpublic java.lang.Object[] getPathToRoot(java.lang.String idString)
A match will be made to a node if the node implements TreeNode and
node.getId.toString().equals(idString) == true
getPathToRoot
in interface TreeModel
idString
- of the node to get the path forpublic java.lang.Object getRoot()
getRoot
in interface TreeModel
public void insertNodeInto(MutableTreeNode newChild, MutableTreeNode parent, int index)
public boolean isLeaf(java.lang.Object node)
askAllowsChildren
setting.
isLeaf
in interface TreeModel
node
- a node in the tree, obtained from this data source
public void nodeChanged(TreeNode node)
public void nodesChanged(TreeNode node, int[] childIndices)
public void nodeStructureChanged(TreeNode node)
public void nodesWereInserted(TreeNode node, int[] childIndices)
public void nodesWereRemoved(TreeNode node, int[] childIndices, java.lang.Object[] removedChildren)
public void reload()
public void reload(TreeNode node)
node
.
public void removeNodeFromParent(MutableTreeNode node)
public void removeTreeModelListener(TreeModelListener l)
TreeModel
removeTreeModelListener
in interface TreeModel
public void setAsksAllowsChildren(boolean newValue)
public void setRoot(TreeNode root)
root
. This will throw an
IllegalArgumentException if root
is null.
public java.lang.String getIdString(java.lang.Object value)
getIdString
in interface TreeModel
value
- a node in the treepublic void valueForPathChanged(TreePath path, java.lang.Object newValue)
valueForPathChanged
in interface TreeModel
path
- path to the node that the user has altered.newValue
- the new value from the Tree.
|
EchoPoint 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |