Packagecom.yworks.graph.model
Interfacepublic interface INodeHierarchy extends flash.events.IEventDispatcher, ILookup
Implementors DefaultNodeHierarchy

The interface that models an observable tree-like hierarchy.



Public Properties
 PropertyDefined By
  root : INode
[read-only] Gets the root node of the hierarchy.
INodeHierarchy
Public Methods
 MethodDefined By
  
addChild(parent:INode, child:INode):void
Modifies the hierarchy by adding another child to the given parent.
INodeHierarchy
  
contains(item:INode):Boolean
Determines whether the given node is part of this hierarchy.
INodeHierarchy
  
getChildCount(parent:INode):int
Returns the number of children for the given parent item.
INodeHierarchy
  
Returns an iterable over the children of the provided item.
INodeHierarchy
  
Returns the parent item of the item or root if child is a top-level item.
INodeHierarchy
  
isLeaf(item:INode):Boolean
Returns whether the given item is considered a leaf item.
INodeHierarchy
 Inherited
lookup(type:Class):Object
Returns an instance that implements the given type or null.
ILookup
  
Triggers the firing of an itemChanged event for the given node.
INodeHierarchy
  
remove(child:INode):void
Removes the given item from its parent and this hierarchy.
INodeHierarchy
  
setLeaf(item:INode, leaf:Boolean):void
Determines whether the given item should be considered a leaf.
INodeHierarchy
  
setParent(child:INode, parent:INode):void
Reparents a child item that already belongs to this hierarchy instance to a new parent.
INodeHierarchy
Events
 Event Summary Defined By
  Event that will be triggered if an item has been added to the model.INodeHierarchy
  Event that will be triggered if an item has changed somehow in the model.INodeHierarchy
  Event that will be triggered if an item has been reparented in the model.INodeHierarchy
  Event that will be triggered if an item has been removed from the model.INodeHierarchy
Property Detail
rootproperty
root:INode  [read-only]

Gets the root node of the hierarchy.


Implementation
    public function get root():INode

See also

Method Detail
addChild()method
public function addChild(parent:INode, child:INode):void

Modifies the hierarchy by adding another child to the given parent.

child may not be part of the hierarchy prior to this call. This triggers the itemAdded event.

Parameters

parent:INode — The parent to add the child to.
 
child:INode — The child to add to the parent.

contains()method 
public function contains(item:INode):Boolean

Determines whether the given node is part of this hierarchy.

Parameters

item:INode — The node to check

Returns
Boolean — Whether the node is contained in the hierarchy.
getChildCount()method 
public function getChildCount(parent:INode):int

Returns the number of children for the given parent item.

Parameters

parent:INode — The parent to get the number of child items for.

Returns
int — The number of children.

See also

getChildren()method 
public function getChildren(item:INode):Iterable

Returns an iterable over the children of the provided item.

Parameters

item:INode — The item for which to return the children.

Returns
Iterable — All items that have item as their parent.

See also

getParent()method 
public function getParent(child:INode):INode

Returns the parent item of the item or root if child is a top-level item.

Parameters

child:INode — The item to retrieve the parent item for.

Returns
INode — The parent item in this hierarchy or root.
isLeaf()method 
public function isLeaf(item:INode):Boolean

Returns whether the given item is considered a leaf item.

Leaves may not have children. However, a non-leaf item does not necessarily need to have children.

Parameters

item:INode — The item to check.

Returns
Boolean — Whether the item is considered a leaf.

See also

publishItemChanged()method 
public function publishItemChanged(item:INode):void

Triggers the firing of an itemChanged event for the given node.

Parameters

item:INode — The item that has changed.

remove()method 
public function remove(child:INode):void

Removes the given item from its parent and this hierarchy.

This will trigger the itemRemoved event.

Parameters

child:INode — The child to remove from this hierarchy.

setLeaf()method 
public function setLeaf(item:INode, leaf:Boolean):void

Determines whether the given item should be considered a leaf.

Leaves may not have children. However, a non-leaf item does not necessarily need to have children.

Parameters

item:INode — The item to set.
 
leaf:Boolean — Whether to make the item a leaf.

See also

setParent()method 
public function setParent(child:INode, parent:INode):void

Reparents a child item that already belongs to this hierarchy instance to a new parent.

This will trigger the itemMoved event. Note that child may not be an ancestor of parent.

Parameters

child:INode — The child to reparent.
 
parent:INode — The new parent.

Event Detail
ItemAdded Event
Event Object Type: com.yworks.graph.model.NodeHierarchyEvent
NodeHierarchyEvent.type property = com.yworks.graph.model.NodeHierarchyEvent.ITEM_ADDED

Event that will be triggered if an item has been added to the model.

Event that will be triggered if an item has been added to a hierarchy model.
ItemChanged Event  
Event Object Type: com.yworks.graph.model.NodeHierarchyEvent
NodeHierarchyEvent.type property = com.yworks.graph.model.NodeHierarchyEvent.ITEM_CHANGED

Event that will be triggered if an item has changed somehow in the model.

This excludes structural changes.

Event that will be triggered if an item has changed somehow in a hierarchy model.
ItemMoved Event  
Event Object Type: com.yworks.graph.model.NodeHierarchyEvent
NodeHierarchyEvent.type property = com.yworks.graph.model.NodeHierarchyEvent.ITEM_MOVED

Event that will be triggered if an item has been reparented in the model.

Event that will be triggered if an item has been reparented in a hierarchy model.
ItemRemoved Event  
Event Object Type: com.yworks.graph.model.NodeHierarchyEvent
NodeHierarchyEvent.type property = com.yworks.graph.model.NodeHierarchyEvent.ITEM_REMOVED

Event that will be triggered if an item has been removed from the model.

Event that will be triggered if an item has been removed from a hierarchy model.