source: EDIS/trunk/java/tracking-ui-bigboard/src/main/flex/bigboard.mxml@ 1227

Last change on this file since 1227 was 1227, checked in by George Lilly, 13 years ago

initial load of EDIS 1.0

File size: 10.9 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<!-- BigBoard.mxml -->
3
4<mx:Application
5 xmlns:mx="http://www.adobe.com/2006/mxml"
6 xmlns:control="gov.va.med.edp.control.*"
7 xmlns:business="gov.va.med.edp.business.*"
8 xmlns:view="gov.va.med.edp.view.*"
9 xmlns:log="gov.va.med.edp.view.log.*"
10 pageTitle="Tracking Display Board"
11 height="100%"
12 width="100%"
13 paddingLeft="0" paddingRight="0" paddingBottom="0"
14 paddingTop="6"
15 creationComplete="initApp()" xmlns:board="gov.va.med.edp.view.board.*">
16
17 <mx:Style source="edp.css"/>
18
19 <mx:Script>
20 <![CDATA[
21 import flash.utils.Timer;
22 import flash.events.TimerEvent;
23 import mx.managers.SystemManager;
24 import mx.core.Container;
25 import mx.utils.URLUtil;
26 import com.adobe.cairngorm.control.CairngormEventDispatcher;
27 import com.adobe.cairngorm.control.CairngormEvent;
28 import gov.va.med.edp.model.TrackingModelLocator;
29 import gov.va.med.edp.control.InitAppEvent;
30 import gov.va.med.edp.util.InactivityTimeout;
31 import com.adobe.cairngorm.business.ServiceLocator;
32 import gov.va.med.edp.business.Services;
33
34 public static const VERSION_INCOMPATIBILITY_RELOAD_COUNTDOWN:int = 10;
35
36 [Bindable]
37 public var model:TrackingModelLocator = TrackingModelLocator.getInstance();
38
39 [Bindable]
40 private var inactivityTimeout:InactivityTimeout = new InactivityTimeout();
41
42 private var reloadTimer : Timer;
43 private var digitalClockTimer:Timer;
44
45 private function initApp():void
46 {
47
48 var e: InitAppEvent = new InitAppEvent(InitAppEvent.EVENT_INIT_APP);
49 e.appName = TrackingModelLocator.APP_NAME_BIGBOARD;
50 e.contextRoot = Application.application.parameters.contextRoot;
51 e.helpContextRoot = Application.application.parameters.helpContextRoot;
52 e.protocol = URLUtil.getProtocol(Application.application.url);
53 if (e.protocol == "file") e.protocol = "http";
54
55 // first check the vljServ parameter
56 if (Application.application.parameters.hasOwnProperty("vljServ")) {
57 e.server = Application.application.parameters.vljServ;
58 e.mode = InitAppEvent.SERVICE_USE_VLJ;
59 }
60 if (Application.application.parameters.hasOwnProperty("timeout")) {
61 e.timeout = new Boolean(Application.application.parameters.timeout);
62 }
63 if (Application.application.parameters.hasOwnProperty("siteId")) {
64 e.siteId = Application.application.parameters.siteId;
65 }
66 if (Application.application.parameters.hasOwnProperty("area")) {
67 e.areaName = Application.application.parameters.area;
68 }
69
70
71 // then check the cspServ parameter
72 if ((e.server.length == 0) && Application.application.parameters.hasOwnProperty("cspServ")) {
73 e.server = Application.application.parameters.cspServ;
74 e.mode = InitAppEvent.SERVICE_USE_CSP;
75 e.token = Application.application.parameters.cspToken;
76 }
77 // if running in development mode try localhost
78 if ((e.server.length == 0) && (Application.application.url.substr(0, 7) == "file://")) {
79 e.server = "localhost:7001";
80 e.mode = InitAppEvent.SERVICE_USE_VLJ;
81 }
82 // default: use the server and port of the HTML wrapper with VLJ
83 if (e.server.length == 0) {
84 e.server = URLUtil.getServerNameWithPort(Application.application.url);
85 e.mode = InitAppEvent.SERVICE_USE_VLJ;
86 }
87 e.dispatch();
88
89 Application.application.pageTitle = "Tracking System: " + e.server;
90 //set up the digital clock
91 digitalClockTimer = new Timer(1000);
92 digitalClockTimer.addEventListener(TimerEvent.TIMER, resetClock);
93 digitalClockTimer.start();
94 }
95
96 private function resetClock(event:TimerEvent):void {
97 //currentMemoryLbl.text = "Total Flash Player Memory (bytes): " + System.totalMemory ;
98 var clockDate:Date = new Date();
99 currentDateLbl.text = clockDate.toLocaleDateString() + ", " + clockDate.toLocaleTimeString();
100 }
101
102 private function getView(view:Number): Container
103 {
104 switch (view) {
105 case TrackingModelLocator.VIEW_APP_INTRO: return introView;
106 case TrackingModelLocator.VIEW_APP_VERSION_INCOMPATIBILITY: return versionIncompatibilityView;
107 case TrackingModelLocator.VIEW_APP_DISPLAY_BOARD: return bigBoard;
108 default: return noneView;
109 }
110 }
111
112 [Bindable(event="secondsUntilReloadChanged")]
113 public function get secondsUntilReload():int {
114 if (reloadTimer == null)
115 return VERSION_INCOMPATIBILITY_RELOAD_COUNTDOWN;
116 else
117 return reloadTimer.repeatCount - reloadTimer.currentCount;
118 }
119
120 private function updateSecondsUntilReload(e:TimerEvent):void {
121 dispatchEvent(new Event("secondsUntilReloadChanged"));
122 }
123
124 private function startTimer(): void {
125 if (reloadTimer == null) {
126 reloadTimer = new Timer(1000, VERSION_INCOMPATIBILITY_RELOAD_COUNTDOWN);
127 reloadTimer.addEventListener(TimerEvent.TIMER, updateSecondsUntilReload);
128 reloadTimer.addEventListener(TimerEvent.TIMER_COMPLETE, reloadApp);
129 }
130 reloadTimer.reset();
131 reloadTimer.start();
132 }
133
134 private function reloadApp(e:TimerEvent):void {
135 model.logout();
136 }
137
138 private function set initSessionTimeout(value: uint):void
139 {
140 if (Application.application.parameters.hasOwnProperty("timeout")) {
141 var timeoutEnabled: Boolean = new Boolean(Application.application.parameters.timeout);
142 if (timeoutEnabled) inactivityTimeout.start();
143 }
144
145 }
146
147 public function set workingStatus(bText:String):void
148 {
149 if (bText.length > 0) {
150 currentState = 'sessionTimeOutState';
151 lblWorkingStatus.text = bText;
152 } else {
153 currentState = "";
154 lblWorkingStatus.text = "";
155 }
156 }
157
158 private function set addDebugTooltip(value: Boolean): void
159 {
160 var debugStr: String = "EDIS Version=" + model.appClientVersion + "\n";
161 if (model.bigboardInfo != null && value){
162 if (model.bigboardInfo.bigBoardSiteCode.length > 0 && model.bigboardInfo.bigBoardSiteCode != "null")debugStr = debugStr + "Site=" + model.bigboardInfo.bigBoardSiteCode + "\n";
163 if (model.bigboardInfo.bigBoardMachineName.length > 0 && model.bigboardInfo.bigBoardMachineName != "null")debugStr = debugStr + "Machine=" + model.bigboardInfo.bigBoardMachineName + "\n";
164 if (model.bigboardInfo.vistaLinkIPAddress.length > 0 && model.bigboardInfo.vistaLinkIPAddress != "null")debugStr = debugStr + "Vistalink-IPAddress=" + model.bigboardInfo.vistaLinkIPAddress + "\n";
165 if (model.bigboardInfo.vistaLinkPort.length > 0 && model.bigboardInfo.vistaLinkPort != "null")debugStr = debugStr + "Vistalink-Port=" + model.bigboardInfo.vistaLinkPort + "\n";
166 }
167 currentDateLbl.toolTip = debugStr;
168 }
169
170
171
172
173 ]]>
174 </mx:Script>
175
176 <!-- ========================================================================== -->
177
178 <!-- the ServiceLocator where we specify the remote services -->
179 <business:Services id="services"/>
180
181 <!-- the FrontController, containing Commands specific to this appliation -->
182 <control:TrackingController id="controller"/>
183
184 <!-- ========================================================================== -->
185
186 <mx:ViewStack
187 id="appView"
188 width="100%"
189 height="100%"
190 selectedChild="{getView(model.appViewState)}">
191
192 <mx:TitleWindow id="introView" title="Emergency Department Integration Software"/>
193 <mx:Canvas id="noneView">
194 <mx:Label horizontalCenter="0" verticalCenter="0" text="No Views Configured"/>
195 </mx:Canvas>
196 <mx:Canvas id="versionIncompatibilityView" show="startTimer()">
197 <mx:Panel title="EDIS Version Incompatibility"
198 paddingTop="10" paddingLeft="10" paddingRight="10" horizontalCenter="0" verticalCenter="0"
199 width="75%">
200 <mx:Text width="100%">
201 <mx:text>
202 This is EDIS board version '{model.appClientVersion}'.
203 The EDIS server package version running in your VistA account is
204 '{model.session.serverPackageVersion}'.
205 It appears that the web server has served the wrong version of the board for your configuration.
206 Will attempt to load version '{model.session.serverPackageVersion}' of the board in
207 {secondsUntilReload} seconds.
208 </mx:text>
209 </mx:Text>
210 </mx:Panel>
211 </mx:Canvas>
212 <board:BigDisplayBoard id="bigBoard"/>
213 </mx:ViewStack>
214 <mx:HBox width="100%">
215 <mx:Label id="currentDateLbl" fontSize="10" width="100%" textAlign="center" fontWeight="bold"/>
216<!-- <mx:Label id="currentMemoryLbl" fontSize="10" width="100%" textAlign="center" fontWeight="bold"/> -->
217 </mx:HBox>
218 <mx:states>
219 <mx:State name="sessionTimeOutState">
220 <mx:AddChild relativeTo="{appView}" position="before">
221 <mx:target>
222 <mx:VBox id="disconnectedBoardPanel" width="100%">
223 <mx:ApplicationControlBar paddingBottom="0" paddingTop="0" dock="true" width="100%" fillColors="[#FF0000,#BF0000]" fillAlphas="[0.8,0.8]">
224 <mx:Text id="lblWorkingStatus" horizontalCenter="0" verticalCenter="0"
225 textAlign="center" width="100%" height="100%" color="white" fontSize="{model.boardSpec.displayBoardProperties.fontSize}"/>
226 </mx:ApplicationControlBar>
227 </mx:VBox>
228 </mx:target>
229 </mx:AddChild>
230 </mx:State>
231 </mx:states>
232 <mx:Binding source="model.session.timeOut" destination="initSessionTimeout"/>
233 <mx:Binding source="inactivityTimeout.status" destination="workingStatus"/>
234 <mx:Binding source="model.boardSpec.specReady" destination="addDebugTooltip"/>
235
236</mx:Application>
Note: See TracBrowser for help on using the repository browser.