| LowRA API Documentation | All Packages | All Classes | Index | Frames |
|
| LowRA Assembler Reference | ||
You will find below the various types of nodes allowed inside the file defining the context ( applicationContext.xml ) for LowRA IoC.
<foo> : A node of type foo such as :
<foo> Some content in the node </foo>
<%custom%> : A node where %custom% is the user
defined node name. It means that the node name is only significant for the user,
the assembler will use attributes of the node instead of the node name.
Example, the two following declarations produce the same result :
<plugin id="somePlugin" type="MyPluginClass" />
<object id="somePlugin" type="MyPluginClass" />
@foo : A node attribute called foo
such as :
<node foo="some value" />
@ prefix only means that the name refer to a node attribute.
#foo : Refer to the id foo such as :
<node id="foo" />The
# prefix only means that the name refer to the value of the
id attribute of a node.Foo : Refer to class name Foo.| Nodes | Context | Description | |
|---|---|---|---|
| <application-loader> | <beans> | Defines the loader view used to display the assembler process (only one occurence). | |
| <argument> | <%custom%>, <method-call> | Creates a new argument for a function call or a class constructor. | |
| <beans> | XML file root node | Required root node for the application context file (only one occurence). | |
| <%custom%> | <beans>, <custom>, <root> |
The node name has no meaning in this case, it creates
an new entity of the specified @type and
identified with the specified @id. When
child of the <root> node it will
be considered as part of the display list, nested
<%custom%> children are also allowed.
|
|
| <dll> | <beans> | Loads the specified *.swf file as a Dynamically Loaded Library (dll). | |
| <include> | <beans> | Loads a context file and add its content to the current application context | |
| <item> | <%custom% type="Dictionary"> |
Defines an entry in a Dictionary.
|
|
| <key> | <item> |
Defines the key of the <item> parent note.
|
|
| <listen> | <%custom%> |
Sets the <%custom%> parent node listening
to the specified @ref.
|
|
| <method-call> | <%custom%> |
Calls a method of the <%custom%>
parent node.
|
|
| <property> | <%custom%> |
Sets the initial value of the specified property
of the <%custom%> parent node.
|
|
| <root> | <beans> |
Defines the root node for the graphics structures (only one occurence).
All children of the <root> nodes will be considered
as part of the display list.
|
|
| <value> | <item> |
Defines the value of the <item> parent note.
|
|
| Attributes | Context | Description | |
| built-callback | <application-loader> | Name of the function to call on the application loader when the build is completed. | |
| delay | <method-call> | Delay the call of the method with the amount of the attribute value in milliseconds. | |
| deserializer-class | <%custom% type="XML"> | Defines the concret deserializer class to use for parse the node content. | |
| factory | <%custom%> |
Defines the factory method to call when creating the object
defined by this <%custom%> node.
|
|
| id | <%custom%>, <root> |
Defines the identifier of this node in the beans
namespace. You can use the @id of an
object in all nodes which provide a @ref,
it will return a reference to the object identified
by @id.
|
|
| init-callback | <application-loader> | Name of the function to call on the application loader when all loading are finished. | |
| name | <method-call>, <property> | Sets the name of the property or method of an object. | |
| name-callback | <application-loader> | Name of the function to call on the application loader when a new loading start. The function is called with the name of the lib file currently in loading. | |
| progress-callback | <application-loader> | Name of the function to call on the application loader during the loading of a file. The function is called with the percentage of file's loaded. | |
| ref | <argument>, <listen>, <key>, <property>, <value> |
Gets and return the entity of the beans namespace which
@id is equals to @ref value.
|
|
| root-ref | <include> | Defines the object considered as the root object for graphical structures of an included file. | |
| singleton-access | <%custom%> |
Defines the name of the function which return the
singleton instance of a class. Used when @factory
is defined.
|
|
| timeout-callback | <application-loader> | Name of the function to call on the application loader when a loading fail due to a timeout. | |
| type | <argument>, <%custom%>, <key>, <property>, <value> | Classpath which defines the type of the entity. | |
| url | <application-loader>, <%custom%>, <dll>, <include> | URL of the file to load according to the node type. | |
| value | <argument>, <%custom%>, <key>, <property>, <value> |
Defines the value carried by the node, if @type
is defined @value is cast to @type.
|
|
| visible | <%custom%> |
Sets a <root> child visible on the screen
at creation.
|
Defines the loader view used to display the assembler process (only one occurence).
The <applicationloader> allow designer and developer to simply add and
handle loading and assembling states to display the progress. The *.swf file specified in
the @url is loaded and callbacks methods are then called directly on the root
of the file.
This file could be a simple file with timeline function and all graphics
directly on stage or a full AS3 file. All the process performed by the assembler will
be send to the provided method in the node attributes. Only events defined by an attribute
are dispatched to the loader instance.
No
Cardinality0 - 1
Attributes
| built-callback | Name of the function to call on the application loader when the build is completed. | |
| init-callback | Name of the function to call on the application loader when all loading are finished. | |
| name-callback | Name of the function to call on the application loader when a new process start (loading, parsing, assembling, etc...). | |
| progress-callback | Name of the function to call on the application loader during the process. A number, which represent the current progression, is passed to the function. | |
| timeout-callback | Name of the function to call on the application loader when a loading fail due to a timeout. | |
| url | URL of the *.swf file. |
Creates a new argument for a function call or a class constructor. An argument could be a simple value or a reference to another entity defined in the assembler context file.
Context
When used directly inside a <%custom%> node, arguments are
passed to the constructor of the class specified in @type.
No
Cardinality0 - *
Attributes
| ref | The @id of an entity in the assembler context file.
When setting @ref, the assembler will ignore all other
attributes. |
|
| type | The type of the value contained in this <argument>.
If omitted the value is casted to String. |
|
| value | The value of this <argument> node. |
Required root node for the application context file (only one occurence).
The <beans> node contains the whole application context.
Included context must also defines the <beans> root node.
Note : <beans> node doesn't accept any attributes.
XML file root node
Children<application-loader>, <%custom%>, <dll>, <include>, <root>
There is no restriction in the order of the children, order of node execution is defined by the assembler while parsing is completed :
<application-loader> is created (if set)<include> nodes are loaded<dll> nodes are loaded<root> children are loaded or created and added on the stage<%custom%> children of the <beans>
are created<method-call> nodes are processed for each entity1 for each context file
AttributesNo
The node name has no meaning in this case, it creates
an new entity of the specified @type and
identified with the specified @id. When
child of the <root> node it will
be considered as part of the display list, nested
<%custom%> children are also allowed.
For details on nested <%custom%> see the
Children part.
<argument>, <%custom%>, <item>, <listen>, <method-call>, <property>
<%custom%> nodes can be nested only when they
are children of the <root> node. In that context
each child will be added to the display list as a child of their
parent node.
0 - *
Attributes
| deserializer-class | When @type is XML only. Defines
the concret deserializer class to use for parse the node content.
The @deserializer-class must implements the
Deserializer interface of the com.bourre.encoding
package. |
|
| factory | Defines the factory method to call when creating the object defined
by this <%custom%> node. The @factory
attribute is optional, when omitted, the object is created using the
classical new construct. |
|
| id | Defines the identifier of this node in the beans
namespace. You can use the @id of the
object in all nodes which provide a @ref,
it will return a reference to the object identified
by @id. More formally if you create an
object such :
<plugin id="somePlugin" type="MyPluginClass"/>
You can get a reference to <argument ref="somePlugin"/> |
|
| singleton-access | Defines the name of the function which return the
singleton instance of a class. Used when @factory
is defined. If set the creation of the object will correspond to :
MyClass.singletonAccess().factoryMethod( arguments ); |
|
| type | Classpath which defines the type of the entity. The specified class must exist
in the assembler applicationDomain. |
|
| url | When the current <%custom%> is a child of the
<root> node, the @url will represent
a swf file to load in place of the node. The @url content
must be a valid *.swf file. |
|
| value | The @value is used only when the @type
point to a primitive type, such Number, int,
uint, String or Boolean. |
Loads the specified *.swf file as a Dynamically Loaded Library (dll).
All dlls files are loaded in the same ApplicationDomain object.
More formally, the <dll> behave as the import
statement, it allow developers to includes classes compiled in a swf file in
the current assembler, and then instanciate them later.
No
Cardinality0 - *
Attributes
| url | URL of the *.swf file to load. |
Loads a context file and add its content to the current application context.
Included context files must defines a <beans> node.
When including a context file which also define a <root>
node, the <include> may define @root-ref to prevent
conflicts with the parent file <root> node.
No
Cardinality0 - *
Attributes
| url | URL of the *.xml context file to load. | |
| root-ref | An entity of the parent assembler context file which will be the
display object used to represent the <root> node
of the included file. |
Defines an entry in a Dictionary. The <item> node
don't accept any attributes, but require two child :
<key> node<value> node
The <item> node is only available for <%custom%>
nodes whose @type is Dictionary.
0 - *
AttributesNo
Defines the key of the <item> parent note.
No
Cardinality
1 for each <item>
| ref | The @id of an entity in the assembler context file.
When setting @ref, the assembler will ignore all other
attributes. |
|
| type | The type of the value contained in this <key>.
If omitted the value is casted to String. |
|
| value | The value of this <key> node. |
Sets the <%custom%> parent node listening
to the specified @ref.
No
Cardinality
0 - 1 for each <%custom%>
| id | The @id of an entity in the assembler context file. |
Calls a method of the <%custom%>
parent node. The method must be a member of the instance
and not a member of the class.
0 - *
Attributes
| delay | Delay the call of the method with the amount of the attribute value in milliseconds. | |
| name | The name of the method to call on the parent object. |
Sets the initial value of the specified property
of the <%custom%> parent node.
No
Cardinality0 - *
Attributes
| name | The name of the property to set on the parent object. | |
| ref | The @id of an entity in the assembler context file.
When setting @ref, the assembler will ignore all other
attributes. |
|
| type | The type of the value contained in this <property>.
If omitted the value is casted to String. |
|
| value | The value of this property. |
Defines the root node for the graphics structures (only one occurence).
All children of the <root> node will be considered
as part of the display list.
When dealing with multiple context files, each included context which
also define a <root> will be included with the @root-ref
attribute defined.
0 - 1
AttributesNo
Defines the value of the <item> parent note.
No
Cardinality
1 for each <item>
| ref | The @id of an entity in the assembler context file.
When setting @ref, the assembler will ignore all other
attributes. |
|
| type | The type of the value contained in this <value>.
If omitted the value is casted to String. |
|
| value | The value of this <value> node. |
Below a concret example of a context file which use the whole features set of the LowRA assembler.
<?xml version="1.0"?> <!DOCTYPE beans SYSTEM "http://lowra.googlecode.com/svn/trunk/tools/assembler.dtd"> <beans> <!-- You can insert here all the compiled classes you need to make your application working. --> <dll url="dll/FakePluginListenerDLL2.swf"/> <!-- That's your application loader config (if you need one) --> <!--<application-loader url="swf/loader.swf" progress-callback="onProgress" built-callback="onBuild"/>--> <!-- That's the visual tree of your application. If you need a graphical structure, root node is mandatory. --> <root> <container id="container"> <property name="x" type="int" value="50"/> <property name="y" type="int" value="50"/> <swf id="background" url="swf/background.swf" visible="false"/> <swf id="coffee" url="swf/coffee.jpg"> <property name="x" type="int" value="100"/> <property name="y" type="int" value="100"/> <property name="alpha" type="Number" value="0.1"/> </swf> <txt id="txt" type="flash.text.TextField"> <property name="text" value="Hello world!"/> <property name="y" type="int" value="250"/> <property name="autoSize" value="center"/> <method-call name="setTextFormat"> <argument ref="tf"/> </method-call> </txt> <square id="square" type="com.prizee.ui.Square"> <property name="alpha" type="Number" value="0.5"/> <property name="x" type="int" value="150"/> </square> </container> </root> <!-- Objects instanciation begins here. Methods call happen when all objects have been built. --> <tf id="tf" type="flash.text.TextFormat"> <argument type="" value="Arial"/> <argument type="Number" value="30"/> <argument type="Number" value="0XFF"/> </tf> <array id="collection" type="Array"> <argument ref="dimensionClass"/> <argument method="range1.clone"/> <argument ref="obj"/> <argument ref="config"/> <argument ref="coffee"/> </array> <dll url="dll/RangeDLL.swf"/> <range id="range1" type="com.bourre.structures.Range"> <argument ref="min"/> <argument type="Number" value="5"/> </range> <range id="range2" type="com.bourre.structures.Range"> <argument type="Number" value="5"/> <argument ref="max"/> </range> <dll url="dll/DimensionDLL.swf"/> <dimension id="dimension1" type="com.bourre.structures.Dimension"> <argument type="Number" value="800"/> <argument type="Number" value="600"/> </dimension> <dimension id="dimension2" type="com.bourre.structures.Dimension"> <argument type="Number" value="1024"/> <argument type="Number" value="768"/> <method-call name="setSize"> <argument ref="dimension1"/> </method-call> </dimension> <dll url="dll/FakePluginDLL.swf"/> <fake id="fake" type="FakePlugin"> <argument value="Hello world!"/> <argument ref="background"/> <method-call name="testPlugin"/> </fake> <min id="min" type="Number" value="1"/> <max id="max" type="Number" value="10"/> <dll url="dll/FakePluginListenerDLL.swf"/> <fake id="fakeListener" type="com.prizee.plugin.FakePluginListener"> <argument ref="dimension1"/> <listen ref="fake" /> </fake> <dictionary id="dictionary" type="Dictionary"> <item> <key ref="dimension2"/> <value ref="dimension1"/> </item> <item> <key ref="dimension1"/> <value ref="dimension2"/> </item> <item> <key type="Number" value="13"/> <value type="Class" value="com.bourre.structures.Dimension"/> </item> </dictionary> <class id="dimensionClass" type="Class"> <argument value="com.bourre.structures.Dimension"/> </class> <dll url="dll/UIDLL.swf"/> <dictionary id="displayObjectDictionary" type="Dictionary"> <item> <key value="com.prizee.ui.Square"/> <value type="Class" value="com.prizee.ui.Square"/> </item> </dictionary> <dictionary id="dico" type="Dictionary"> <item> <key value="o"/> <value ref="obj"/> </item> </dictionary> <dll url="dll/TypedFactoryLocatorDLL.swf"/> <factory id="displayOjectFactory" type="com.bourre.core.TypedFactoryLocator"> <argument type="Class" value="flash.display.MovieClip"/> <method-call name="add"><argument ref="displayObjectDictionary"/></method-call> </factory> <dll url="dll/XMLToObjectDeserializerDLL.swf"/> <xml id="config" type="XML" deserializer-class="com.bourre.encoding.XMLToObjectDeserializer"> <root> <node>1</node> <node>2</node> <node> <childNode>childNodeValue</childNode> </node> <node>4</node> </root> </xml> <object id="obj" type="Object"> <property name="p1" value="hello1"/> <property name="p2" value="hello2"/> </object> </beans>