1 | /* LoadBoardConfigCommand.as */
|
---|
2 |
|
---|
3 | package gov.va.med.edp.command.config
|
---|
4 | {
|
---|
5 | import com.adobe.cairngorm.commands.ICommand;
|
---|
6 | import com.adobe.cairngorm.control.CairngormEvent;
|
---|
7 |
|
---|
8 | import gov.va.med.edp.command.AbstractResponderCommand;
|
---|
9 | import gov.va.med.edp.business.config.LoadBoardConfigDelegate;
|
---|
10 | import gov.va.med.edp.control.config.BoardConfigEvent;
|
---|
11 | import gov.va.med.edp.model.TrackingModelLocator;
|
---|
12 | import gov.va.med.edp.factory.TrackingFactory;
|
---|
13 | import gov.va.med.edp.factory.SessionFactory;
|
---|
14 | import gov.va.med.edp.util.BoardTools;
|
---|
15 | import gov.va.med.edp.util.Vista;
|
---|
16 |
|
---|
17 | import mx.rpc.IResponder;
|
---|
18 | import mx.rpc.events.FaultEvent;
|
---|
19 | import mx.rpc.events.ResultEvent;
|
---|
20 |
|
---|
21 | public class LoadBoardConfigCommand extends AbstractResponderCommand implements ICommand, IResponder
|
---|
22 | {
|
---|
23 | private var model:TrackingModelLocator = TrackingModelLocator.getInstance();
|
---|
24 |
|
---|
25 | public function execute(event:CairngormEvent): void
|
---|
26 | {
|
---|
27 | model.config.boardLoaded = false;
|
---|
28 | var e: BoardConfigEvent = BoardConfigEvent(event);
|
---|
29 | var delegate: LoadBoardConfigDelegate = new LoadBoardConfigDelegate(this);
|
---|
30 | delegate.loadBoardConfig(model.logArea, e.boardID);
|
---|
31 | }
|
---|
32 |
|
---|
33 | public override function result(data:Object): void
|
---|
34 | {
|
---|
35 | var xml:XML = ResultEvent(data).result as XML;
|
---|
36 |
|
---|
37 | // load specific board spec
|
---|
38 | BoardTools.applyBoardSpec(model.config, xml);
|
---|
39 | model.config.boardLoaded = true;
|
---|
40 | }
|
---|
41 |
|
---|
42 | protected override function getFaultMessage(faultEvent:FaultEvent):String {
|
---|
43 | return "Error loading configuration for display board: " + super.getFaultMessage(faultEvent);
|
---|
44 | }
|
---|
45 | }
|
---|
46 | }
|
---|