Packagetwaver
Classpublic class ElementBox
InheritanceElementBox Inheritance DataBox Inheritance flash.events.EventDispatcher
Implements IStyle

Element box is the element container. All elements like node, link, group, subnetwork, and all equipment elements are all need to create and add into the element box to mange. As the "model" of the MVC framework, element box in an invisible element class and responsible for actions like add, remove ,clear and indexing elements, monitoring all element property change and data serialization.

Element box has too many things need to manage. So it delegates some tasks to some specific container to do it. An instance of AlarmBox is used to manage all alarm objects for this element box; an instance of SelectionModel is used to manage the selection states for all elements contained in this element box; an instance of LayerBox is used to manage all layers for element box. You can visit all these instances and invoke API on it to do the specific tasks.

Element box contains all element data and drives all connected graphical views like network, tree, table and other components. An element box can drive more than one components to share data for these views. These code can create an element box and connect to a network component:

	 var box:ElementBox = new ElementBox();
	 var node:Node = new Node();
	 box.add(node);
	 //create network and connect to box. 
	 var network:Network = new Network(box);
	 //or:
	 var network:Network = new Network();
	 network.elementBox = box;
	 



Public Properties
 PropertyDefined By
  alarmBox : AlarmBox
[read-only] Get alarm box instance of this element box.
ElementBox
  alarmStatePropagator : AlarmStatePropagator
[read-only] Get alarm state propagator.
ElementBox
 InheritedclientProperties : ICollection
[read-only] Get a ICollection that contians all client proerty name.
DataBox
 Inheritedcount : int
[read-only] Get total data counts contains in this data box.
DataBox
 Inheriteddatas : ICollection
[read-only] Get collection of all data inside the data box.
DataBox
 Inheritedicon : String
Get icon value for this data.
DataBox
  layerBox : LayerBox
[read-only] Get layer box instance of this element box.
ElementBox
 Inheritedlimit : int
Get the limit for this data box.
DataBox
 Inheritedname : String
Get name of this data.
DataBox
 Inheritedroots : ICollection
[read-only] Get all root data objects in this data box.
DataBox
 InheritedselectionModel : SelectionModel
[read-only] Get selection model of this data box.
DataBox
  styleProperties : ICollection
[read-only] Get a ICollection that contians all style proerty name.
ElementBox
 InheritedtoolTip : String
Get the tooltip text of this data.
DataBox
Public Methods
 MethodDefined By
  
ElementBox(elemnetBoxName:String = ElementBox)
Constructor.
ElementBox
  
add(data:IData, index:int = -1):void
[override] Add a data into this data box at the specified index location.
ElementBox
 Inherited
addDataBoxChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add a data box change listener into this data box to monitoring the property change event.
DataBox
 Inherited
addDataPropertyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add data property change listener to this data box.
DataBox
 Inherited
addHierarchyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add a data hierarchical change listener on this data box.
DataBox
  
addIndexChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add an element index change listener.
ElementBox
 Inherited
addPropertyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add property change listener into this data box.
DataBox
 Inherited
clear():void
Clear all data objects.
DataBox
 Inherited
contains(data:IData):Boolean
Check whether contains specified data object in this data box.
DataBox
 Inherited
containsByID(id:Object):Boolean
Check whether contains data object with specified ID value.
DataBox
  
deserializeXML(serializer:XMLSerializer, xml:XML):void
[override] Deserialize given XML data to data objects.
ElementBox
 Inherited
dispatchPropertyChangeEvent(property:String, oldValue:Object, newValue:Object):Boolean
Dispatch property change event to all installed property change listeners.
DataBox
 Inherited
forEach(callbackFunction:Function):void
Iterate all data inside this data box with the specified call back function.
DataBox
 Inherited
forEachByBreadthFirst(callbackFunction:Function, data:IData = null):void
Iterate all inside data in "breadth-first" rule.
DataBox
 Inherited
forEachByDepthFirst(callbackFunction:Function, data:IData = null):void
Iterate all inside data in "depth-first" rule.
DataBox
  
forEachByLayer(callbackFunction:Function, layer:ILayer = null):void
Iterate all elements by specified call back function and layer.
ElementBox
  
forEachByLayerReverse(callbackFunction:Function, layer:ILayer = null):void
Iterate elements in specified layer reversely by specified iterate call back function.
ElementBox
 Inherited
getClient(clientProp:String):*
Get specified client property value.
DataBox
 Inherited
getDataByID(id:Object):IData
Get data object by specified data ID.
DataBox
  
getElementByID(elementID:Object):IElement
Get element by given element ID.
ElementBox
  
getPropertyValue(property:String):Object
[override] Get specified property value from this data.
ElementBox
 Inherited
Get the index of the specified data in all siblings.
DataBox
 Inherited
Get sibling data collection for specified data instance.
DataBox
  
getStyle(styleProp:String, returnDefaultIfNull:Boolean = true):*
Get the specified style property value.
ElementBox
 Inherited
hasOwnProperty(name:String):Boolean
Whether this data has specified property.
DataBox
 Inherited
isEmpty():Boolean
Whether this data box is empty (no data).
DataBox
 Inherited
moveDown(data:IData):void
Move specified data on index lower.
DataBox
 Inherited
Move all selected data to lower index location.
DataBox
 Inherited
Move all selected data to the bottom index location.
DataBox
 Inherited
Move all selected data to the top index location.
DataBox
 Inherited
Move all selected data to upper index location.
DataBox
 Inherited
moveTo(data:IData, newIndex:int):void
Move the specified data to the specified index location.
DataBox
 Inherited
moveToBottom(data:IData):void
Move specified data to the bottom index location.
DataBox
 Inherited
moveToTop(data:IData):void
Move specified data to the top index location.
DataBox
 Inherited
moveUp(data:IData):void
Move specified data one index upper.
DataBox
 Inherited
remove(data:IData):void
Remove specified data from this data box.
DataBox
 Inherited
removeByID(id:Object):void
Remove data by data ID.
DataBox
 Inherited
removeDataBoxChangeListener(listener:Function):void
Remove data box change listener from this data box.
DataBox
 Inherited
removeDataPropertyChangeListener(listener:Function):void
Remove specified data property change listener.
DataBox
 Inherited
removeFirst(count:int = 1):void
Remove the first specified count data objects from this data box.
DataBox
 Inherited
removeHierarchyChangeListener(listener:Function):void
Remove the specified hierarchical change listener from this data box.
DataBox
  
removeIndexChangeListener(listener:Function):void
Remove the specified index change listener from this element box.
ElementBox
 Inherited
removePropertyChangeListener(listener:Function):void
Remove property change listener from this data box.
DataBox
 Inherited
Remove all selected data from this data box.
DataBox
  
Reset BundleLinks, invoke it when Defaults.LINK_BUNDLE_AGENT_FUNCTION changed.
ElementBox
  
serializeXML(serializer:XMLSerializer, newInstance:DataBox):void
[override] Serialize all data contains in this data box into XML.
ElementBox
 Inherited
setClient(clientProp:String, newValue:*):IClient
Set client property for this data.
DataBox
  
setPropertyValue(property:String, value:Object):void
[override] Set specified property name value on this data.
ElementBox
  
setStyle(styleProp:String, newValue:*):IStyle
Set a style for this element.
ElementBox
 Inherited
toDatas(matchFunction:Function = null):ICollection
Create a new collection, put all data inside this collection, and return this collection.
DataBox
 Inherited
toString():String
[override]
DataBox
Protected Methods
 MethodDefined By
 Inherited
deserializeClient(serializer:XMLSerializer, clientXML:XML, clientProp:String):void
Deserialize client property from given XML data.
DataBox
 Inherited
deserializeProperty(serializer:XMLSerializer, propertyXML:XML, property:String):void
Deserialize specified property from the given XML data contains property value.
DataBox
  
deserializeStyle(serializer:XMLSerializer, styleXML:XML, styleProp:String):void
Deserialize style from given XML data.
ElementBox
 Inherited
DataBox
 Inherited
onClientChanged(styleProp:String, oldValue:*, newValue:*):void
Called when client property is changed.
DataBox
  
onDataPropertyChanged(data:IData, e:PropertyChangeEvent):void
[override] Called back when any data property is changed.
ElementBox
 Inherited
onPropertyChanged(property:String, oldValue:Object, newValue:Object):void
Called back when a property of this data is changed.
DataBox
  
onStyleChanged(styleProp:String, oldValue:*, newValue:*):void
Called when style property is changed.
ElementBox
 Inherited
serializeClient(serializer:XMLSerializer, clientPrope:String, newInstance:DataBox):void
Serialize the specified client property into XML.
DataBox
 Inherited
serializeProperty(serializer:XMLSerializer, property:String, newInstance:DataBox):void
Serialize the specified property into XML.
DataBox
  
serializeStyle(serializer:XMLSerializer, stylePrope:String, newInstance:DataBox):void
Serialize specified style property into XML.
ElementBox
Property Detail
alarmBoxproperty
alarmBox:AlarmBox  [read-only]

Get alarm box instance of this element box. Alarm box is used to manage all alarm objects for this element box.


Implementation
    public function get alarmBox():AlarmBox
alarmStatePropagatorproperty 
alarmStatePropagator:AlarmStatePropagator  [read-only]

Get alarm state propagator. The alarm sate propagator is used to propagate alarm state to the business related elements when alarm is occured. By default implementation, TWaver Flex will propagate alarm to the source element's parent, if has, until to null.


Implementation
    public function get alarmStatePropagator():AlarmStatePropagator

See also

layerBoxproperty 
layerBox:LayerBox  [read-only]

Get layer box instance of this element box. Layer box is used to manage all layers for element box.


Implementation
    public function get layerBox():LayerBox
stylePropertiesproperty 
styleProperties:ICollection  [read-only]

Get a ICollection that contians all style proerty name.


Implementation
    public function get styleProperties():ICollection
Constructor Detail
ElementBox()Constructor
public function ElementBox(elemnetBoxName:String = ElementBox)

Constructor. This will create an element box with given element box name.

Parameters
elemnetBoxName:String (default = ElementBox) — the element box name. This will displays on tree component as the root node, if the root node of the tree is visible.
Method Detail
add()method
override public function add(data:IData, index:int = -1):void

Add a data into this data box at the specified index location.

Parameters

data:IData — the data object to be added
 
index:int (default = -1) — the index location need to add

addIndexChangeListener()method 
public function addIndexChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void

Add an element index change listener. It will be notified when any element index are changed.

Parameters

listener:Function — the listener to be added
 
priority:int (default = 0) — listener priority
 
useWeakReference:Boolean (default = false) — whether use weak reference, default value is false.

deserializeStyle()method 
protected function deserializeStyle(serializer:XMLSerializer, styleXML:XML, styleProp:String):void

Deserialize style from given XML data.

Parameters

serializer:XMLSerializer — the XML serializer.
 
styleXML:XML — the XML data contains style data.
 
styleProp:String — style property name.

deserializeXML()method 
override public function deserializeXML(serializer:XMLSerializer, xml:XML):void

Deserialize given XML data to data objects.

Parameters

serializer:XMLSerializer — XML serializer
 
xml:XML — the XML data contains data objects.

forEachByLayer()method 
public function forEachByLayer(callbackFunction:Function, layer:ILayer = null):void

Iterate all elements by specified call back function and layer. If layer is null, then all elements will be iterated.

Parameters

callbackFunction:Function — the iterate call back function.
 
layer:ILayer (default = null) — the layer that elements to be iterated

forEachByLayerReverse()method 
public function forEachByLayerReverse(callbackFunction:Function, layer:ILayer = null):void

Iterate elements in specified layer reversely by specified iterate call back function.

Parameters

callbackFunction:Function — iterator.
 
layer:ILayer (default = null) — layer object indicate only elements inside will be iterated.

getElementByID()method 
public function getElementByID(elementID:Object):IElement

Get element by given element ID.

Parameters

elementID:Object — the element id to be get

Returns
IElement — the element object with specified ID.
getPropertyValue()method 
override public function getPropertyValue(property:String):Object

Get specified property value from this data. This can be a client property, or regular property. For client property, be ware use the Consts.PREFIX_CLIENT prefix to identify.

Parameters

property:String — the property name to get.

Returns
Object — the property value, if has
getStyle()method 
public function getStyle(styleProp:String, returnDefaultIfNull:Boolean = true):*

Get the specified style property value.

Parameters

styleProp:String — the style property name
 
returnDefaultIfNull:Boolean (default = true) — whether return default value if this style is null. default is true.

Returns
* — the style value.
onDataPropertyChanged()method 
override protected function onDataPropertyChanged(data:IData, e:PropertyChangeEvent):void

Called back when any data property is changed. This default implementation does not do anything. Subclasses can overwrite this method to do something when property changed.

Parameters

data:IData — the source data of the change.
 
e:PropertyChangeEvent — the property change event contains all property change information.

onStyleChanged()method 
protected function onStyleChanged(styleProp:String, oldValue:*, newValue:*):void

Called when style property is changed.

Parameters

styleProp:String — the style property name.
 
oldValue:* — the old value before change
 
newValue:* — the new value after change.

removeIndexChangeListener()method 
public function removeIndexChangeListener(listener:Function):void

Remove the specified index change listener from this element box.

Parameters

listener:Function — the index change listener to be removed

resetBundleLinks()method 
public function resetBundleLinks():void

Reset BundleLinks, invoke it when Defaults.LINK_BUNDLE_AGENT_FUNCTION changed.

serializeStyle()method 
protected function serializeStyle(serializer:XMLSerializer, stylePrope:String, newInstance:DataBox):void

Serialize specified style property into XML.

Parameters

serializer:XMLSerializer — XML serializer
 
stylePrope:String — style property name to be serialized
 
newInstance:DataBox — the new instance will be used during serialization

serializeXML()method 
override public function serializeXML(serializer:XMLSerializer, newInstance:DataBox):void

Serialize all data contains in this data box into XML.

Parameters

serializer:XMLSerializer — the XML serializer
 
newInstance:DataBox — a new create data box instance with default values which will be used to compare each property values of the data box during the serialization.

setPropertyValue()method 
override public function setPropertyValue(property:String, value:Object):void

Set specified property name value on this data.

Parameters

property:String — the property name to be set.
 
value:Object — the property value to be set.

setStyle()method 
public function setStyle(styleProp:String, newValue:*):IStyle

Set a style for this element.

Parameters

styleProp:String — the style property name.
 
newValue:* — the style value.

Returns
IStyle — this element itself.