Packagech.capi.net.app
Classpublic final class ApplicationContext
InheritanceApplicationContext Inheritance Object
Implements IApplicationContext

Represents a context for the ApplicationFile objects.

See also

ApplicationFile
ApplicationContextRegisterer


Public Properties
 PropertyDefined By
  name : String
[read-only] Defines the name of the ApplicationContext.
ApplicationContext
Public Methods
 MethodDefined By
  
ApplicationContext(name:String = null, register:Boolean = true)
Creates a new ApplicationContext object.
ApplicationContext
  
Add the specified ApplicationFile to the current ApplicationContext.
ApplicationContext
  
clear():void
Clear all the ApplicationFile of the ApplicationContext.
ApplicationContext
  
enumerateAll(excludeGlobalFiles:Boolean = false):Array
Enumerates all the ApplicationFile contained in the ApplicationContext.
ApplicationContext
  
Enumerates all the global ApplicationFile contained in the ApplicationContext.
ApplicationContext
  
Enumerates all the ApplicationFile that doesn't have any dependency.
ApplicationContext
  
Enumerates all the ApplicationFile that are on the root of the tree.
ApplicationContext
  
Get the ApplicationFile linked to the specified name.
ApplicationContext
  
getFileByProps(props:Object, strict:Boolean = false):ApplicationFile
Returns the first ApplicationFile that matches the specified properties.
ApplicationContext
  
getFilesByProps(props:Object, strict:Boolean = false):Array
Retrieves all the files that matches the specified properties.
ApplicationContext
  
printFiles(traceResult:Boolean = true):String
Print all the ApplicationFile instances contained in the current ApplicationContext.
ApplicationContext
  
removeFile(file:ApplicationFile, recursiveRemoval:Boolean = false):void
Remove the specified ApplicationFile from the ApplicationContext.
ApplicationContext
  
toString():String
Returns a String presentation of the ApplicationContext.
ApplicationContext
Property Detail
nameproperty
name:String  [read-only]

Defines the name of the ApplicationContext.


Implementation
    public function get name():String
Constructor Detail
ApplicationContext()Constructor
public function ApplicationContext(name:String = null, register:Boolean = true)

Creates a new ApplicationContext object.

Parameters
name:String (default = null) — The name of the ApplicationContext. The name must be unique if defined. If the name is null, then the ApplicationContext won't be registered. Else the ApplicationContext will register itself in the applicationContexts constant.
 
register:Boolean (default = true) — Defines if the ApplicationContext must register itself in the ApplicationContextRegisterer automatically.
Method Detail
addFile()method
public function addFile(file:ApplicationFile):void

Add the specified ApplicationFile to the current ApplicationContext. If the context of the ApplicationFile is already specified, this method will throw an error.

This method will also check that all dependencies of the specified ApplicationFile are already in the current ApplicationContext. If they are in no ApplicationContext they will be added in the current one, otherwise an error will be thrown.

Parameters

file:ApplicationFile — The ApplicationFile.


Throws
ArgumentError If — the ApplicationContext of the file is not null.
 
ArguemntError If — one of the dependencies is in another ApplicationContext.
 
NameAlreadyExistsError If — the name of the ApplicationFile is already taken.
clear()method 
public function clear():void

Clear all the ApplicationFile of the ApplicationContext. The context property of the ApplicationFile instances are reset to null to let the Garbate Collector take care of the ApplicationContext instance.

enumerateAll()method 
public function enumerateAll(excludeGlobalFiles:Boolean = false):Array

Enumerates all the ApplicationFile contained in the ApplicationContext.

Parameters

excludeGlobalFiles:Boolean (default = false) — Defines if the global files must be excluded.

Returns
Array — An Array containing the enumerated ApplicationFile.
enumerateGlobals()method 
public function enumerateGlobals():Array

Enumerates all the global ApplicationFile contained in the ApplicationContext.

Returns
Array — An Array containing the enumerated ApplicationFile.
enumerateLeaves()method 
public function enumerateLeaves():Array

Enumerates all the ApplicationFile that doesn't have any dependency.

Returns
Array — An Array containing all the ApplicationFile that doesn't have any dependency.

See also

enumerateRoots()method 
public function enumerateRoots():Array

Enumerates all the ApplicationFile that are on the root of the tree. That means that no other ApplicationFile have it as dependency.

Returns
Array — An Array containing all the ApplicationFile that are not in any dependency.

See also

getFile()method 
public function getFile(name:String):ApplicationFile

Get the ApplicationFile linked to the specified name.

Parameters

name:String — The name of the ApplicationFile.

Returns
ApplicationFile — The ApplicationFile or null if the file doesn't exist.

Throws
Error If — there is no ApplicationFile matching the specified name.
getFileByProps()method 
public function getFileByProps(props:Object, strict:Boolean = false):ApplicationFile

Returns the first ApplicationFile that matches the specified properties.

Parameters

props:Object — An Object containing the properties to match.
 
strict:Boolean (default = false) — Defines if the check must be strict or not (see IMap.matches()).

Returns
ApplicationFile — The first ApplicationFile instance that matches the properties or null.

See also

getFilesByProps()method 
public function getFilesByProps(props:Object, strict:Boolean = false):Array

Retrieves all the files that matches the specified properties.

Parameters

props:Object — An Object containing the properties to match.
 
strict:Boolean (default = false) — Defines if the check must be strict or not (see IMap.matches()).

Returns
Array — An Array of ILoadableFile that matche the specified properties.

See also

printFiles()method 
public function printFiles(traceResult:Boolean = true):String

Print all the ApplicationFile instances contained in the current ApplicationContext. This method is mainly for debug purposes but can also be used online.

Parameters

traceResult:Boolean (default = true) — Defines if the result must be traced.

Returns
String — A String of all the ApplicationFile.
removeFile()method 
public function removeFile(file:ApplicationFile, recursiveRemoval:Boolean = false):void

Remove the specified ApplicationFile from the ApplicationContext. All the ApplicationFile having the specified file as dependency, will have it removed.

If the recursiveRemoval argument is set to true, then all the dependencies of the specified file will also be removed from the ApplicationContext. In the other case, all the dependencies of the specified ApplicationFile are cleared.

Parameters

file:ApplicationFile — The ApplicationFile to remove.
 
recursiveRemoval:Boolean (default = false) — If the removal must be applied on all the dependencies of the file.


Throws
flash.errors:IllegalOperationError If — the file is not in the ApplicationContext.
toString()method 
public function toString():String

Returns a String presentation of the ApplicationContext.

Returns
String — A String representation of the ApplicationContext.

See also