Menu

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

Download this file

192 lines (158 with data), 5.7 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2007 - 2009 Adobe
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
-->
<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.*">
<mx:Script>
<![CDATA[
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>
<cairngorm:CairngormModuleSupport/>
<cairngorm:CairngormModuleXMLSupport/>
<spicefactory:XmlConfig file="runtimeContext.xml"/>
</spicefactory:ContextBuilder>
<spicefactory:Configure/>
<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:CairngormModuleSupport/>
<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.