Skip to content

Instantly share code, notes, and snippets.

@Stray
Created October 21, 2010 18:23
Show Gist options
  • Save Stray/639015 to your computer and use it in GitHub Desktop.
Save Stray/639015 to your computer and use it in GitHub Desktop.
private function isACommand(commandClazz:Class):Boolean
{
if(describeType(commandClazz).factory.method.(@name == "execute").length() > 0)
{
return true;
}
return false;
}
override public function areObjectsEqual(accountVO1:AdminDataVO, accountVO2:AdminDataVO):Boolean
{
if((accountVO1 == null) && (accountVO2 == null)) return true;
if((accountVO1 == null) || (accountVO2 == null)) return false;
if(!super.areObjectsEqual(accountVO1, accountVO2)) return false;
if(accountVO1.password != accountVO2.password) return false;
if(accountVO1.email != accountVO2.email) return false;
if(accountVO1.serverID != accountVO2.serverID) return false;
if(accountVO1.dataSetID != accountVO2.dataSetID) return false;
if(accountVO1.pluginMixID != accountVO2.pluginMixID) return false;
if(accountVO1.adminPluginMixID != accountVO2.adminPluginMixID) return false;
if(accountVO1.isSuspended != accountVO2.isSuspended) return false;
return true;
}
override public function execute():void
{
getEditedVOSignalResponsePair.addToResponseOnce(compareData);
getEditedVOSignalResponsePair.dispatchRequest();
}
private function compareData(editedVO:AdminDataVO):void
{
var currentStoredVO:AdminDataVO = editingModel.itemBeingEdited;
editingModel.itemBeingEdited = dataChangeEvent.adminDataVO;
if(comparator.areObjectsEqual(currentStoredVO, editedVO))
{
return;
}
var keepHandler:Function = function():void { editingModel.updateItem(editedVO) };
var discardHandler:Function = function():void {};
var keepOrDiscardChangesOption:OptionAlert = new OptionAlert(OPTION_MESSAGE, KEEP, DISCARD, keepHandler, discardHandler);
contextView.addChild(keepOrDiscardChangesOption);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment