source: EDIS/trunk/java/tracking-ui-core/src/main/flex/gov/va/med/edp/view/DisconnectedDialog.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: 5.2 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:widget="gov.va.med.edp.widget.*"
3 title="EDIS Server Unavailable"
4 creationComplete="creationCompleteHandler()"
5 minWidth="600" showCloseButton="false" horizontalAlign="right" verticalAlign="top" layout="vertical"
6 paddingTop="10" paddingLeft="10" paddingRight="10" xmlns:accessibility="flash.accessibility.*">
7 <mx:Script>
8 <![CDATA[
9 import gov.va.med.edp.util.AccessibilityTools;
10 import gov.va.med.edp.control.ModalDialogEvent;
11 import gov.va.med.edp.model.TrackingModelLocator;
12 import gov.va.med.edp.widget.Spinner;
13 import mx.binding.utils.ChangeWatcher;
14 import mx.collections.ArrayCollection;
15 import mx.controls.Spacer;
16 import mx.core.Application;
17 import mx.core.IFlexDisplayObject;
18 import mx.managers.PopUpManager;
19
20
21 private static var dialog:DisconnectedDialog;
22
23 public static function show() : void {
24 if (dialog != null) return;
25 dialog = DisconnectedDialog(PopUpManager.createPopUp(Application.application as DisplayObject, DisconnectedDialog, true));
26 //Dispatch the event for getting clear background on PopuP Modal Dialog to support Jaws Virtual Cursor Mode..
27 Application.application.dispatchEvent(new ModalDialogEvent(ModalDialogEvent.OPEN));
28 PopUpManager.centerPopUp(dialog);
29 }
30
31 public static function hide() : void {
32 if (dialog == null) return;
33 //Dispatch the event for removing the clear background on closing PopuP Modal Dialog and returning to normal view
34 Application.application.dispatchEvent(new ModalDialogEvent(ModalDialogEvent.CLOSE));
35 PopUpManager.removePopUp(dialog);
36 dialog = null;
37 }
38
39 [Bindable]
40 public var model:TrackingModelLocator = TrackingModelLocator.getInstance();
41
42 private var _connecting:Boolean;
43
44 [Bindable]
45 public function get connecting():Boolean {
46 return _connecting;
47 }
48
49 public function set connecting(b:Boolean):void {
50 _connecting = b;
51 if (_connecting) {
52 spinner.play();
53 } else {
54 spinner.stop();
55 }
56 }
57
58 private function connectingStatusChanged() : void {
59 if (model.connecting) {
60 spinner.play();
61 } else {
62 spinner.stop();
63 }
64 }
65
66 private function reconnectButtonHandler() : void {
67 model.attemptReconnect();
68 }
69
70 private function creationCompleteHandler() : void {
71 var focusTimer: Timer = new Timer(300, 1);
72 focusTimer.addEventListener(TimerEvent.TIMER, moveFocus);
73 focusTimer.start();
74 }
75
76 private function moveFocus(e: TimerEvent): void
77 {
78 if (AccessibilityTools.isAccessibilityActive()) {
79 messageBox.setFocus();
80 messageBox.editable = true;
81 } else {
82 reconnectNowButton.setFocus();
83 }
84 }
85
86 ]]>
87 </mx:Script>
88 <accessibility:AccessibilityProperties name="Popup Dialog {this.title}" id="accessibleMessage"/>
89
90 <mx:states>
91 <mx:State name="detailsShowing">
92 <mx:AddChild relativeTo="{content}" position="lastChild">
93 <mx:TextArea id="detailArea" width="100%" minWidth="400" minHeight="300" text="{model.disconnectionFault}"/>
94 </mx:AddChild>
95 <mx:RemoveChild target="{showDetailsButton}"/>
96 <mx:AddChild relativeTo="{reconnectNowButton}" position="before">
97 <mx:Button id="hideButton" label="Hide Details" click="currentState = '';"/>
98 </mx:AddChild>
99 </mx:State>
100 </mx:states>
101
102 <mx:VBox id="content" height="100%" width="100%">
103 <mx:HBox width="100%" verticalAlign="middle">
104 <mx:Image source="@Embed('critical_icon.jpg')" width="32" height="32"/>
105 <mx:TextArea id="messageBox" width="100%" editable="false" borderThickness="0" tabIndex="1"
106 text="The last attempt to connect to the server timed out due to either network or server unavailability. This program does not have the ability to diagnose the problem further."/>
107 </mx:HBox>
108 <mx:Label width="100%" textAlign="right" tabIndex="2"
109 text="{model.connecting ? '...trying to reconnect...' : 'Will try to reconnect in ' + model.reconnectSeconds + ' seconds.'}"/>
110 </mx:VBox>
111 <mx:ControlBar horizontalAlign="right">
112 <widget:Spinner id="spinner" autoPlay="false" numTicks="10" size="20" tickWidth="2"/>
113 <mx:Spacer id="spacer" width="100%"/>
114 <mx:Button id="showDetailsButton" label="Show Details" click="currentState = 'detailsShowing';" tabIndex="3"/>
115 <mx:Button id="reconnectNowButton" label="Try to Reconnect Now" click="reconnectButtonHandler()" tabIndex="4"
116 enabled="{!model.connecting}"/>
117 </mx:ControlBar>
118
119 <mx:Binding source="{model.connecting}" destination="connecting"/>
120</mx:TitleWindow>
Note: See TracBrowser for help on using the repository browser.