Echo
Serial
Class Hierarchy:

Tools for serializing components, stylesheets, and property instances to and from XML.

Descendant Class Summary
Echo.Serial.Alignment
Echo.Serial.Boolean
Echo.Serial.Border
Echo.Serial.Date
Echo.Serial.FillImage
Echo.Serial.FillImageBorder
Echo.Serial.Float
Echo.Serial.Font
Echo.Serial.ImageReference
Echo.Serial.Integer
Echo.Serial.LayoutData
Echo.Serial.Map
Echo.Serial.Null
Echo.Serial.PropertyTranslator
Echo.Serial.String

Class Method Summary
Public addPropertyTranslator()
Adds a property translator for a specific class name.
Public addPropertyTranslatorByType()
Adds a property translator for a specific constructor.
Public getPropertyTranslator()
Retrieves a property translator for a specific class name.
Public getPropertyTranslatorByType()
Retrieves a property translator for a specific constructor.
Public loadComponent()
Deserializes an XML representation of a component into a component instance.
Internal _loadComponentEvent()
Processes an event registration directive element.
Public loadProperty()
Deserializes an XML representation of a property into an instance, and assigns it to the specified object.
Public loadStyleSheet()
Deserializes an XML representation of a style sheet into a StyleSheet instance.
Public storeProperty()
Serializes a property value into an XML representation.

Class Method Detail
addPropertyTranslator
Adds a property translator for a specific class name.
Parameters:
className (String) - the class name
translator (Echo.Serial.PropertyTranslator) - the property translator singleton (static class)

addPropertyTranslatorByType
Adds a property translator for a specific constructor.
Parameters:
type (Function) - the constructor
translator (Echo.Serial.PropertyTranslator) - the property translator singleton (static class)

getPropertyTranslator
Retrieves a property translator for a specific class name.
Parameters:
className (String) - the class name
Returns:
{Echo.Serial.PropertyTranslator} the property translator

getPropertyTranslatorByType
Retrieves a property translator for a specific constructor.
Parameters:
type (Function) - the constructor
Returns:
{Echo.Serial.PropertyTranslator} the property translator

loadComponent
Deserializes an XML representation of a component into a component instance. Any child components will be added to the created component instance. Events properties will be registered with the client by invoking the "addComponentListener()" method on the provided 'client', passing in the properties 'component' (the component instance) and 'event' (the event type as a string).
Parameters:
client (Echo.Client) - the containing client
cElement (Element) - the 'c' DOM element to deserialize
propertyMap - (optional) a mapping between property identifiers and property values for referenced properties (properties which were rendered elsewhere in the document and are potentially referenced by multiple components)
styleMap - (optional) a mapping between style identifiers and style values for referenced styles (styles which were rendered elsewhere in the document and are potentially referenced by multiple components)
Returns:
the instantiated component

_loadComponentEvent
Processes an event registration directive element.
Parameters:
client (Echo.Client) - the client
eventElement (Element) - the event element
the (Echo.Component) - component

loadProperty
Deserializes an XML representation of a property into an instance, and assigns it to the specified object.
Parameters:
client (Echo.Client) - the containing client
pElement (Element) - the property element to parse
object - the object on which the properties should be set (this object must contain set() and setIndex() methods
styleData - (optional) an associative array on which properties can be directly set
propertyMap - (optional) a mapping between property identifiers and property values for referenced properties (properties which were rendered elsewhere in the document and are potentially referenced by multiple components)
styleMap - (optional) a mapping between style identifiers and style values for referenced styles (styles which were rendered elsewhere in the document and are potentially referenced by multiple components)

loadStyleSheet
Deserializes an XML representation of a style sheet into a StyleSheet instance.
Parameters:
client (Echo.Client) - the client instance
ssElement (Element) - the "ss" element representing the root of the style sheet
propertyMap - the (optional) property map containing referenced property information

storeProperty
Serializes a property value into an XML representation.
Parameters:
client (Echo.Client) - the client instance
pElement (Element) - the "p" element representing the property
value - the value to render to the "p" element