Packagetwaver
Classpublic class LayerBox
InheritanceLayerBox Inheritance DataBox Inheritance flash.events.EventDispatcher

This layer box is a special data box manages layer objects for an element box. As an important part of element box, layer box manages all layers for this element box. Layers can be moved up and down, add or remove, visible or hide, visit and iterate. Upper layer will in front of other lower layer.

A special layer is pre-created in this layer box. Any element without layer id specified are located in this this default layer. use defaultLayer to visit the default layer.

Remove a layer will not cause all contained element removed from element box.

Layer box must work with an element box. Specify the element box in layer box constructor to connect them. However you don't need to create layer box normally, because element box will create a layer box internally and automatically. Visit layer box of an element box by layerBox.

See also

twaver.ElementBox
twaver.Layer
twaver.DataBox


Public Properties
 PropertyDefined By
 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
  defaultLayer : ILayer
[read-only] Get the default layer object.
LayerBox
  elementBox : ElementBox
[read-only] Get connected element box.
LayerBox
 Inheritedicon : String
Get icon value for this data.
DataBox
 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
 InheritedtoolTip : String
Get the tooltip text of this data.
DataBox
Public Methods
 MethodDefined By
  
LayerBox(elementBox:ElementBox)
Create layer box and connect it to the specified element box.
LayerBox
  
add(data:IData, index:int = -1):void
[override] Add a data into this data box at the specified index location.
LayerBox
 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
 Inherited
addPropertyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add property change listener into this data box.
DataBox
  
clear():void
[override] Clear all data objects.
LayerBox
 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
 Inherited
deserializeXML(serializer:XMLSerializer, xml:XML):void
Deserialize given XML data to data objects.
DataBox
 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
 Inherited
getClient(clientProp:String):*
Get specified client property value.
DataBox
 Inherited
getDataByID(id:Object):IData
Get data object by specified data ID.
DataBox
  
Get the layer contains specified element.
LayerBox
  
getLayerByID(layerID:Object):ILayer
Get layer by layer ID.
LayerBox
 Inherited
getPropertyValue(property:String):Object
Get specified property value from this data.
DataBox
 Inherited
Get the index of the specified data in all siblings.
DataBox
 Inherited
Get sibling data collection for specified data instance.
DataBox
 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
  
removeByID(id:Object):void
[override] Remove data by data ID.
LayerBox
 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
 Inherited
removePropertyChangeListener(listener:Function):void
Remove property change listener from this data box.
DataBox
 Inherited
Remove all selected data from this data box.
DataBox
 Inherited
serializeXML(serializer:XMLSerializer, newInstance:DataBox):void
Serialize all data contains in this data box into XML.
DataBox
 Inherited
setClient(clientProp:String, newValue:*):IClient
Set client property for this data.
DataBox
 Inherited
setPropertyValue(property:String, value:Object):void
Set specified property name value on this data.
DataBox
 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
 Inherited
DataBox
 Inherited
onClientChanged(styleProp:String, oldValue:*, newValue:*):void
Called when client property is changed.
DataBox
 Inherited
onDataPropertyChanged(data:IData, e:PropertyChangeEvent):void
Called back when any data property is changed.
DataBox
 Inherited
onPropertyChanged(property:String, oldValue:Object, newValue:Object):void
Called back when a property of this data is changed.
DataBox
 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
Property Detail
defaultLayerproperty
defaultLayer:ILayer  [read-only]

Get the default layer object. Default layer contains all elements without layer id specified.


Implementation
    public function get defaultLayer():ILayer
elementBoxproperty 
elementBox:ElementBox  [read-only]

Get connected element box.


Implementation
    public function get elementBox():ElementBox
Constructor Detail
LayerBox()Constructor
public function LayerBox(elementBox:ElementBox)

Create layer box and connect it to the specified element box. This created layer box will work for this element box. It will manages all layers for this element box.

Parameters
elementBox:ElementBox — the element box this layer box works for.
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

clear()method 
override public function clear():void

Clear all data objects. This will remove all data from this data box.

getLayerByElement()method 
public function getLayerByElement(element:IElement):ILayer

Get the layer contains specified element.

Parameters

element:IElement — the element to check

Returns
ILayer — the layer contains specified element.
getLayerByID()method 
public function getLayerByID(layerID:Object):ILayer

Get layer by layer ID.

Parameters

layerID:Object — a layer id

Returns
ILayer — the layer with specified id value.
removeByID()method 
override public function removeByID(id:Object):void

Remove data by data ID.

Parameters

id:Object — the data ID that need to remove