Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Notification types and commands  (Read 5612 times)
dbasch
Jr. Member
**
Posts: 17


View Profile Email
« on: January 14, 2009, 10:11:47 »

Hi all and Cliff,

I often need to have a command execute against specific mediators. Is it incorrect to use notification typing in a command?

:
public class AddAssetCommand extends SimpleCommand implements ICommand {

override public function execute( note:INotification ):void {

var newAssetVO:Asset = note.getBody() as Asset;

var mapInstanceUID:String;

// if we didn't get a map instance Id
// then use all the viewable maps
if (note.getType() != null) {
mapInstanceUID = note.getType();
} else {
var mapProxy:MapProxy = facade.retrieveProxy("MapProxy") as MapProxy;
for each (var mapItem in mapProxy.mapCollection) {
facade.sendNotification(ApplicationFacade.ADD_ASSET_CMD, newAssetVO, mapItem.mapUIComponent.map.name);
}
return;
}
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: January 16, 2009, 06:53:22 »

mapItem isn't typed here, so I don't know what it is, but there is nothing wrong with using the type field as a discriminator so that only one of the notified Mediators will respond.

-=Cliff>
Logged
dbasch
Jr. Member
**
Posts: 17


View Profile Email
« Reply #2 on: January 16, 2009, 09:52:34 »

mapItem isn't typed here, so I don't know what it is, but there is nothing wrong with using the type field as a discriminator so that only one of the notified Mediators will respond.

-=Cliff>

Thanks Cliff!

Derek Basch
Logged
Pages: [1]
Print