Package | twaver |
Class | public class Data |
Inheritance | Data ![]() |
Implements | IData |
Subclasses | Alarm, Element, Layer |
DataBox
. Element and alarm
are all typical network data in TWaver Flex. This class
defines very high level common basic data properties
such as ID, children, parent etc. Also, this class
extends from EventDispatcher
so it has
the ability to send event when property has been changed.
Property | Defined By | ||
---|---|---|---|
children : ICollection [read-only]
Get all children data objects of this data object. | Data | ||
childrenCount : int [read-only]
Get all children total count for this data. | Data | ||
clientProperties : ICollection [read-only]
Get a ICollection that contians all client proerty name. | Data | ||
hasChildren : Boolean [read-only]
Check whether this data has children objects. | Data | ||
icon : String
Get icon value for this data. | Data | ||
id : Object [read-only]
Get the ID value of this data. | Data | ||
name : String
Get name of this data. | Data | ||
parent : IData
Get parent data object. | Data | ||
toolTip : String
Get the tooltip text of this data. | Data |
Method | Defined By | ||
---|---|---|---|
Data(id:Object = null)
Constructor. | Data | ||
Add a child data object for this data. | Data | ||
addPropertyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add a property change listener to this data to monitoring property
change event. | Data | ||
clearChildren():Boolean
Clear all children from this data. | Data | ||
deserializeXML(serializer:XMLSerializer, xml:XML):void
Deserialize given XML data to data objects. | Data | ||
dispatchPropertyChangeEvent(property:String, oldValue:Object, newValue:Object):Boolean
Dispatch property change event to all installed listeners. | Data | ||
getChildAt(index:int):IData
Get child as specified index location. | Data | ||
getClient(clientProp:String):*
Get specified client property value. | Data | ||
getPropertyValue(property:String):Object
Get specified property value from this data. | Data | ||
hasOwnProperty(name:String):Boolean
Whether this data has specified property. | Data | ||
isDescendantOf(data:IData):Boolean
Check whether this data is a descendant of the specified data object. | Data | ||
isParentOf(data:IData):Boolean
Check whether this data is the parent of specified data. | Data | ||
isRelatedTo(data:IData):Boolean
Check whether this data has descendant relationship with the specified data. | Data | ||
removeChild(child:IData):Boolean
Remove the specified child object. | Data | ||
removePropertyChangeListener(listener:Function):void
Remove the specified property change listener. | Data | ||
Serialize this data object into XML. | Data | ||
Set client property for this data. | Data | ||
setPropertyValue(property:String, value:Object):void
Set specified property name value on this data. | Data | ||
toChildren(matchFunction:Function = null):ICollection
Iterate children collection by given callback function. | Data | ||
toString():String [override]
| Data |
Method | Defined By | ||
---|---|---|---|
deserializeClient(serializer:XMLSerializer, clientXML:XML, clientProp:String):void
Deserialize client property from given XML data. | Data | ||
deserializeProperty(serializer:XMLSerializer, propertyXML:XML, property:String):void
Deserialize specified property from the given XML data contains property value. | Data | ||
onChildAdded(child:IData, index:int):void
Called back when a child is added. | Data | ||
onChildRemoved(child:IData, index:int):void
Called back when a child is removed. | Data | ||
onChildrenCleared(children:Array):void
Called back when all children are cleared from this data. | Data | ||
onClientChanged(styleProp:String, oldValue:*, newValue:*):void
Called when client property is changed. | Data | ||
Called back when data parent changed. | Data | ||
onPropertyChanged(property:String, oldValue:Object, newValue:Object):void
Called back when a property of this data is changed. | Data | ||
Serialize given client property into the specified XML serializer. | Data | ||
Serialize given property into the specified
XML serializer. | Data |
children | property |
children:ICollection
[read-only] Get all children data objects of this data object.
public function get children():ICollection
childrenCount | property |
childrenCount:int
[read-only] Get all children total count for this data.
public function get childrenCount():int
clientProperties | property |
clientProperties:ICollection
[read-only] Get a ICollection that contians all client proerty name.
public function get clientProperties():ICollection
hasChildren | property |
hasChildren:Boolean
[read-only] Check whether this data has children objects.
public function get hasChildren():Boolean
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
id | property |
id:Object
[read-only] Get the ID value of this data.
public function get id():Object
name | property |
name:String
Get name of this data.
public function get name():String
public function set name(value:String):void
parent | property |
parent:IData
Get parent data object.
public function get parent():IData
public function set parent(value:IData):void
toolTip | property |
toolTip:String
Get the tooltip text of this data.
public function get toolTip():String
public function set toolTip(value:String):void
Data | () | Constructor |
public function Data(id:Object = null)
Constructor.
Parametersid:Object (default = null ) — the data identifier. This should be an unique object
in one data box. If null value specified, TWaver Flex will
create an value for it internally.
|
addChild | () | method |
public function addChild(child:IData, index:int = -1):Boolean
Add a child data object for this data.
Parameters
child:IData — the child data object
| |
index:int (default = -1 ) — the index of this children.
|
Boolean — true if success, false otherwise.
|
addPropertyChangeListener | () | method |
public function addPropertyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add a property change listener to this data to monitoring property change event.
Parameters
listener:Function — the listener object.
| |
priority:int (default = 0 ) — listener priority
| |
useWeakReference:Boolean (default = false ) — whether use weak reference. Default value is false.
|
clearChildren | () | method |
public function clearChildren():Boolean
Clear all children from this data. Please note call this method will not move children from element box or databox. This is just cut the child-parent relationship between children data and this data.
ReturnsBoolean — true if done, 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 listeners.
Parameters
property:String — the property name of the changed property.
| |
oldValue:Object — value before changed
| |
newValue:Object — value after changed
|
Boolean — true if the event dispatched successfully, false otherwise.
|
getChildAt | () | method |
public function getChildAt(index:int):IData
Get child as specified index location.
Parameters
index:int — the child index location
|
IData — child at the specified index location
|
getClient | () | method |
public function getClient(clientProp:String):*
Get specified client property value.
Parameters
clientProp:String — client property name
|
* — value of this client property.
|
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
|
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.
|
isDescendantOf | () | method |
public function isDescendantOf(data:IData):Boolean
Check whether this data is a descendant of the specified data object.
Parameters
data:IData — a data object need to check
|
Boolean — true if is descendant, false otherwise.
|
isParentOf | () | method |
public function isParentOf(data:IData):Boolean
Check whether this data is the parent of specified data.
Parameters
data:IData — the data object need to check
|
Boolean — true if this data is the parent of specified data, false otherwise.
|
isRelatedTo | () | method |
public function isRelatedTo(data:IData):Boolean
Check whether this data has descendant relationship with the specified data.
Parameters
data:IData — a data object to check.
|
Boolean — true if the two data has descendant relationship, false otherwise.
|
onChildAdded | () | method |
protected function onChildAdded(child:IData, index:int):void
Called back when a child is added. Subclasses can overwrite this method to do something.
Parameters
child:IData — the new added child data object
| |
index:int — the index of the new added child data object
|
onChildRemoved | () | method |
protected function onChildRemoved(child:IData, index:int):void
Called back when a child is removed. Subclasses could overwrite this method to do something when a child is removed from this data.
Parameters
child:IData — the removed child data.
| |
index:int — the index of the removed child data.
|
onChildrenCleared | () | method |
protected function onChildrenCleared(children:Array):void
Called back when all children are cleared from this data. Subclasses could overwrite this method to do something on children are all cleared.
Parameters
children:Array — all children data has just cleared.
|
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
|
onParentChanged | () | method |
protected function onParentChanged(oldParent:IData, newParent:IData):void
Called back when data parent changed. Subclasses could overwrite this method to do something when parent is changed.
Parameters
oldParent:IData — old parent before changed.
| |
newParent:IData — new parent after changed.
|
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
|
removeChild | () | method |
public function removeChild(child:IData):Boolean
Remove the specified child object.
Parameters
child:IData — the child object to be removed
|
Boolean — true if removed, false otherwise.
|
removePropertyChangeListener | () | method |
public function removePropertyChangeListener(listener:Function):void
Remove the specified property change listener.
Parameters
listener:Function — the listener instance need to remove
|
serializeClient | () | method |
protected function serializeClient(serializer:XMLSerializer, clientPrope:String, newInstance:IData):void
Serialize given client property into the specified XML serializer.
Parameters
serializer:XMLSerializer — the XML serializer
| |
clientPrope:String — the client property to be serialized
| |
newInstance:IData — a brand new instance of current class with default
values. This will be used during the XML serialization to compare the
serializing object value and the default instance value. If the value
is different, then serialize; otherwise, not serialize.
|
serializeProperty | () | method |
protected function serializeProperty(serializer:XMLSerializer, property:String, newInstance:IData):void
Serialize given property into the specified XML serializer.
Parameters
serializer:XMLSerializer — the XML serializer object
| |
property:String — property to be serialized
| |
newInstance:IData — a brand new instance of current class with default
values. This will be used during the XML serialization to compare the
serializing object value and the default instance value. If the value
is different, then serialize; otherwise, not serialize.
|
serializeXML | () | method |
public function serializeXML(serializer:XMLSerializer, newInstance:IData):void
Serialize this data object into XML.
Parameters
serializer:XMLSerializer — the XML serializer.
| |
newInstance:IData — a brand new instance of current class with default
values. This will be used during the XML serialization to compare the
serializing object value and the default instance value. If the value
is different, then serialize; otherwise, not serialize.
|
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.
|
toChildren | () | method |
public function toChildren(matchFunction:Function = null):ICollection
Iterate children collection by given callback function.
Parameters
matchFunction:Function (default = null ) — the callback function of the iteration
|
ICollection — the collection of all children
|
toString | () | method |
override public function toString():String
Returns
String |