Packageweavejs.util
Classpublic class WeaveTreeItem
InheritanceWeaveTreeItem Inheritance Object
Subclasses WeaveMenuItem

Facilitates the creation of dynamic trees.



Public Properties
 PropertyDefined By
  cacheSettings : Object
Maps a property name to a Boolean which enables or disables caching for that property.
WeaveTreeItem
  children : *
Gets the Array of child menu items and modifies it in place if necessary to create nodes from descriptors or remove null items.
WeaveTreeItem
  data : Object = null
This can be any data associated with this tree item.
WeaveTreeItem
  dependency : ILinkableObject
A pointer to the ILinkableObject that created this node.
WeaveTreeItem
  label : *
This can be set to either a String or a Function.
WeaveTreeItem
Protected Properties
 PropertyDefined By
  _cache : Object
Cached values that get invalidated when the source triggers callbacks.
WeaveTreeItem
  childItemClass : Class
Set this to change the constructor used for initializing child items.
WeaveTreeItem
  _children : * = null
WeaveTreeItem
  _counter : Object
Cached values of getCallbackCollection(source).triggerCounter.
WeaveTreeItem
  _dependency : ILinkableObject = null
WeaveTreeItem
  _label : *
WeaveTreeItem
  _recursion : Object
WeaveTreeItem
Public Methods
 MethodDefined By
  
WeaveTreeItem(params:Object = null)
Constructs a new WeaveTreeItem.
WeaveTreeItem
  
createItems(WeaveTreeItem_implementation:Class, items:Array):Array
[static] Initializes an Array of WeaveTreeItems using an Array of objects to pass to the constructor.
WeaveTreeItem
Protected Methods
 MethodDefined By
  
_mapItem(WeaveTreeItem_implementation:Class, item:Object):Object
[static] Used for mapping an Array of params objects to an Array of WeaveTreeItem objects.
WeaveTreeItem
  
cache(id:String, newValue:*):*
Retrieves or updates a cached value for a property.
WeaveTreeItem
  
evalFunction(func:Function):*
First tries calling a function with no parameters.
WeaveTreeItem
  
getBoolean(param:*, recursionName:String):*
Computes a Boolean value from various structures
WeaveTreeItem
  
getObject(param:*, recursionName:String):*
Evaluates a function to get an Object or just returns the non-Function Object passed in.
WeaveTreeItem
  
getString(param:*, recursionName:String):*
Gets a String value from a String or Function.
WeaveTreeItem
  
isCached(id:String):Boolean
Checks if cached value is valid.
WeaveTreeItem
  
isSimpleObject(object:*, singlePropertyName:String):Boolean
Checks if an object has a single specified property.
WeaveTreeItem
Property Detail
_cacheproperty
protected var _cache:Object

Cached values that get invalidated when the source triggers callbacks.

_childrenproperty 
protected var _children:* = null

_counterproperty 
protected var _counter:Object

Cached values of getCallbackCollection(source).triggerCounter.

_dependencyproperty 
protected var _dependency:ILinkableObject = null

_labelproperty 
protected var _label:*

_recursionproperty 
protected var _recursion:Object

cacheSettingsproperty 
public var cacheSettings:Object

Maps a property name to a Boolean which enables or disables caching for that property.

childItemClassproperty 
protected var childItemClass:Class

Set this to change the constructor used for initializing child items. This variable is intentionally uninitialized to avoid overwriting the value set by an extending class in its constructor.

childrenproperty 
children:*

Gets the Array of child menu items and modifies it in place if necessary to create nodes from descriptors or remove null items. If this tree item specifies a dependency, the Array can be filled asynchronously. This property is checked by Flex's default data descriptor.


Implementation
    public function get children():*
    public function set children(value:any):void
dataproperty 
public var data:Object = null

This can be any data associated with this tree item. For example, it can be used to store state information if the tree is populated asynchronously.

dependencyproperty 
dependency:ILinkableObject

A pointer to the ILinkableObject that created this node. This is used to determine when to invalidate cached values.


Implementation
    public function get dependency():ILinkableObject
    public function set dependency(value:ILinkableObject):void
labelproperty 
label:*

This can be set to either a String or a Function. This property is checked by Flex's default data descriptor. If this property is not set, the data property will be used as the label.


Implementation
    public function get label():*
    public function set label(value:any):void
Constructor Detail
WeaveTreeItem()Constructor
public function WeaveTreeItem(params:Object = null)

Constructs a new WeaveTreeItem.

Parameters
params:Object (default = null) — An Object containing property values to set on the WeaveTreeItem. If params is a String, both label and data will be set to that String.
Method Detail
_mapItem()method
protected static function _mapItem(WeaveTreeItem_implementation:Class, item:Object):Object

Used for mapping an Array of params objects to an Array of WeaveTreeItem objects.

Parameters

WeaveTreeItem_implementation:Class — The implementation of WeaveTreeItem to use.
 
item:Object — Item descriptors.

Returns
Object
cache()method 
protected function cache(id:String, newValue:*):*

Retrieves or updates a cached value for a property. Does not cache the value if the source property is not set.

Parameters

id:String — A string identifying a property.
 
newValue:* (default = NaN) — Optional new value to cache for the property.

Returns
* — The new or existing value for the property.
createItems()method 
public static function createItems(WeaveTreeItem_implementation:Class, items:Array):Array

Initializes an Array of WeaveTreeItems using an Array of objects to pass to the constructor. Any Arrays passed in will be flattened.

Parameters

WeaveTreeItem_implementation:Class — The implementation of WeaveTreeItem to use.
 
items:Array — Item descriptors.

Returns
Array
evalFunction()method 
protected function evalFunction(func:Function):*

First tries calling a function with no parameters. If an ArgumentError is thrown, the function will called again, passing this WeaveTreeItem as the first parameter.

Parameters

func:Function

Returns
*
getBoolean()method 
protected function getBoolean(param:*, recursionName:String):*

Computes a Boolean value from various structures

Parameters

param:* — Either a Boolean, and Object like {not: param}, a Function, an ILinkableVariable, or an Array of those objects.
 
recursionName:String — A name used to keep track of recursion.

Returns
* — A Boolean value derived from the param, or the param itself if called recursively.
getObject()method 
protected function getObject(param:*, recursionName:String):*

Evaluates a function to get an Object or just returns the non-Function Object passed in.

Parameters

param:* — Either an Object or a Function.
 
recursionName:String — A name used to keep track of recursion.

Returns
* — An Object derived from the param, or the param itself if called recursively.
getString()method 
protected function getString(param:*, recursionName:String):*

Gets a String value from a String or Function.

Parameters

param:* — Either a String or a Function.
 
recursionName:String — A name used to keep track of recursion.

Returns
* — A String value derived from the param, or the param itself if called recursively.
isCached()method 
protected function isCached(id:String):Boolean

Checks if cached value is valid. Always returns false if the source property is not set.

Parameters

id:String — A string identifying a property.

Returns
Boolean — true if the property value has been cached.
isSimpleObject()method 
protected function isSimpleObject(object:*, singlePropertyName:String):Boolean

Checks if an object has a single specified property.

Parameters

object:*
 
singlePropertyName:String

Returns
Boolean