Class mindmaps.Node
Defined in: Node.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Creates a new node.
|
Method Attributes | Method Name and Description |
---|---|
addChild(node)
Adds a child to the node.
|
|
clone()
Creates a deep copy of this node, where all nodes have a new IDs.
|
|
forEachChild(func)
Iterator.
|
|
forEachDescendant(func)
Iterator.
|
|
<static> |
mindmaps.Node.fromJSON(json)
Creates a new node object from JSON String.
|
<static> |
mindmaps.Node.fromObject(obj)
Creates a new node object from a generic object.
|
Gets the caption for the node.
|
|
getChildren(recursive)
Gets the children of the node.
|
|
getDepth()
Gets the depth of the node.
|
|
Returns the parent node.
|
|
Gets the position of the node relative to the root.
|
|
getRoot()
Returns the root if this node is part of a tree structure, otherwise it
returns itself.
|
|
isDescendant(other)
Tests (depth-first) whether the other node is a descendant of this node.
|
|
isLeaf()
Returns whether this node is a leaf.
|
|
isRoot()
Returns whether this node is a root.
|
|
removeChild(node)
Removes a direct child.
|
|
Creates a JSON representation of the node.
|
|
setCaption(caption)
Sets the caption for the node
|
|
<private> |
toJSON()
Returns a presentation of this node and its children ready for serialization.
|
Method Detail
addChild(node)
Adds a child to the node.
- Parameters:
- {mindmaps.Node} node
{mindmaps.Node}
clone()
Creates a deep copy of this node, where all nodes have a new IDs.
- Returns:
- {mindmaps.Node} the cloned node
forEachChild(func)
Iterator. Traverses all child nodes.
- Parameters:
- {Function} func
forEachDescendant(func)
Iterator. Traverses all child nodes recursively.
- Parameters:
- {Function} func
<static>
{mindmaps.Node}
mindmaps.Node.fromJSON(json)
Creates a new node object from JSON String.
- Parameters:
- {String} json
- Returns:
- {mindmaps.Node}
<static>
{mindmaps.Node}
mindmaps.Node.fromObject(obj)
Creates a new node object from a generic object.
- Parameters:
- {Object} obj
- Returns:
- {mindmaps.Node}
{String}
getCaption()
Gets the caption for the node.
- Returns:
- {String}
{Array}
getChildren(recursive)
Gets the children of the node. Traverses the whole sub tree if recursive is
true.
- Parameters:
- recursive
- Returns:
- {Array}
{Number}
getDepth()
Gets the depth of the node. Root has a depth of 0.
- Returns:
- {Number}
{mindmaps.Node}
getParent()
Returns the parent node.
- Returns:
- {mindmaps.Node}
{Number}
getPosition()
Gets the position of the node relative to the root.
- Returns:
- {Number}
{mindmaps.Node}
getRoot()
Returns the root if this node is part of a tree structure, otherwise it
returns itself.
- Returns:
- {mindmaps.Node} The root of the tree structure.
{Boolean}
isDescendant(other)
Tests (depth-first) whether the other node is a descendant of this node.
- Parameters:
- {mindmaps.Node} other
- Returns:
- {Boolean} true if descendant, false otherwise.
{Boolean}
isLeaf()
Returns whether this node is a leaf.
- Returns:
- {Boolean}
{Boolean}
isRoot()
Returns whether this node is a root.
- Returns:
- {Boolean}
removeChild(node)
Removes a direct child.
- Parameters:
- {mindmaps.Node} node
{String}
serialize()
Creates a JSON representation of the node.
- Returns:
- {String}
setCaption(caption)
Sets the caption for the node
- Parameters:
- {String} caption
<private>
toJSON()
Returns a presentation of this node and its children ready for serialization.
Called by JSON.stringify().