| Package | com.yworks.ui.tree |
| Class | public class HierarchyTreeView |
| Inheritance | HierarchyTreeView Object |
| Implements | mx.collections.ICollectionView, mx.core.IMXMLObject |
INodeHierarchy in a
mx.controls.Tree.
Instances of this class can be installed as a dataProvider which represents
a given INodeHierarchy to a Tree.
var htv:HierarchyTreeView = new HierarchyTreeView();
htv.graphCanvasComponent = graphCanvasComponent;
tree.dataProvider = htv;
<mx:Tree>
<mx:dataProvider>
<tree:HierarchyTreeView id="htv" graphCanvasComponent="graphCanvas"/>
</mx:dataProvider>
</mx:Tree>
If the HierarchyTreeView is intended to display flat graphs,
DefaultGraph's groupingSupported property must
be set to true, anyhow, otherwise there will be no INodeHierarchy
available.
The HierarchyTreeView can also serve as data provider for
mx.contrlos.Lists. Note, that in this case only the nodes in the root
will be displayed.
| Property | Defined By | ||
|---|---|---|---|
| filterFunction : Function
The filter to apply. | HierarchyTreeView | ||
| graphCanvas : GraphCanvasComponent [write-only]
The GraphCanvasComponent whose graph is
this instance's model. | HierarchyTreeView | ||
| labelFunction : Function
A user-supplied function to run on each item to determine its label. | HierarchyTreeView | ||
| length : int [read-only]
The number of children of the root. | HierarchyTreeView | ||
| model : INodeHierarchy
The model to be used with this instance. | HierarchyTreeView | ||
| sort : Sort
The sorting function to apply. | HierarchyTreeView | ||
| Method | Defined By | ||
|---|---|---|---|
HierarchyTreeView(tree:Tree = null, model:INodeHierarchy = null)
Creates a new instance. | HierarchyTreeView | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Adds an EventListener. | HierarchyTreeView | ||
contains(item:Object):Boolean
Whether the given Object is a child of the root. | HierarchyTreeView | ||
createCursor():IViewCursor
A cursor over the root elements. | HierarchyTreeView | ||
disableAutoUpdate():void
Disables automatic update. | HierarchyTreeView | ||
dispatchEvent(event:Event):Boolean
Dispatches the given event. | HierarchyTreeView | ||
enableAutoUpdate():void
Enables automatic update. | HierarchyTreeView | ||
Returns the TreeNode representation of a given node. | HierarchyTreeView | ||
hasEventListener(type:String):Boolean
Whether an event listener for the given type is registered. | HierarchyTreeView | ||
initialized(document:Object, id:String):void
Called after the implementing object has been created and all
component properties specified on the MXML tag have been initialized. | HierarchyTreeView | ||
itemUpdated(item:Object, property:Object = null, oldValue:Object = null, newValue:Object = null):void
Called when an item is updated. | HierarchyTreeView | ||
publishItemChanged(kind:String = null, location:int = -1, oldLocation:int = -1, items:Array = null):void
Forces a repaint. | HierarchyTreeView | ||
refresh():Boolean
Refresh the view. | HierarchyTreeView | ||
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes an event listener. | HierarchyTreeView | ||
willTrigger(type:String):Boolean
Whether this implementation can dispatch events of the given type. | HierarchyTreeView | ||
| Method | Defined By | ||
|---|---|---|---|
Callback when the graph property of the graphCanvasComponent
changed. | HierarchyTreeView | ||
treeLabelFunction(item:Object):String
Delegate function which is returns a String representation of the given item to be displayed
in the tree view. | HierarchyTreeView | ||
| filterFunction | property |
filterFunction:FunctionThe filter to apply. By default, no filter is applied
public function get filterFunction():Function public function set filterFunction(value:Function):voidSee also
| graphCanvas | property |
graphCanvas:GraphCanvasComponent [write-only]
The GraphCanvasComponent whose graph is
this instance's model.
public function set graphCanvas(value:GraphCanvasComponent):void| labelFunction | property |
labelFunction:FunctionA user-supplied function to run on each item to determine its label.
The label function takes a single argument which is the item, represented by a TreeNode,
and returns a String:
myLabelFunction(item:Object):StringThe actual node can be found in the
TreeNode's item property.
After setting this property to a new value, publishItemChanged() will be called
in order to redraw the tree.
The default value is this.treeLabelFunction.
public function get labelFunction():Function public function set labelFunction(value:Function):voidSee also
| length | property |
length:int [read-only] The number of children of the root.
public function get length():intSee also
| model | property |
model:INodeHierarchy
The model to be used with this instance. Usually the INodeHierarchy
of the current grouped graph.
Setting the graphCanvasComponent property will automatically set
this property, too.
public function get model():INodeHierarchy public function set model(value:INodeHierarchy):void| sort | property |
sort:SortThe sorting function to apply. By default, no sorting is applied.
public function get sort():Sort public function set sort(value:Sort):voidSee also
| HierarchyTreeView | () | Constructor |
public function HierarchyTreeView(tree:Tree = null, model:INodeHierarchy = null)Creates a new instance.
The recommended use is to use the standard constructor and set the created instance
as dataProvider to the tree and the graphCanvasComponent
property to the current GraphCanvasComponent.
For backward compatibility, it is possible to pass a Tree. The new instance
will install itself to that tree as dataProvider representing the given
INodeHierarchy.
tree:Tree (default = null) — The tree to initialize.
| |
model:INodeHierarchy (default = null) — The INodeHierarchy to represent. Usually the
INodeHierarchy of the current grouped graph.
|
| addEventListener | () | method |
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):voidAdds an EventListener.
Parameters
type:String | |
listener:Function | |
useCapture:Boolean (default = false) | |
priority:int (default = 0) | |
useWeakReference:Boolean (default = false) |
See also
| contains | () | method |
public function contains(item:Object):BooleanWhether the given Object is a child of the root.
Parameters
item:Object — The item to check.
|
Boolean — true if the given item is child of the root.
|
See also
| createCursor | () | method |
public function createCursor():IViewCursorA cursor over the root elements.
ReturnsIViewCursor — A cursor over the view.
|
See also
| disableAutoUpdate | () | method |
public function disableAutoUpdate():voidDisables automatic update.
See also
| dispatchEvent | () | method |
public function dispatchEvent(event:Event):BooleanDispatches the given event.
Parameters
event:Event |
Boolean —
|
See also
| enableAutoUpdate | () | method |
public function enableAutoUpdate():voidEnables automatic update.
See also
| findNode | () | method |
public function findNode(node:INode):TreeNode
Returns the TreeNode representation of a given node.
Parameters
node:INode — The node to search the TreeNode representation for.
|
TreeNode — The TreeNode which represents the given node or null.
|
| hasEventListener | () | method |
public function hasEventListener(type:String):BooleanWhether an event listener for the given type is registered.
Parameters
type:String |
Boolean —
|
See also
| initialized | () | method |
public function initialized(document:Object, id:String):voidCalled after the implementing object has been created and all component properties specified on the MXML tag have been initialized.
This implementation does nothing.
Parameters
document:Object — The MXML document that created this object.
| |
id:String — The identifier used by document to refer
to this object.
If the object is a deep property on document,
id is null.
|
| itemUpdated | () | method |
public function itemUpdated(item:Object, property:Object = null, oldValue:Object = null, newValue:Object = null):voidCalled when an item is updated.
Parameters
item:Object | |
property:Object (default = null) | |
oldValue:Object (default = null) | |
newValue:Object (default = null) |
See also
| onGraphChanged | () | method |
protected function onGraphChanged(oldGraph:IGraph, newGraph:IGraph):void
Callback when the graph property of the graphCanvasComponent
changed.
Parameters
oldGraph:IGraph — The graph before the change.
| |
newGraph:IGraph — The current graph.
|
| publishItemChanged | () | method |
public function publishItemChanged(kind:String = null, location:int = -1, oldLocation:int = -1, items:Array = null):voidForces a repaint.
Parameters
kind:String (default = null) | |
location:int (default = -1) | |
oldLocation:int (default = -1) | |
items:Array (default = null) |
| refresh | () | method |
public function refresh():BooleanRefresh the view.
ReturnsBoolean |
See also
| removeEventListener | () | method |
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):voidRemoves an event listener.
Parameters
type:String | |
listener:Function | |
useCapture:Boolean (default = false) |
See also
| treeLabelFunction | () | method |
protected function treeLabelFunction(item:Object):StringDelegate function which is returns a String representation of the given item to be displayed in the tree view.
This implementation returns the text of the first label of the node if there is one. Otherwise it returns an empty String.
Parameters
item:Object — A TreeNode with the item to get the text for.
|
String — A String representation of the given item.
|
See also
| willTrigger | () | method |
public function willTrigger(type:String):BooleanWhether this implementation can dispatch events of the given type.
Parameters
type:String |
Boolean —
|
See also