Packageorg.springextensions.actionscript.context.support
SVN browsingFlexXMLApplicationContext.as
FisheyeFlexXMLApplicationContext.as
Classpublic class FlexXMLApplicationContext
InheritanceFlexXMLApplicationContext Inheritance XMLApplicationContext Inheritance AbstractApplicationContext Inheritance DefaultListableObjectFactory Inheritance AbstractObjectFactory Inheritance flash.events.EventDispatcher
ImplementsIOwnerModuleAware, IStageProcessorRegistryAware

Extension of XMLApplicationContext that supports flex framework specific classes like ArrayCollection.

The context also supports special wiring for view components that happens when display objects are added to the stage. In order to improve performance The context use an IObjectSelector in order to decide which objects added to the stage should also be wired and a IObjectDefinitionResolver to map stage added objects to an IObjectDefinition.

Default stage object selector implementation filters all mx.flash.package classes and objects not inheriting from UIComponent.

The IObjectDefinition is resolved using the context itself by type or name. It is possible to configure FlexXMLApplicationContext properties to filter additional classes, or filter by name.

It is possible to use custom IObjectSelector whether using directly the classe setter or by creating an object having as id flexStageObjectSelector or a customer one set with stageWireObjectSelectorName property.

It is possible to use custom stage wiring IObjectDefinitionResolver whether using directly the classe setter or by creating an object having as id flexStageObjectDefinitionResolver or a custom one set with stageWireObjectDefinitionResolverName property.

See also

FlexXMLApplicationContext.stageWireObjectHandler()
FlexStageDefaultObjectSelector
DefaultObjectDefinitionResolver


Documentation reference: instantiating a container


Public Properties
 PropertyDefined by
 InheritedallowObjectDefinitionOverriding : Boolean
Set whether it should be allowed to override object definitions by registering a different definition with the same name, automatically replacing the former.
DefaultListableObjectFactory
  applicationDomain : ApplicationDomain
FlexXMLApplicationContext
 InheritedautowireProcessor : IAutowireProcessor
AbstractObjectFactory
 InheritedconfigLocations : Array
XMLApplicationContext
 InheritedexplicitSingletonNames : Array
The names of the explicit singletons registered in this factory.
AbstractObjectFactory
 InheritednumObjectDefinitions : uint
The number of object definitions in this registry.
DefaultListableObjectFactory
 InheritednumObjectPostProcessors : int
Returns the number of object post processors.
AbstractObjectFactory
 InheritedobjectDefinitionNames : Array
The names of the registered object definitions.
DefaultListableObjectFactory
 InheritedobjectDefinitions : Object
AbstractObjectFactory
  ownerModule : Module
The Module that will act as the owner of the current IOwnerModuleAware instance.
FlexXMLApplicationContext
 Inheritedparent : IObjectFactory
AbstractObjectFactory
 InheritedparentContext : IApplicationContext
Returns the parent application context or null if no parent is set.
AbstractApplicationContext
 Inheritedparser : XMLObjectDefinitionsParser
Contains the parser of the XML definitions.
XMLApplicationContext
 Inheritedproperties : Properties
AbstractObjectFactory
  stageProcessorRegistry : IStageProcessorRegistry
FlexXMLApplicationContext
 InheritedtypeConverter : ITypeConverter
The current type converter implementation
AbstractObjectFactory
Protected Properties
 PropertyDefined by
 InheritedcurrentConfigLocation : String = ""
XMLApplicationContext
 InheritedearlySingletonCache : Object
Cache of early cached singletons for circular references
AbstractObjectFactory
 InheritedexplicitSingletonCache : Object
Cache of singleton objects registered without object definition
AbstractObjectFactory
 InheritedobjectPostProcessors : Array
Object post processors to apply when creating objects
AbstractObjectFactory
 InheritedreferenceResolvers : Array
Reference resolvers used when creating objects
AbstractObjectFactory
 InheritedsingletonCache : Object
Cache of created singleton objects via an object definition
AbstractObjectFactory
Public Methods
 MethodDefined by
  
FlexXMLApplicationContext(source:* = null, ownerModule:Module = null)

Creates a new FlexXMLApplicationContext.

FlexXMLApplicationContext
 Inherited
addConfig(config:XML):void
XMLApplicationContext
 Inherited
addConfigLocation(configLocation:String):void
XMLApplicationContext
 Inherited
addEmbeddedConfig(config:Class):void
XMLApplicationContext
 Inherited
Adds a namespace handler to the parser of this application context.
XMLApplicationContext
 Inherited
addObjectFactoryPostProcessor(objectFactoryPostProcessor:IObjectFactoryPostProcessor, index:int = -1):void
Adds an IObjectFactoryPostProcessor instance to the current XMLApplicationContext
AbstractApplicationContext
 Inherited
addObjectPostProcessor(objectPostProcessor:IObjectPostProcessor):void

If the specified IObjectPostProcessor implements IApplicationDomainAware the current AbstractObjectFactory.applicationDomain will be injected.

Adds an object postprocessor to this object factory.
AbstractObjectFactory
 Inherited
addReferenceResolver(referenceResolver:IReferenceResolver):void
This method adds a reference resolver that will be used to resolve property references.
AbstractObjectFactory
  
addResourceBundleLocation(url:String, name:String, locale:String):void
Adds the info of an external resource bundle to the context, that will be loaded before the container dispatches its "complete" event.
FlexXMLApplicationContext
 Inherited
canCreate(objectName:String):Boolean
Determines if the object factory is able to create the object with the given name.
AbstractObjectFactory
 Inherited
clearObjectFromInternalCache(name:String):Object
Removes an object from the internal object definition cache.
AbstractObjectFactory
 Inherited
containsObject(objectName:String):Boolean
Determines if the object factory contains a definition with the given name.
AbstractObjectFactory
 Inherited
containsObjectDefinition(objectName:String):Boolean
Determines if an object definition with the given name exists
DefaultListableObjectFactory
 Inherited
createInstance(clazz:Class, constructorArguments:Array = null):*
Creates an instance of the specified Class, wires the instance and returns it.
AbstractObjectFactory
  
Sets the stageProcessorRegistry.enabled property to false.
FlexXMLApplicationContext
  
Sets the stageProcessorRegistry.enabled property to true.
FlexXMLApplicationContext
  
getClassForInstance(object:Object):Class
FlexXMLApplicationContext
  
getClassForName(className:String):Class
FlexXMLApplicationContext
 Inherited
getObject(name:String, constructorArguments:Array = null):*
Will retrieve an object by it's name/id If the definition is a singleton it will be retrieved from cache if possible.
AbstractObjectFactory
 Inherited
Returns the object definition registered with the given name.
DefaultListableObjectFactory
 Inherited
getObjectNamesForType(type:Class):Array
Returns the names of all object definitions and explicit singletons in this factory that are of the given type.
DefaultListableObjectFactory
 Inherited
getObjectsOfType(type:Class):Object
Returns all object definitions and explicit singletons that are of the given type.
DefaultListableObjectFactory
 Inherited
getType(objectName:String):Class
Returns the type that is defined on the object definition.
AbstractObjectFactory
 Inherited
isFactoryObject(objectName:String):Boolean
Determines if an object is a IFactoryObject implementation.
AbstractObjectFactory
 Inherited
isPrototype(objectName:String):Boolean
Determines if the definition with the given name is a prototype.
AbstractObjectFactory
 Inherited
isSingleton(objectName:String):Boolean
Determines if the definition with the given name is a singleton.
AbstractObjectFactory
 Inherited
load():void
This method will internally do the following:
  • Load all configuration entries (if any)
  • Load all imports (if any)
  • Load all property files (if any)
  • Give the result to the XMLObjectDefinitionsParser
XMLApplicationContext
 Inherited

Checks if the objectdefinition is an implementation of IFactoryObject, if so the factory will be pre-instantiated, not the result of the factory.

Instantiates all definitions that are defined as singleton and are not lazy.
DefaultListableObjectFactory
 Inherited
registerCustomEditor(requiredType:Class, propertyEditor:IPropertyEditor):void
Registers a custom property editor.
AbstractObjectFactory
 Inherited
registerObjectDefinition(objectName:String, objectDefinition:IObjectDefinition):void
Registers the given objectDefinition under the given name.
DefaultListableObjectFactory
 Inherited
registerSingleton(name:String, object:Object):void
AbstractApplicationContext
 Inherited
removeObjectDefinition(objectName:String):void
Removes the definition with the given name from the registry
DefaultListableObjectFactory
 Inherited
resolveReference(property:Object):Object
Resolves a property in an object definition.
AbstractObjectFactory
 Inherited
wire(object:*, objectDefinition:IObjectDefinition, objectName:String = null):void
AbstractObjectFactory
Protected Methods
 MethodDefined by
  

Checks if the given xml data contains any <import/> tags.

FlexXMLApplicationContext
 Inherited
buildObject(name:String, constructorArguments:Array = null):*
Builds an object for the given name and returns it.
AbstractObjectFactory
 Inherited
If the _loader variable is not null the onLoaderComplete and onIOError event handlers are removed.
XMLApplicationContext
  
completeHandler(event:Event):void
Event.COMPLETE event handler added in context constructor.
FlexXMLApplicationContext
 Inherited
createObjectViaInstanceFactoryMethod(objectName:String, methodName:String, args:Array = null):*
AbstractObjectFactory
 Inherited
createObjectViaStaticFactoryMethod(clazz:Class, applicationDomain:ApplicationDomain, factoryMethodName:String, args:Array = null):*
AbstractObjectFactory
 Inherited
getBaseURL(url:String):String
Returns the base url of the file this loading is loading.
XMLApplicationContext
  
initFlexXMLApplicationContext(ownerModule:Module):void
Initializes the FlexXMLApplicationContext instance.
FlexXMLApplicationContext
 Inherited
initXMLObjectFactory(source:*):void
Initializes the XMLObjectFactoryInit instance
XMLApplicationContext
 Inherited
Invokes all object factory post processors.
AbstractApplicationContext
 Inherited
loadComplete():void
TODO
AbstractApplicationContext
 Inherited
loadConfigLocation(configLocation:String):void
Will load a configLocation
XMLApplicationContext
  
parse():void
Parses the xml.
FlexXMLApplicationContext
 Inherited
Hook method defined in XmlObjectFactory to add the ApplicationContextAwareProcessor.
AbstractApplicationContext
 Inherited
Looks for implementations of IObjectFactoryPostProcessor in the object definition of this context and add an instance of each one as a object factory post processor.
AbstractApplicationContext
 Inherited
Will search all object definitions for implementations of IObjectPostProcessor.
AbstractApplicationContext
Public Constants
 ConstantDefined by
 InheritedOBJECT_FACTORY_PREFIX : String = "&"
[static] Used to dereference an IFactoryObject instance and distinguish it from objects created by the IFactoryObject.
AbstractObjectFactory
 InheritedTHIS : String = "this"
[static]
AbstractObjectFactory
Property detail
applicationDomainproperty
applicationDomain:ApplicationDomain  [read-write]Implementation
    public function get applicationDomain():ApplicationDomain
    public function set applicationDomain(value:ApplicationDomain):void
ownerModuleproperty 
ownerModule:Module  [read-write]

The Module that will act as the owner of the current IOwnerModuleAware instance.

Implementation
    public function get ownerModule():Module
    public function set ownerModule(value:Module):void
stageProcessorRegistryproperty 
stageProcessorRegistry:IStageProcessorRegistry  [read-write]

Implementation
    public function get stageProcessorRegistry():IStageProcessorRegistry
    public function set stageProcessorRegistry(value:IStageProcessorRegistry):void
Constructor detail
FlexXMLApplicationContext()constructor
public function FlexXMLApplicationContext(source:* = null, ownerModule:Module = null)

Creates a new FlexXMLApplicationContext.

Parameters
source:* (default = null)
 
ownerModule:Module (default = null)
Method detail
addImportLocationsIfAny()method
protected override function addImportLocationsIfAny(xml:XML):void

Checks if the given xml data contains any <import/> tags. If any are found, their corresponding xml file is added to the load queue.

If an import has an attribute of type="class" the file is not being loaded but instead an property with the same name as the file attribute is retrieved from the current Application, this property needs to be of type Class and must represent an embedded resource.

Parameters
xml:XML

Throws
— When the embeddedName is not found as a property on the Application object or when this property is not of type Class.
addResourceBundleLocation()method 
public function addResourceBundleLocation(url:String, name:String, locale:String):void

Adds the info of an external resource bundle to the context, that will be loaded before the container dispatches its "complete" event.

Once loaded, the values of the external resource bundle are parsed into a ResourceBundle instance and passed into the ResourceManager.

Parameters
url:String — the location of the external resource bundle
 
name:String — the name of the resource bundle
 
locale:String — the locale
completeHandler()method 
protected function completeHandler(event:Event):void

Event.COMPLETE event handler added in context constructor. Attempts to wire all the components that are already on the stage cache. Assigns the systemManager property with the current application's systemManager and adds the stageWireObjectHandler() method as an Event.ADDED listener on the systemManager.

Parameters
event:Event — The specified Event.COMPLETE event
disableStageProcessing()method 
public function disableStageProcessing():void

Sets the stageProcessorRegistry.enabled property to false. Useful during testing and object dispose.

See also

stageWireObjectHandler()
enableStageProcessing()method 
public function enableStageProcessing():void

Sets the stageProcessorRegistry.enabled property to true. Useful during testing and object dispose.

See also

stageWireObjectHandler()
getClassForInstance()method 
public override function getClassForInstance(object:Object):ClassParameters
object:Object

Returns
Class
getClassForName()method 
public override function getClassForName(className:String):ClassParameters
className:String

Returns
Class
initFlexXMLApplicationContext()method 
protected function initFlexXMLApplicationContext(ownerModule:Module):void

Initializes the FlexXMLApplicationContext instance.

Parameters
ownerModule:Module
parse()method 
protected override function parse():void

Parses the xml.