PureMVC Architects Lounge

PureMVC Manifold => Bug Report => Topic started by: coursevector on March 11, 2008, 12:11:37



Title: [ FIXED ] Subcommand bug?
Post by: coursevector on March 11, 2008, 12:11:37
I'm trying to use a subcommand and facade isn't initialized. I believe the error resides in the MacroCommand class. At around line 116, add this line:

commandInstance.initializeNotifier( multitonKey );

and it seems to work as normal.


Title: Re: Subcommand bug?
Post by: puremvc on March 11, 2008, 01:19:18
Lots of eyeballs turn up the bugs quick! :)

I got this by email earlier from Milos:

Hello Cliff,

   I implemented multicore puremvc in my app and found one small bug.
   MacroCommands are not working corectly. The problem is in the execute method because subcommands are not initialized with the multitoneKey.

Solution is just to add

                commandInstance.initializeNotifier(multitonKey);

So the execute method should look like:

public final function execute( notification:INotification ) : void
        {
            while ( subCommands.length > 0) {
                var commandClassRef : Class = subCommands.shift();
                var commandInstance : ICommand = new commandClassRef();
                commandInstance.initializeNotifier(multitonKey);
                commandInstance.execute( notification );
            }
        }

Also one more note with the multicore framework if it is required to register something or to get facade instance for any reason in Mediator code it has to be done in the 'onRegisted()' method.

Keep up the good work!

--
Cheers,
MiloŇ°


Title: Re: [ WILL FIX ] Subcommand bug?
Post by: puremvc on March 11, 2008, 05:12:08
Actually, Milos, the facade access can happen in initializeNotifier, before onRegister. You could wait until onRegister, but the following is what I did in the Modularity demo:

Inside SuperWidgetMediator:
:
override public function initializeNotifier(key:String):void
{
     super.initializeNotifier(key);
     superWidgetProxy = facade.retrieveProxy( SuperWidgetProxy.NAME ) as SuperWidgetProxy;
}

-=Cliff>


Title: Re: [ FIXED ] Subcommand bug?
Post by: puremvc on March 11, 2008, 07:06:32
This is corrected. The latest version of MultiCore is 1.0.1

Thanks, Milos!

-=Cliff>


Title: Re: [ WILL FIX ] Subcommand bug?
Post by: zilet on March 12, 2008, 01:21:46
Actually, Milos, the facade access can happen in initializeNotifier, before onRegister. You could wait until onRegister, but the following is what I did in the Modularity demo:


Yes that is ok, but somehow I like it more to put everything in the onRegister method.. It is logical place for me.

Thanks Cliff!