Created
October 18, 2010 22:52
-
-
Save Stray/633238 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class WarnIfCurrentEditDataIsChangedCommand extends Command | |
| { | |
| [Inject] | |
| public var getEditedVOSignalResponsePair:GetEditedVOSignalResponsePair; | |
| [Inject] | |
| public var editingModel:IEditingModel; | |
| [Inject] | |
| public var dataChangeEvent:AdminDataEvent; | |
| override public function execute():void | |
| { | |
| getEditedVOSignalResponsePair.addToResponse(compareData); | |
| getEditedVOSignalResponsePair.dispatchRequest(); | |
| } | |
| private function compareData(editedVO:AdminDataVO):void | |
| { | |
| var currentStoredVO:AdminDataVO = editingModel.itemBeingEdited; | |
| if(ObjectUtil.compare(currentStoredVO, editedVO) == 0) | |
| { | |
| editingModel.itemBeingEdited = dataChangeEvent.adminDataVO; | |
| return; | |
| } | |
| else | |
| { | |
| // create the warning dialog with handlers | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class GetEditedVOSignalResponsePair extends SyncSignalResponsePair { | |
| public function GetEditedVOSignalResponsePair() { | |
| super([], [AdminDataVO]); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // we have to create the Signal so that the mediator can register the handler even before it is injected | |
| // this is for RL 1.0 - might not be required in later versions | |
| var getEditedVOSignalResponsePair:GetEditedVOSignalResponsePair = new GetEditedVOSignalResponsePair(); | |
| injector.mapValue(GetEditedVOSignalResponsePair, getEditedVOSignalResponsePair); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Inject] | |
| public var getEditedVOSignalResponsePair:GetEditedVOSignalResponsePair; | |
| override public function onRegister():void | |
| { | |
| getEditedVOSignalResponsePair.addToRequest(respondWithVO); | |
| } | |
| private function respondWithVO(responseSignal:Signal):void | |
| { | |
| var accountVO:AccountDataVO = view.populateVO(); | |
| responseSignal.dispatch(accountVO); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment