[1240] | 1 | <?xml version="1.0" ?>
|
---|
| 2 | <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml"
|
---|
| 3 | xmlns:pt="gov.va.med.edp.pt.demog.view.*"
|
---|
| 4 | layout="vertical" headerHeight="4"
|
---|
| 5 | borderStyle="solid" borderThickness="12" borderColor="#CCCCCC"
|
---|
| 6 | paddingTop="12" paddingLeft="12" paddingRight="12" paddingBottom="0"
|
---|
| 7 | implements="mx.managers.IFocusManagerContainer">
|
---|
| 8 | <mx:Script><![CDATA[
|
---|
| 9 | import mx.core.Application;
|
---|
| 10 | import gov.va.med.edp.util.AccessibilityTools;
|
---|
| 11 | import gov.va.med.edp.pt.demog.model.PatientSelectVO;
|
---|
| 12 | import gov.va.med.edp.control.ModalDialogEvent;
|
---|
| 13 | import mx.managers.PopUpManager;
|
---|
| 14 | import gov.va.med.edp.pt.demog.IPatientChecksController;
|
---|
| 15 | import gov.va.med.edp.pt.demog.model.PatientChecksModel;
|
---|
| 16 |
|
---|
| 17 | public static function show(cntrl:IPatientChecksController, ptChecksModel:PatientChecksModel, patient:PatientSelectVO = null, dialogParent:Sprite = null, closeHandler:Function = null, centered:Boolean = false):void {
|
---|
| 18 | var dialog:SelectPatientDialog = createDialog(cntrl, ptChecksModel, patient, dialogParent, closeHandler);
|
---|
| 19 | if (dialogParent != null) {
|
---|
| 20 | dialogParent.dispatchEvent(new ModalDialogEvent(ModalDialogEvent.OPEN, dialog));
|
---|
| 21 | }
|
---|
| 22 | if (!AccessibilityTools.isAccessibilityActive()) { // when accessibility active, we don't use a popup, so popup location is irreleant
|
---|
| 23 | if (dialogParent != null) {
|
---|
| 24 | dialog.validateNow();
|
---|
| 25 | var point:Point = new Point();
|
---|
| 26 | point = dialogParent.localToGlobal(point);
|
---|
| 27 | point.y += dialogParent.height;
|
---|
| 28 | if (centered) {
|
---|
| 29 | point.x -= ((dialog.width - dialogParent.width) / 2);
|
---|
| 30 | }
|
---|
| 31 | if ((point.x + dialog.width) > Application.application.systemManager.screen.width) {
|
---|
| 32 | dialog.x = Application.application.systemManager.screen.width - dialog.width;
|
---|
| 33 | } else {
|
---|
| 34 | dialog.x = point.x;
|
---|
| 35 | }
|
---|
| 36 | dialog.y = point.y;
|
---|
| 37 | } else {
|
---|
| 38 | PopUpManager.centerPopUp(dialog);
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | private static function createDialog(cntrl:IPatientChecksController, ptChecksModel:PatientChecksModel, patient:PatientSelectVO, dialogParent:Sprite, closeHandler:Function):SelectPatientDialog {
|
---|
| 44 | var dialog:SelectPatientDialog = null;
|
---|
| 45 | if (AccessibilityTools.isAccessibilityActive()) // no popup when accessibility is active
|
---|
| 46 | dialog = new SelectPatientDialog();
|
---|
| 47 | else
|
---|
| 48 | dialog = SelectPatientDialog(PopUpManager.createPopUp(dialogParent, SelectPatientDialog, true));
|
---|
| 49 | dialog.ptChecksController = cntrl;
|
---|
| 50 | dialog.model = ptChecksModel;
|
---|
| 51 | dialog.dialogParent = dialogParent;
|
---|
| 52 | dialog.closeHandler = closeHandler;
|
---|
| 53 | dialog.patient = patient;
|
---|
| 54 | return dialog;
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | private function close(event:SelectPatientEvent):void {
|
---|
| 58 | if (closed) return;
|
---|
| 59 | closed = true;
|
---|
| 60 | if (closeHandler != null) closeHandler(event);
|
---|
| 61 | if (dialogParent != null) dialogParent.dispatchEvent(new ModalDialogEvent(ModalDialogEvent.CLOSE));
|
---|
| 62 | if (!AccessibilityTools.isAccessibilityActive()) PopUpManager.removePopUp(this); // no popup when accessibility is active
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | [Bindable]
|
---|
| 66 | public var ptChecksController:IPatientChecksController;
|
---|
| 67 |
|
---|
| 68 | [Bindable]
|
---|
| 69 | public var model:PatientChecksModel;
|
---|
| 70 |
|
---|
| 71 | [Bindable]
|
---|
| 72 | public var patient:PatientSelectVO;
|
---|
| 73 |
|
---|
| 74 | private var dialogParent:Sprite;
|
---|
| 75 | private var closeHandler:Function;
|
---|
| 76 | private var closed:Boolean = false;
|
---|
| 77 |
|
---|
| 78 | ]]></mx:Script>
|
---|
| 79 | <pt:SelectPatientPanel model="{model}" ptChecksController="{ptChecksController}"
|
---|
| 80 | cancel="close(event)" selectPatient="close(event)" initialPatient="{patient}"/>
|
---|
| 81 | </mx:Panel> |
---|