Packagecom.bourre.ioc.parser
Classpublic class ContextParser

Player version: Flash Player 9.0
Language version: ActionScript 3.0

IoC Context parser.

When context is loaded, this class parse content to build concrete object using xml node definition.



Protected Properties
 PropertyDefined by
  _oContext : XML
ContextParser
  _oEB : EventBroadcaster
ContextParser
  _pc : ParserCollection
ContextParser
Public Methods
 MethodDefined by
  
Creates instance.
ContextParser
  
addEventListener(type:String, listener:Object, ... rest):Boolean
Adds an event listener for the specified event type.
ContextParser
  
Adds the passed-in listener as listener for all events dispatched by this instance.
ContextParser
  
parse(xml:*):void
Parses passed-in xml definition.
ContextParser
  
removeEventListener(type:String, listener:Object):Boolean
Removes the passed-in listener for listening the specified event.
ContextParser
  
Removes the passed-in listener object from this event broadcaster.
ContextParser
  
toString():String
Returns string representation.
ContextParser
Events
 EventSummaryDefined by
   Dispatched when context parsing is finished.ContextParser
   Dispatched when context parsing starts.ContextParser
Property detail
_oContextproperty
protected var _oContext:XML

Player version: Flash Player 9.0
Language version: ActionScript 3.0

_oEBproperty 
protected var _oEB:EventBroadcaster

Player version: Flash Player 9.0
Language version: ActionScript 3.0

_pcproperty 
protected var _pc:ParserCollection

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Constructor detail
ContextParser()constructor
public function ContextParser(pc:ParserCollection = null)

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Creates instance.

Parameters
pc:ParserCollection (default = null) — (optional) Parsers collection to use to parse IoC context file.
Method detail
addEventListener()method
public function addEventListener(type:String, listener:Object, ... rest):Boolean

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Adds an event listener for the specified event type. There is two behaviors for the addEventListener function :

  1. The passed-in listener is an object : The object is added as listener only for the specified event, the object must have a function with the same name than type or at least a handleEvent function.
  2. The passed-in listener is a function : A Delegate object is created and then added as listener for the event type. There is no restriction on the name of the function. If the rest is not empty, all elements in it is used as additional arguments into the delegate object.

Parameters
type:String — name of the event for which register the listener
 
listener:Object — object or function which will receive this event
 
... rest — additional arguments for the function listener

Returns
Booleantrue if the function have been succesfully added as listener fot the passed-in event

Throws
UnsupportedOperationException — If the listener is an object which have neither a function with the same name than the event type nor a function called handleEvent
addListener()method 
public function addListener(listener:ContextParserListener):Boolean

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Adds the passed-in listener as listener for all events dispatched by this instance. The function returns true if the listener have been added at the end of the call. If the listener is already registered in this event broadcaster the function returns false.

Note : The addListener function doesn't accept functions as listener, functions could only register for a single event.

Parameters
listener:ContextParserListener — the listener object to add as global listener

Returns
Booleantrue if the listener have been added during this call

Throws
IllegalArgumentException — If the passed-in listener listener doesn't match the listener type supported by this event broadcaster
 
IllegalArgumentException — If the passed-in listener is a function
parse()method 
public function parse(xml:*):void

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Parses passed-in xml definition.

Parameters
xml:*
removeEventListener()method 
public function removeEventListener(type:String, listener:Object):Boolean

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Removes the passed-in listener for listening the specified event. The listener could be either an object or a function.

Parameters
type:String — name of the event for which unregister the listener
 
listener:Object — object or function to be unregistered

Returns
Booleantrue if the listener have been successfully removed as listener for the passed-in event
removeListener()method 
public function removeListener(listener:ContextParserListener):Boolean

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Removes the passed-in listener object from this event broadcaster. The object is removed as listener for all events the broadcaster may dispatch.

Parameters
listener:ContextParserListener — the listener object to remove from this event broadcaster object

Returns
Booleantrue if the object have been successfully removed from this event broadcaster

Throws
IllegalArgumentException — If the passed-in listener is a function
toString()method 
public function toString():String

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Returns string representation.

Returns
String
Event detail
onContextParsingEndevent 
Event object type: com.bourre.ioc.parser.ContextParserEvent
ContextParserEvent.type property = com.bourre.ioc.parser.ContextParserEvent.onContextParsingEndEVENT

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Dispatched when context parsing is finished.

Defines the value of the type property of the event object for a onContextParsingEnd event.

onContextParsingStartevent  
Event object type: com.bourre.ioc.parser.ContextParserEvent
ContextParserEvent.type property = com.bourre.ioc.parser.ContextParserEvent.onContextParsingStartEVENT

Player version: Flash Player 9.0
Language version: ActionScript 3.0

Dispatched when context parsing starts.

Defines the value of the type property of the event object for a onContextParsingStart event.