Package | com.adobe.mosaic.om.interfaces |
Interface | public interface IContext |
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Experience Services - Composite Application Framework 9.5 |
Runtime Versions: | AIR 2.0.2, Flash Player 10.1 |
IContext
interface models a simple hash map that allows tiles to store attibutes
in name-value pairs. The name-value pairs are uniquely identified by their names, and any tile can
reference a name-value pair using the unique identifier.
The context is specific to its accessor. For example, the mosaicApp.context is shared for the application, whereas the mosaicApp.parentView.context is shared for only the specific view.
Method | Defined By | ||
---|---|---|---|
Adds a watcher to a specific set of context attributes. | IContext | ||
Adds a watcher to the context. | IContext | ||
Returns a named attribute from the context. | IContext | ||
Returns an array of named attributes from the context. | IContext | ||
Removes a watcher from a specific set of context attributes. | IContext | ||
Removes a watcher from the context. | IContext | ||
Sets a single attribute in the context to a value. | IContext | ||
Sets an array of context attributes. | IContext |
addAttributesWatcher | () | method |
public function addAttributesWatcher(name:Array, listener:Object):void
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Experience Services - Composite Application Framework 9.5 |
Runtime Versions: | AIR 2.0.2, Flash Player 10.1 |
Adds a watcher to a specific set of context attributes.
The watcher only triggers when all the attributes are set by a call to setAttributes
that
matches the list of watched attributes.
Parameters
name:Array — The name of the context object to watch.
| |
listener:Object — A function that takes in one parameter of type PropertyChangeEvent that will be
called any time a set is called with this name.
|
Related API Elements
addAttributeWatcher | () | method |
public function addAttributeWatcher(name:String, listener:Object):void
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Experience Services - Composite Application Framework 9.5 |
Runtime Versions: | AIR 2.0.2, Flash Player 10.1 |
Adds a watcher to the context.
The context watchers behave similar to watchers in Flex, with the exception that the context attributes do not need to be set in advance of creating the watcher. This way a tile can watch for an attribute that has not previously been set.
Parameters
name:String — The name of the context object to watch.
| |
listener:Object — A function that takes in one parameter of type PropertyChangeEvent that will be
called any time a set is called with this name.
|
Related API Elements
getAttribute | () | method |
public function getAttribute(name:String):*
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Experience Services - Composite Application Framework 9.5 |
Runtime Versions: | AIR 2.0.2, Flash Player 10.1 |
Returns a named attribute from the context.
Parameters
name:String — The name of the attribute to retrieve.
|
* — The attribute stored in the context.
|
Related API Elements
getAttributes | () | method |
public function getAttributes(names:Array):Array
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Experience Services - Composite Application Framework 9.5 |
Runtime Versions: | AIR 2.0.2, Flash Player 10.1 |
Returns an array of named attributes from the context.
Parameters
names:Array — The names of the attributes to retrieve.
|
Array — The objects stored in the context.
|
Related API Elements
removeAttributesWatcher | () | method |
public function removeAttributesWatcher(names:Array, listener:Object):void
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Experience Services - Composite Application Framework 9.5 |
Runtime Versions: | AIR 2.0.2, Flash Player 10.1 |
Removes a watcher from a specific set of context attributes.
The watcher only triggers when all the attributes are set by a call to setAttributes
that
matches the list of watched attributes.
Parameters
names:Array — The name of the context object to no longer watch.
| |
listener:Object — A function that takes in one parameter of type PropertyChangeEvent that will be
called any time a set is called with this name.
|
Related API Elements
removeAttributeWatcher | () | method |
public function removeAttributeWatcher(name:String, listener:Object):void
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Experience Services - Composite Application Framework 9.5 |
Runtime Versions: | AIR 2.0.2, Flash Player 10.1 |
Removes a watcher from the context.
The context watchers behave similar to watchers in Flex, with the exception that the context attributes do not need to be set in advance of creating the watcher. This way a tile can watch for an attribute that has not previously been set.
Parameters
name:String — The name of the context object to no longer watch.
| |
listener:Object — A function that takes in one parameter of type PropertyChangeEvent that will be
called any time a set is called with this name.
|
Related API Elements
setAttribute | () | method |
public function setAttribute(name:String, value:*):void
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Experience Services - Composite Application Framework 9.5 |
Runtime Versions: | AIR 2.0.2, Flash Player 10.1 |
Sets a single attribute in the context to a value. Attribute names must follow the variable naming conventions in ActionScript (must start with a letter, etc).
Parameters
name:String — The name of the attribute to set.
| |
value:* — An object to store in the context.
|
Related API Elements
setAttributes | () | method |
public function setAttributes(names:Array, values:Array):void
Language Version: | ActionScript 3.0 |
Product Version: | Adobe Digital Enterprise Platform Experience Services - Composite Application Framework 9.5 |
Runtime Versions: | AIR 2.0.2, Flash Player 10.1 |
Sets an array of context attributes.
This method provides a convenient way of setting many
attributes at once, instead of using multiple instances of setAttribute
.
This method also calls complex change watchers.
Parameters
names:Array — An array of the names of attributes to set in the context.
| |
values:Array — An array of the values to set for the attributes.
|
Related API Elements
<?xml version="1.0" encoding="utf-8"?> <mc:Tile xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/halo" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mc="com.adobe.mosaic.core.*" xmlns:comps="*" layout="absolute" width="100%" height="100%" applicationComplete="{setMyAttributeValue();getMyAttributeValue()}"> <fx:Script> <![CDATA[ import com.adobe.mosaic.om.interfaces.IContext; private const M_STR_MY_ATTRIBUTE_NAME:String = "MyAttribute"; // Set the value of an application context variable private function setMyAttributeValue():void { var appContext:IContext = this.mosaicApp.context; appContext.setAttribute(M_STR_MY_ATTRIBUTE_NAME, "My attribute value"); } // setMyAttributeValue // Get the value of an application context variable private function getMyAttributeValue():void { var appContext:IContext = this.mosaicApp.context; var strMyAttributeValue:String = appContext.getAttribute(M_STR_MY_ATTRIBUTE_NAME); labelAttributeValue.text = strMyAttributeValue; } ]]> </fx:Script> <s:Label id="labelAttributeValue" text=""/> </mc:Tile>
Wed Nov 21 2018, 06:34 AM -08:00