Menu

[r328]: / cairngorm3 / trunk / libraries / ModuleTest / src / CairngormModuleLibRuntimeSample.mxml  Maximize  Restore  History

Download this file

123 lines (94 with data), 4.3 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:example="example.*"
layout="vertical" width="100%" height="100%"
xmlns:spicefactory="http://www.spicefactory.org/parsley"
xmlns:cairngorm="com.adobe.cairngorm.*" xmlns:module="com.adobe.cairngorm.module.*">
<mx:Script>
<![CDATA[
import com.adobe.cairngorm.module.ModuleMessageInterceptor;
import com.adobe.cairngorm.module.ParsleyModuleDescriptor;
import example.api.BroadcastMessage;
import example.api.ClearLogMessage;
import example.api.PingMessage;
import example.api.PongMessage;
import mx.logging.LogEventLevel;
import mx.modules.IModuleInfo;
import org.spicefactory.lib.reflect.ClassInfo;
[Bindable]
[Inject(id="moduleA")]
public var moduleA:IModuleInfo;
[Bindable]
[Inject(id="moduleB")]
public var moduleB:IModuleInfo;
[Bindable]
[Inject(id="moduleC")]
public var moduleC:IModuleInfo;
[MessageDispatcher]
public var dispatcher:Function;
private var compile:Array = [PongMessage, ClearLogMessage, ClassInfo];
protected function dispatchPingMessage(moduleId:String=null):void
{
dispatcher( new PingMessage(moduleId) );
}
protected function dispatchBroadcastMessage():void
{
dispatcher( new BroadcastMessage() );
}
private var moduleCount:int = 5;
protected function button1_clickHandler(event:MouseEvent):void
{
var modulePod:ModulePod = new ModulePod();
modulePod.percentWidth=100;
modulePod.percentHeight=100;
modulePod.label=modulePod.moduleId="moduleA"+moduleCount++;
modulePod.moduleInfo=moduleA;
tabNav.addChild(modulePod);
}
]]>
</mx:Script>
<spicefactory:ContextBuilder>
<module:ModuleXMLSupport/>
<spicefactory:XmlConfig file="runtimeContext.xml" />
</spicefactory:ContextBuilder>
<mx:Button label="Wire" click="dispatchEvent(new Event('configureView', true));"/>
<mx:TraceTarget level="{ LogEventLevel.DEBUG }" includeCategory="true">
<mx:filters>
<mx:Array>
<mx:String>com.adobe.cairngorm.*</mx:String>
<mx:String>org.spicefactory.*</mx:String>
</mx:Array>
</mx:filters>
</mx:TraceTarget>
<cairngorm:CairngormModuleLib />
<mx:HBox width="100%">
<mx:Button label="Ping moduleA" click="dispatchPingMessage('moduleA')" />
<mx:Button label="Ping moduleA2" click="dispatchPingMessage('moduleA2')" />
<mx:Button label="Ping moduleB" click="dispatchPingMessage('moduleB')" />
<mx:Button label="Pong ModuleC" click="dispatcher( new PongMessage() )" />
<mx:Button label="Ping all ModuleA" click="dispatchBroadcastMessage()" />
<mx:Spacer width="10" />
<mx:Button label="CLEAR ALL LOGS" click="dispatcher( new ClearLogMessage() )" />
<mx:Spacer width="100%" />
<mx:Button label="Add new instance of ModuleA" click="button1_clickHandler(event)" />
<mx:TextInput id="moduleIdInput" width="150" text="moduleA3"/>
<mx:Button label="Ping" click="dispatchPingMessage(moduleIdInput.text)" />
</mx:HBox>
<mx:HBox width="100%" height="100%">
<mx:VBox width="350" height="100%">
<example:ModulePod width="100%" height="25%" moduleId="moduleA" moduleInfo="{ moduleA }" label="moduleA" />
<example:ModulePod width="100%" height="25%" moduleId="moduleA2" moduleInfo="{ moduleA }" label="moduleA2" />
<example:ModulePod width="100%" height="25%" moduleId="moduleB" moduleInfo="{ moduleB }" label="moduleB" />
<mx:ViewStack width="100%" height="25%" id="moduleCStack">
<mx:Canvas width="100%" height="100%">
<mx:Button horizontalCenter="0" verticalCenter="0" label="Instantiate ModuleC"
click="moduleCStack.selectedIndex=1"/>
</mx:Canvas>
<example:ModulePod width="100%" height="100%" moduleInfo="{ moduleC }" label="moduleC" />
</mx:ViewStack>
</mx:VBox>
<mx:TabNavigator width="100%" height="400" id="tabNav">
<example:ModulePod width="100%" height="100%" moduleId="moduleA3" moduleInfo="{ moduleA }" label="moduleA3" />
<example:ModulePod width="100%" height="100%" moduleId="moduleA4" moduleInfo="{ moduleA }" label="moduleA4" />
</mx:TabNavigator>
</mx:HBox>
</mx:Application>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.