On Tue, Jan 17, 2012 at 6:48 PM, Alex Harui <[email protected]> wrote:
> For example, an MXML tag resulted in a UIComponentDescriptor for MX
> components and a tree of functions for Spark components. The plan was to
> have an MXML tag result in an entry in an Array that consisted of the class
> followed by property name/value pairs. The SDK would be modified to look
> for that array and call new and apply properties as needed. Prototypes
> showed that this was not only would this provide independence of SDK
> versions (since the mapping of MXML tag names and attributes to array
> entries is essentially version independent), but also faster because it
> takes advantage of the JIT better than running the Spark tree of individual
> functions once.
>
Can you expand on this? I've been using the model below
(ComponentDescription) to create a working component tree but I've been
planning to debating to extend UIComponentDescriptor.
What I'm using now is shown below:
/**
* Contains information about components that can be
* added or removed from the display list
* */
[Bindable]
public class ComponentDescription {
public function ComponentDescription(element:Object = null):void {
if (element) {
name = NameUtil.getUnqualifiedClassName(element);
className = getQualifiedClassName(element);
instance = element;
}
}
/**
* Unqualified class name
* */
public var name:String;
/**
* Qualified class name
* */
public var className:String;
/**
* Class used to create component instance
* */
public var classType:Object;
/**
* Class or path to icon
* */
public var icon:Object;
/**
* Default properties
* */
public var defaultProperties:Object;
/**
* Default styles
* */
public var defaultStyles:Object;
/**
* Properties
* */
public var properties:Object;
/**
* Styles
* */
public var styles:Object;
/**
* Instance of component. Optional.
* Used for display list
* */
public var instance:Object;
/**
* Children. Optional.
* Used for display in heiarchy view such as Tree.
* */
public var children:ArrayCollection;
/**
* Parent
* */
public var parent:ComponentDescription;
/**
* Skin class. If it doesn't exist the component
* may not be able to be added to the display list.
* */
public var skin:Class;
/**
* Used to store if the instance is visible.
* Does not check if an ancestor is visible
* @see parentVisible
* */
public var visible:Boolean = true;
/**
* Used to store if an ancestor is not visible.
* Manually set
* */
public var parentVisible:Boolean = true;
/**
*
* */
public var locked:Boolean = false;
}