Package | twaver |
Class | public class DataBox |
Inheritance | DataBox ![]() |
Implements | IClient |
Subclasses | AlarmBox, ElementBox, LayerBox |
Data
objects.
Data box is an invisible data container working as the "model"
in TWaver Flex MVC framework. Data box manages all contained data instances
and monitoring the property change events. It provides data for all views
like network, tree, table and all other graphic components. DataBox
has simple properties like icon, name. It also has selection model
used to manage data selection for all managed data.
Property | Defined By | ||
---|---|---|---|
clientProperties : ICollection [read-only]
Get a ICollection that contians all client proerty name. | DataBox | ||
count : int [read-only]
Get total data counts contains in this data box. | DataBox | ||
datas : ICollection [read-only]
Get collection of all data inside the data box. | DataBox | ||
icon : String
Get icon value for this data. | DataBox | ||
limit : int
Get the limit for this data box. | DataBox | ||
name : String
Get name of this data. | DataBox | ||
roots : ICollection [read-only]
Get all root data objects in this data box. | DataBox | ||
selectionModel : SelectionModel [read-only]
Get selection model of this data box. | DataBox | ||
toolTip : String
Get the tooltip text of this data. | DataBox |
Method | Defined By | ||
---|---|---|---|
DataBox(name:String = DataBox)
Constructor. | DataBox | ||
Add a data into this data box at the specified index location. | DataBox | ||
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 | ||
addDataPropertyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add data property change listener to this data box. | DataBox | ||
addHierarchyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add a data hierarchical change listener on this data box. | DataBox | ||
addPropertyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add property change listener into this data box. | DataBox | ||
clear():void
Clear all data objects. | DataBox | ||
Check whether contains specified data object in this data box. | DataBox | ||
containsByID(id:Object):Boolean
Check whether contains data object with specified ID value. | DataBox | ||
deserializeXML(serializer:XMLSerializer, xml:XML):void
Deserialize given XML data to data objects. | DataBox | ||
dispatchPropertyChangeEvent(property:String, oldValue:Object, newValue:Object):Boolean
Dispatch property change event to all installed property change listeners. | DataBox | ||
forEach(callbackFunction:Function):void
Iterate all data inside this data box with the specified
call back function. | DataBox | ||
forEachByBreadthFirst(callbackFunction:Function, data:IData = null):void
Iterate all inside data in "breadth-first" rule. | DataBox | ||
forEachByDepthFirst(callbackFunction:Function, data:IData = null):void
Iterate all inside data in "depth-first" rule. | DataBox | ||
getClient(clientProp:String):*
Get specified client property value. | DataBox | ||
getDataByID(id:Object):IData
Get data object by specified data ID. | DataBox | ||
getPropertyValue(property:String):Object
Get specified property value from this data. | DataBox | ||
getSiblingIndex(data:IData):int
Get the index of the specified data in all siblings. | DataBox | ||
Get sibling data collection for specified data instance. | DataBox | ||
hasOwnProperty(name:String):Boolean
Whether this data has specified property. | DataBox | ||
isEmpty():Boolean
Whether this data box is empty (no data). | DataBox | ||
Move specified data on index lower. | DataBox | ||
moveSelectionDown(sm:SelectionModel = null):void
Move all selected data to lower index location. | DataBox | ||
moveSelectionToBottom(sm:SelectionModel = null):void
Move all selected data to the bottom index location. | DataBox | ||
moveSelectionToTop(sm:SelectionModel = null):void
Move all selected data to the top index location. | DataBox | ||
moveSelectionUp(sm:SelectionModel = null):void
Move all selected data to upper index location. | DataBox | ||
Move the specified data to the specified index location. | DataBox | ||
moveToBottom(data:IData):void
Move specified data to the bottom index location. | DataBox | ||
Move specified data to the top index location. | DataBox | ||
Move specified data one index upper. | DataBox | ||
Remove specified data from this data box. | DataBox | ||
removeByID(id:Object):void
Remove data by data ID. | DataBox | ||
removeDataBoxChangeListener(listener:Function):void
Remove data box change listener from this data box. | DataBox | ||
removeDataPropertyChangeListener(listener:Function):void
Remove specified data property change listener. | DataBox | ||
removeFirst(count:int = 1):void
Remove the first specified count data objects from this data box. | DataBox | ||
removeHierarchyChangeListener(listener:Function):void
Remove the specified hierarchical change listener from this data box. | DataBox | ||
removePropertyChangeListener(listener:Function):void
Remove property change listener from this data box. | DataBox | ||
removeSelection():void
Remove all selected data from this data box. | DataBox | ||
Serialize all data contains in this data box into XML. | DataBox | ||
Set client property for this data. | DataBox | ||
setPropertyValue(property:String, value:Object):void
Set specified property name value on this data. | DataBox | ||
toDatas(matchFunction:Function = null):ICollection
Create a new collection, put all data inside this collection,
and return this collection. | DataBox | ||
toString():String [override]
| DataBox |
Method | Defined By | ||
---|---|---|---|
deserializeClient(serializer:XMLSerializer, clientXML:XML, clientProp:String):void
Deserialize client property from given XML data. | DataBox | ||
deserializeProperty(serializer:XMLSerializer, propertyXML:XML, property:String):void
Deserialize specified property from the given XML data contains property value. | DataBox | ||
handleImageLoaded(e:ImageLoadEvent):void | DataBox | ||
onClientChanged(styleProp:String, oldValue:*, newValue:*):void
Called when client property is changed. | DataBox | ||
onDataPropertyChanged(data:IData, e:PropertyChangeEvent):void
Called back when any data property is changed. | DataBox | ||
onPropertyChanged(property:String, oldValue:Object, newValue:Object):void
Called back when a property of this data is changed. | DataBox | ||
Serialize the specified client property into XML. | DataBox | ||
Serialize the specified property into XML. | DataBox |
clientProperties | property |
clientProperties:ICollection
[read-only] Get a ICollection that contians all client proerty name.
public function get clientProperties():ICollection
count | property |
count:int
[read-only] Get total data counts contains in this data box.
public function get count():int
datas | property |
datas:ICollection
[read-only] Get collection of all data inside the data box.
public function get datas():ICollection
icon | property |
icon:String
Get icon value for this data. Please note the difference between icon and image of this data.
public function get icon():String
public function set icon(value:String):void
limit | property |
limit:int
Get the limit for this data box. Default value is -1, means no limit. Once the limit set, data box will keep data count not bigger than this number. If the limit is reached, adding a new data will remove the oldest data instance.
public function get limit():int
public function set limit(value:int):void
name | property |
name:String
Get name of this data.
public function get name():String
public function set name(value:String):void
roots | property |
roots:ICollection
[read-only] Get all root data objects in this data box. Root data refer to the data without parent.
public function get roots():ICollection
selectionModel | property |
selectionModel:SelectionModel
[read-only] Get selection model of this data box.
public function get selectionModel():SelectionModel
toolTip | property |
toolTip:String
Get the tooltip text of this data.
public function get toolTip():String
public function set toolTip(value:String):void
DataBox | () | Constructor |
public function DataBox(name:String = DataBox)
Constructor.
Parametersname:String (default = DataBox ) — data box name
|
add | () | method |
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
|
addDataBoxChangeListener | () | method |
public function 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.
Parameters
listener:Function — the data box change listener object
| |
priority:int (default = 0 ) — listening priority
| |
useWeakReference:Boolean (default = false ) — whether use weak reference. Default value is false.
|
addDataPropertyChangeListener | () | method |
public function addDataPropertyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add data property change listener to this data box. This listener will be notified when any property of data changed.
Parameters
listener:Function — the data box property change listener to be added
| |
priority:int (default = 0 ) — the listening priority
| |
useWeakReference:Boolean (default = false ) — whether use weak reference. Default value is false.
|
addHierarchyChangeListener | () | method |
public function addHierarchyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add a data hierarchical change listener on this data box.
Parameters
listener:Function — the data hierarchical change listener to be added
| |
priority:int (default = 0 ) — the listening priority
| |
useWeakReference:Boolean (default = false ) — whether use weak reference. Default false.
|
addPropertyChangeListener | () | method |
public function addPropertyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add property change listener into this data box. Any property of this data box changed, the listener will be notified.
Parameters
listener:Function — the listener to be installed
| |
priority:int (default = 0 ) — the listening priority
| |
useWeakReference:Boolean (default = false ) — whether use weak reference. Default value is false.
|
clear | () | method |
public function clear():void
Clear all data objects. This will remove all data from this data box.
contains | () | method |
public function contains(data:IData):Boolean
Check whether contains specified data object in this data box.
Parameters
data:IData — the data need to check.
|
Boolean — true if contains, false otherwise.
|
containsByID | () | method |
public function containsByID(id:Object):Boolean
Check whether contains data object with specified ID value.
Parameters
id:Object — the ID value need to check.
|
Boolean — true means contains, false otherwise.
|
deserializeClient | () | method |
protected function deserializeClient(serializer:XMLSerializer, clientXML:XML, clientProp:String):void
Deserialize client property from given XML data.
Parameters
serializer:XMLSerializer — the XML deserializer.
| |
clientXML:XML — XML data contains client property
| |
clientProp:String — client property name.
|
deserializeProperty | () | method |
protected function deserializeProperty(serializer:XMLSerializer, propertyXML:XML, property:String):void
Deserialize specified property from the given XML data contains property value.
Parameters
serializer:XMLSerializer — XML serializer
| |
propertyXML:XML — XML data contains property value
| |
property:String — property name will be deserialized.
|
deserializeXML | () | method |
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.
|
dispatchPropertyChangeEvent | () | method |
public function dispatchPropertyChangeEvent(property:String, oldValue:Object, newValue:Object):Boolean
Dispatch property change event to all installed property change listeners.
Parameters
property:String — the property name changed
| |
oldValue:Object — the old property value before change
| |
newValue:Object — the new property value after change
|
Boolean — true if dispatched, false otherwise.
|
forEach | () | method |
public function forEach(callbackFunction:Function):void
Iterate all data inside this data box with the specified call back function.
Parameters
callbackFunction:Function — the call back function for the iteration
|
forEachByBreadthFirst | () | method |
public function forEachByBreadthFirst(callbackFunction:Function, data:IData = null):void
Iterate all inside data in "breadth-first" rule. If the specified data is not null, then iterate all descendants for this data. Otherwise, iterate all data.
Parameters
callbackFunction:Function — call back function for the iteration
| |
data:IData (default = null ) — the data iterate for. Default value is null, means iterate
all data inside the data box.
|
forEachByDepthFirst | () | method |
public function forEachByDepthFirst(callbackFunction:Function, data:IData = null):void
Iterate all inside data in "depth-first" rule. If the specified data is not null, then iterate all descendants for this data. Otherwise, iterate all data.
Parameters
callbackFunction:Function — call back function for the iteration
| |
data:IData (default = null ) — the data iterate for. Default value is null, means iterate
all data inside the data box.
|
getClient | () | method |
public function getClient(clientProp:String):*
Get specified client property value.
Parameters
clientProp:String — client property name
|
* — value of this client property.
|
getDataByID | () | method |
public function getDataByID(id:Object):IData
Get data object by specified data ID.
Parameters
id:Object — the ID value need to find.
|
IData — The data object with specified ID
|
getPropertyValue | () | method |
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.
|
Object — the property value, if has
|
getSiblingIndex | () | method |
public function getSiblingIndex(data:IData):int
Get the index of the specified data in all siblings.
Parameters
data:IData — the data object need to check
|
int — the index of the specified data in all siblings.
|
getSiblings | () | method |
public function getSiblings(data:IData):ICollection
Get sibling data collection for specified data instance. Sibling data refer to the data has same parent object.
Parameters
data:IData — a data object
|
ICollection — all sibling data objects of the specified data.
|
handleImageLoaded | () | method |
hasOwnProperty | () | method |
public function hasOwnProperty(name:String):Boolean
Whether this data has specified property.
Parameters
name:String — the property name
|
Boolean — true if has this property, false otherwise.
|
isEmpty | () | method |
public function isEmpty():Boolean
Whether this data box is empty (no data).
ReturnsBoolean — true is empty, false otherwise.
|
moveDown | () | method |
public function moveDown(data:IData):void
Move specified data on index lower.
Parameters
data:IData — data object to be moved down
|
moveSelectionDown | () | method |
public function moveSelectionDown(sm:SelectionModel = null):void
Move all selected data to lower index location.
Parameters
sm:SelectionModel (default = null ) — the selection model contains all selected data objects.
|
moveSelectionToBottom | () | method |
public function moveSelectionToBottom(sm:SelectionModel = null):void
Move all selected data to the bottom index location.
Parameters
sm:SelectionModel (default = null ) — the selection model contains all selected data objects.
|
moveSelectionToTop | () | method |
public function moveSelectionToTop(sm:SelectionModel = null):void
Move all selected data to the top index location.
Parameters
sm:SelectionModel (default = null ) — the selection model contains all selected data objects.
|
moveSelectionUp | () | method |
public function moveSelectionUp(sm:SelectionModel = null):void
Move all selected data to upper index location.
Parameters
sm:SelectionModel (default = null ) — the selection model contains all selected data objects.
|
moveTo | () | method |
public function moveTo(data:IData, newIndex:int):void
Move the specified data to the specified index location.
Parameters
data:IData — the data to be moved
| |
newIndex:int — the new data location
|
moveToBottom | () | method |
public function moveToBottom(data:IData):void
Move specified data to the bottom index location.
Parameters
data:IData — the data object to be moved
|
moveToTop | () | method |
public function moveToTop(data:IData):void
Move specified data to the top index location.
Parameters
data:IData — the data object to be moved
|
moveUp | () | method |
public function moveUp(data:IData):void
Move specified data one index upper.
Parameters
data:IData — The data object to be moved up.
|
onClientChanged | () | method |
protected function onClientChanged(styleProp:String, oldValue:*, newValue:*):void
Called when client property is changed.
Parameters
styleProp:String — property name
| |
oldValue:* — old value before the change
| |
newValue:* — new value after the change
|
onDataPropertyChanged | () | method |
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.
|
onPropertyChanged | () | method |
protected function onPropertyChanged(property:String, oldValue:Object, newValue:Object):void
Called back when a property of this data is changed.
Parameters
property:String — property name changed
| |
oldValue:Object — old value before property change
| |
newValue:Object — new value after property change
|
remove | () | method |
public function remove(data:IData):void
Remove specified data from this data box.
Parameters
data:IData — the data to be removed
|
removeByID | () | method |
public function removeByID(id:Object):void
Remove data by data ID.
Parameters
id:Object — the data ID that need to remove
|
removeDataBoxChangeListener | () | method |
public function removeDataBoxChangeListener(listener:Function):void
Remove data box change listener from this data box.
Parameters
listener:Function — the listener to be removed.
|
removeDataPropertyChangeListener | () | method |
public function removeDataPropertyChangeListener(listener:Function):void
Remove specified data property change listener.
Parameters
listener:Function — the data property change listener to be removed
|
removeFirst | () | method |
public function removeFirst(count:int = 1):void
Remove the first specified count data objects from this data box.
Parameters
count:int (default = 1 ) — the data count to be removed
|
removeHierarchyChangeListener | () | method |
public function removeHierarchyChangeListener(listener:Function):void
Remove the specified hierarchical change listener from this data box.
Parameters
listener:Function — the hierarchical change listener to be removed
|
removePropertyChangeListener | () | method |
public function removePropertyChangeListener(listener:Function):void
Remove property change listener from this data box.
Parameters
listener:Function — the property change listener to be removed.
|
removeSelection | () | method |
public function removeSelection():void
Remove all selected data from this data box.
serializeClient | () | method |
protected function serializeClient(serializer:XMLSerializer, clientPrope:String, newInstance:DataBox):void
Serialize the specified client property into XML.
Parameters
serializer:XMLSerializer — the XML serializer
| |
clientPrope:String — client property name to be serialized
| |
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.
|
serializeProperty | () | method |
protected function serializeProperty(serializer:XMLSerializer, property:String, newInstance:DataBox):void
Serialize the specified property into XML.
Parameters
serializer:XMLSerializer — XML serializer
| |
property:String — the property to be serialized
| |
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.
|
serializeXML | () | method |
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.
|
setClient | () | method |
public function setClient(clientProp:String, newValue:*):IClient
Set client property for this data.
Parameters
clientProp:String — client property name.
| |
newValue:* — client property value.
|
IClient — current data itself. This is possible to
write code like data.setClient("a",a).setClient("b",b)...
|
setPropertyValue | () | method |
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.
|
toDatas | () | method |
public function toDatas(matchFunction:Function = null):ICollection
Create a new collection, put all data inside this collection, and return this collection. Also iterate all data by the given call back function.
Parameters
matchFunction:Function (default = null ) — the iterate call back function.
|
ICollection — all data with a collection
|
toString | () | method |
override public function toString():String
Returns
String |