[1227] | 1 | /* InitDisplayBoardCommand.as */
|
---|
| 2 |
|
---|
| 3 | package gov.va.med.edp.command
|
---|
| 4 | {
|
---|
| 5 | import com.adobe.cairngorm.commands.ICommand;
|
---|
| 6 | import com.adobe.cairngorm.control.CairngormEvent;
|
---|
| 7 |
|
---|
| 8 | import gov.va.med.edp.business.InitDisplayBoardDelegate;
|
---|
| 9 | import gov.va.med.edp.control.DisplayBoardEvent;
|
---|
| 10 | import gov.va.med.edp.factory.TrackingFactory;
|
---|
| 11 | import gov.va.med.edp.model.BigBoardDebugInfo;
|
---|
| 12 | import gov.va.med.edp.model.TrackingModelLocator;
|
---|
| 13 | import gov.va.med.edp.util.BoardTools;
|
---|
| 14 |
|
---|
| 15 | import mx.collections.XMLListCollection;
|
---|
| 16 | import mx.rpc.IResponder;
|
---|
| 17 | import mx.rpc.events.FaultEvent;
|
---|
| 18 | import mx.rpc.events.ResultEvent;
|
---|
| 19 |
|
---|
| 20 | public class InitDisplayBoardCommand extends AbstractResponderCommand implements ICommand, IResponder
|
---|
| 21 | {
|
---|
| 22 | private var model:TrackingModelLocator = TrackingModelLocator.getInstance();
|
---|
| 23 |
|
---|
| 24 | public function execute(event:CairngormEvent):void
|
---|
| 25 | {
|
---|
| 26 | var delegate:InitDisplayBoardDelegate = new InitDisplayBoardDelegate(this);
|
---|
| 27 | var initEvent:DisplayBoardEvent = DisplayBoardEvent(event);
|
---|
| 28 | delegate.initDisplayBoard(model.session.area, initEvent.name);
|
---|
| 29 | model.boardSpec.specReady = false;
|
---|
| 30 | model.boardReady = false;
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | public override function result(data:Object):void
|
---|
| 34 | {
|
---|
| 35 | var xml: XML = ResultEvent(data).result as XML;
|
---|
| 36 |
|
---|
| 37 | // build the color maps first so they can be referenced by columns
|
---|
| 38 | model.boardSpec.colorMaps = TrackingFactory.buildColorMapListFromXML(xml.colorSpec.colors);
|
---|
| 39 |
|
---|
| 40 | // build the column specs
|
---|
| 41 | model.boardSpec.columns =
|
---|
| 42 | TrackingFactory.buildColumnSpecListFromXML(xml.spec.col, model.boardSpec.colorMaps);
|
---|
| 43 |
|
---|
| 44 | //build display properties
|
---|
| 45 | model.boardSpec.displayBoardProperties =
|
---|
| 46 | TrackingFactory.buildDisplayBoardPropertiesFromXML(xml.spec.displayProperties);
|
---|
| 47 |
|
---|
| 48 | // build the row spec
|
---|
| 49 | model.boardSpec.rowColorMap =
|
---|
| 50 | BoardTools.locateColorMap(xml.spec.row.@color, model.boardSpec.colorMaps);
|
---|
| 51 |
|
---|
| 52 | // load the actual data for the board
|
---|
| 53 | model.boardData = new XMLListCollection(xml.rows.children() as XMLList);
|
---|
| 54 |
|
---|
| 55 | model.bigboardInfo = new BigBoardDebugInfo();
|
---|
| 56 | model.bigboardInfo.bigBoardSiteCode = xml.vistalinkConnectionInfo.siteId;
|
---|
| 57 | model.bigboardInfo.bigBoardMachineName = xml.vistalinkConnectionInfo.machineName;
|
---|
| 58 | model.bigboardInfo.vistaLinkIPAddress = xml.vistalinkConnectionInfo.vistalinkIPAddress;
|
---|
| 59 | model.bigboardInfo.vistaLinkPort = xml.vistalinkConnectionInfo.vistalinkPort;
|
---|
| 60 |
|
---|
| 61 | model.boardSpec.specReady = true;
|
---|
| 62 |
|
---|
| 63 | model.boardLastUpdated = new Date();
|
---|
| 64 | model.boardReady = true;
|
---|
| 65 |
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | protected override function getFaultMessage(faultEvent:FaultEvent):String {
|
---|
| 69 | return "Initialize display board failed: " + super.getFaultMessage(faultEvent);
|
---|
| 70 | }
|
---|
| 71 | }
|
---|
| 72 | }
|
---|