source: EDIS/trunk/java/tracking-ui-core/src/main/flex/gov/va/med/edp/view/ErrorDialog.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.0 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" title="Emergency Department Integration Software Error"
3 creationComplete="creationCompleteHandler()" minWidth="600" showCloseButton="false" horizontalAlign="right" verticalAlign="top"
4 layout="vertical" xmlns:accessibility="flash.accessibility.*">
5 <mx:Script>
6
7 <![CDATA[
8 import gov.va.med.edp.util.AccessibilityTools;
9 import gov.va.med.edp.control.ModalDialogEvent;
10 import gov.va.med.edp.control.ClearUnsavedViewsModelEvent;
11 import gov.va.med.edp.model.TrackingModelLocator;
12 import mx.utils.ObjectUtil;
13 import mx.collections.ArrayCollection;
14 import mx.core.Application;
15 import mx.core.IFlexDisplayObject;
16 import mx.events.CloseEvent;
17 import mx.managers.PopUpManager;
18
19 [Bindable]
20 private var message : String;
21
22 [Bindable]
23 private var details : String;
24
25 [Bindable]
26 private var closeButtonLabel : String;
27
28 private var closeListener : Function = null;
29
30 public static function show(message:String,
31 detail:Object = null,
32 title:String = null,
33 closeListener:Function = null,
34 closeButtonLabel:String = "Close") : void {
35 var dialog:ErrorDialog = ErrorDialog(PopUpManager.createPopUp(Application.application as DisplayObject, ErrorDialog, true));
36 if (title != null && title.length > 0)
37 dialog.title = title;
38 dialog.closeButtonLabel = closeButtonLabel;
39 dialog.message = message;
40 dialog.details = detail != null ? ObjectUtil.toString(detail) : "No details available for this error.";
41 dialog.closeListener = closeListener;
42
43 //Dispatch the event for getting clear background on PopuP Modal Dialog to support Jaws Virtual Cursor Mode..
44 Application.application.dispatchEvent(new ModalDialogEvent(ModalDialogEvent.OPEN));
45 PopUpManager.centerPopUp(dialog);
46 }
47
48 public static function fatal(message:String, detail:Object = null, title:String = null) : void {
49 show(message, detail, title, logout, "Exit");
50 }
51
52 private static function logout(): void {
53 ClearUnsavedViewsModelEvent.dispatchClearUnsavedViews();
54 TrackingModelLocator.getInstance().logout();
55 }
56
57 private function closeButtonHandler() : void {
58 //Dispatch the event for removing the clear background on closing PopuP Modal Dialog and returning to normal view
59 Application.application.dispatchEvent(new ModalDialogEvent(ModalDialogEvent.CLOSE));
60
61 PopUpManager.removePopUp(this);
62 if (closeListener != null) {
63 closeListener();
64 }
65 }
66
67 private function copyToClipboard() : void {
68 flash.system.System.setClipboard(details);
69 }
70
71 private function creationCompleteHandler() : void {
72 var focusTimer: Timer = new Timer(350, 1);
73 focusTimer.addEventListener(TimerEvent.TIMER, moveFocus);
74 focusTimer.start();
75
76 }
77
78 private function moveFocus(e: TimerEvent): void
79 {
80 if (AccessibilityTools.isAccessibilityActive()) {
81 messageBox.setFocus();
82 messageBox.editable = true;
83 } else {
84 closeBtn.setFocus();
85 }
86 }
87
88 ]]>
89 </mx:Script>
90 <accessibility:AccessibilityProperties name="Popup Dialog {this.title}" id="accessibleMessage"/>
91
92 <mx:states>
93 <mx:State name="detailsShowing">
94 <mx:AddChild relativeTo="{content}" position="lastChild">
95 <mx:TextArea id="detailArea" width="100%" minWidth="400" minHeight="300" text="{details}"/>
96 </mx:AddChild>
97 <mx:AddChild relativeTo="{spacer}" position="before">
98 <mx:Button label="Copy to Clipboard" id="copy2ClipboardButton" click="copyToClipboard();"/>
99 </mx:AddChild>
100 <mx:RemoveChild target="{showDetailsButton}"/>
101 <mx:AddChild relativeTo="{closeBtn}" position="before">
102 <mx:Button id="hideButton" label="Hide Details" click="currentState = '';"/>
103 </mx:AddChild>
104 </mx:State>
105 </mx:states>
106 <mx:VBox id="content" height="100%" width="100%">
107 <mx:HBox width="100%" verticalAlign="middle">
108 <mx:Image source="@Embed('critical_icon.jpg')" width="32" height="32"/>
109 <mx:TextArea id="messageBox" text="{message}" width="100%" enabled="true" borderThickness="0" editable="false" accessibilityProperties="{accessibleMessage}"/>
110 </mx:HBox>
111 </mx:VBox>
112 <mx:ControlBar id="buttonBar" horizontalAlign="right">
113 <mx:Spacer id="spacer" width="100%"/>
114 <mx:Button id="showDetailsButton" label="Show Details" click="currentState = 'detailsShowing';"/>
115 <mx:Button id="closeBtn" label="{closeButtonLabel}" click="closeButtonHandler();"/>
116 </mx:ControlBar>
117</mx:TitleWindow>
Note: See TracBrowser for help on using the repository browser.