source: EDIS/tags/ed/tracking-ui-core/src/main/flex/gov/va/med/edp/command/config/SaveConfigParamsCommand.as@ 1240

Last change on this file since 1240 was 1240, checked in by George Lilly, 13 years ago

new version from the VA

File size: 1.8 KB
Line 
1/* SaveConfigParamsCommand.as */
2
3package 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.business.config.SaveConfigParamsDelegate;
9 import gov.va.med.edp.command.AbstractResponderCommand;
10 import gov.va.med.edp.factory.TrackingFactory;
11 import gov.va.med.edp.model.TrackingModelLocator;
12 import gov.va.med.edp.widget.InfoDialog;
13
14 import mx.rpc.IResponder;
15 import mx.rpc.events.FaultEvent;
16 import mx.rpc.events.ResultEvent;
17
18 public class SaveConfigParamsCommand extends AbstractResponderCommand implements ICommand, IResponder
19 {
20 private var model:TrackingModelLocator = TrackingModelLocator.getInstance();
21
22 public function execute(event:CairngormEvent):void
23 {
24 var delegate: SaveConfigParamsDelegate = new SaveConfigParamsDelegate(this);
25 model.config.paramLoaded = false;
26 delegate.saveConfigParams(model.logArea, model.config.params, model.config.paramToken);
27 }
28
29 public override function result(data:Object):void
30 {
31 var xml:XML = ResultEvent(data).result as XML;
32 if ((xml.save.@status == "ok") || (xml.save.@status == "collide")) {
33 model.config.params = TrackingFactory.buildLogEditParamsFromXML(xml.params[0]);
34 model.config.paramToken = xml.paramToken;
35 model.config.paramMods = false;
36 model.config.paramLoaded = true;
37
38 if (xml.save.@status == "ok") {
39 InfoDialog.show("New parameter configuration saved.");
40 } else {
41 InfoDialog.show("Save failed: " + xml.save);
42 }
43 }
44
45 if (xml.save.@status == "fail") {
46 InfoDialog.show("Save failed: " + xml.save);
47 }
48 }
49
50 protected override function getFaultMessage(faultEvent:FaultEvent):String {
51 return "Error saving configuration for parameters: " + super.getFaultMessage(faultEvent);
52 }
53 }
54}
Note: See TracBrowser for help on using the repository browser.