| Package | org.aswing.tree |
| Class | public class DefaultTreeModel |
| Implements | TreeModel |
See also
| Method | Defined by | ||
|---|---|---|---|
|
DefaultTreeModel(root:TreeNode, asc:Boolean = false)
Creates a tree specifying whether any node can have children,
or whether only certain nodes can have children.
| DefaultTreeModel | ||
|
Adds a listener for the TreeModelEvent posted after the tree changes.
| DefaultTreeModel | ||
|
asksAllowsChildren():Boolean
Tells how leaf nodes are determined.
| DefaultTreeModel | ||
|
getChild(parent:Object, index:int):Object
Returns the child of parent at index index in the parent's
child array.
| DefaultTreeModel | ||
|
getChildCount(parent:Object):int
Returns the number of children of parent.
| DefaultTreeModel | ||
|
getIndexOfChild(parent:Object, child:Object):int
Returns the index of child in parent.
| DefaultTreeModel | ||
|
getRoot():Object
Returns the root of the tree.
| DefaultTreeModel | ||
|
Invoked this to insert newChild at location index in parents children.
| DefaultTreeModel | ||
|
isLeaf(node:Object):Boolean
Returns whether the specified node is a leaf node.
| DefaultTreeModel | ||
|
nodeChanged(node:TreeNode):void
Invoke this method after you've changed how node is to be
represented in the tree.
| DefaultTreeModel | ||
|
nodesChanged(node:TreeNode, childIndices:Array):void
Invoke this method after you've changed how the children identified by
childIndicies are to be represented in the tree.
| DefaultTreeModel | ||
|
nodeStructureChanged(node:TreeNode):void
Invoke this method if you've totally changed the children of
node and its childrens children...
| DefaultTreeModel | ||
|
nodesWereInserted(node:TreeNode, childIndices:Array):void
Invoke this method after you've inserted some TreeNodes into
node.
| DefaultTreeModel | ||
|
nodesWereRemoved(node:TreeNode, childIndices:Array, removedChildren:Array):void
Invoke this method after you've removed some TreeNodes from
node.
| DefaultTreeModel | ||
|
Invoke this method if you've modified the TreeNodes upon which this
model depends.
| DefaultTreeModel | ||
|
removeNodeFromParent(node:MutableTreeNode):void
Message this to remove node from its parent.
| DefaultTreeModel | ||
|
Removes a listener previously added with addTreeModelListener().
| DefaultTreeModel | ||
|
setAsksAllowsChildren(newValue:Boolean):void
Sets whether or not to test leafness by asking getAllowsChildren()
or isLeaf() to the TreeNodes.
| DefaultTreeModel | ||
|
Sets the root to
root. | DefaultTreeModel | ||
|
toString():String
| DefaultTreeModel | ||
|
valueForPathChanged(path:TreePath, newValue:Object):void
This sets the user object of the TreeNode identified by path
and posts a node changed.
| DefaultTreeModel | ||
| DefaultTreeModel | () | constructor |
public function DefaultTreeModel(root:TreeNode, asc:Boolean = false)Creates a tree specifying whether any node can have children, or whether only certain nodes can have children.
Parametersroot:TreeNode — a TreeNode object that is the root of the tree
|
|
asc:Boolean (default = false) — (optional)a boolean, false if any node can
have children, true if each node is asked to see if
it can have children. Default is false.
|
See also
| addTreeModelListener | () | method |
public function addTreeModelListener(l:TreeModelListener):voidAdds a listener for the TreeModelEvent posted after the tree changes.
Parametersl:TreeModelListener — l the listener to add
|
See also
| asksAllowsChildren | () | method |
public function asksAllowsChildren():BooleanTells how leaf nodes are determined.
ReturnsBoolean — true if only nodes which do not allow children are
leaf nodes, false if nodes which have no children
(even if allowed) are leaf nodes
|
See also
| getChild | () | method |
public function getChild(parent:Object, index:int):ObjectReturns the child of 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)).
Parametersparent:Object — parent a node in the tree, obtained from this data source
|
|
index:int |
Object — the child of parent at index index
|
| getChildCount | () | method |
public function getChildCount(parent:Object):intReturns 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.
Parametersparent:Object — parent a node in the tree, obtained from this data source
|
int — the number of children of the node parent
|
| getIndexOfChild | () | method |
public function getIndexOfChild(parent:Object, child:Object):int
Returns the index of child in parent.
If either the parent or child is null, returns -1.
parent:Object — a note in the tree, obtained from this data source
|
|
child:Object — the node we are interested in
|
int — the index of the child in the parent, or -1
if either the parent or the child is null
|
| getRoot | () | method |
public function getRoot():ObjectReturns the root of the tree. Returns null only if the tree has no nodes.
ReturnsObject — the root of the tree
|
| insertNodeInto | () | method |
public function insertNodeInto(newChild:MutableTreeNode, parent:MutableTreeNode, index:int):voidInvoked this to insert newChild at location index in parents children. This will then message nodesWereInserted to create the appropriate event. This is the preferred way to add children as it will create the appropriate event.
ParametersnewChild:MutableTreeNode |
|
parent:MutableTreeNode |
|
index:int |
| isLeaf | () | method |
public function isLeaf(node:Object):Boolean
Returns whether the specified node is a leaf node.
The way the test is performed depends on the
askAllowsChildren setting.
node:Object — the node to check
|
Boolean — true if the node is a leaf node
|
See also
| nodeChanged | () | method |
public function nodeChanged(node:TreeNode):voidInvoke this method after you've changed how node is to be represented in the tree.
Parametersnode:TreeNode |
| nodesChanged | () | method |
public function nodesChanged(node:TreeNode, childIndices:Array):voidInvoke this method after you've changed how the children identified by childIndicies are to be represented in the tree.
Parametersnode:TreeNode |
|
childIndices:Array |
| nodeStructureChanged | () | method |
public function nodeStructureChanged(node:TreeNode):voidInvoke this method if you've totally changed the children of node and its childrens children... This will post a treeStructureChanged event.
Parametersnode:TreeNode |
| nodesWereInserted | () | method |
public function nodesWereInserted(node:TreeNode, childIndices:Array):voidInvoke this method after you've inserted some TreeNodes into node. childIndices should be the index of the new elements and must be sorted in ascending order.
Parametersnode:TreeNode |
|
childIndices:Array |
| nodesWereRemoved | () | method |
public function nodesWereRemoved(node:TreeNode, childIndices:Array, removedChildren:Array):voidInvoke this method after you've removed some TreeNodes from node. childIndices should be the index of the removed elements and must be sorted in ascending order. And removedChildren should be the array of the children objects that were removed.
Parametersnode:TreeNode |
|
childIndices:Array |
|
removedChildren:Array |
| reload | () | method |
public function reload(node:TreeNode = null):void
Invoke this method if you've modified the TreeNodes upon which this
model depends. The model will notify all of its listeners that the
model has changed below the node node (PENDING).
node:TreeNode (default = null) — (optional). Default is root.
|
| removeNodeFromParent | () | method |
public function removeNodeFromParent(node:MutableTreeNode):voidMessage this to remove node from its parent. This will message nodesWereRemoved to create the appropriate event. This is the preferred way to remove a node as it handles the event creation for you.
Parametersnode:MutableTreeNode |
| removeTreeModelListener | () | method |
public function removeTreeModelListener(l:TreeModelListener):voidRemoves a listener previously added with addTreeModelListener().
Parametersl:TreeModelListener — l the listener to remove
|
See also
| setAsksAllowsChildren | () | method |
public function setAsksAllowsChildren(newValue:Boolean):voidSets whether or not to test leafness by asking getAllowsChildren() or isLeaf() to the TreeNodes. If newvalue is true, getAllowsChildren() is messaged, otherwise isLeaf() is messaged.
ParametersnewValue:Boolean |
| setRoot | () | method |
public function setRoot(root:TreeNode):void
Sets the root to root. A null root implies
the tree is to display nothing, and is legal.
root:TreeNode |
| toString | () | method |
public function toString():String
Returns
String |
| valueForPathChanged | () | method |
public function valueForPathChanged(path:TreePath, newValue:Object):voidThis sets the user object of the TreeNode identified by path and posts a node changed. If you use custom user objects in the TreeModel you're going to need to subclass this and set the user object of the changed node to something meaningful.
Parameterspath:TreePath |
|
newValue:Object |