PureMVC.Patterns.MacroCommand Class Reference

A base ICommand implementation that executes other ICommands. More...

Inheritance diagram for PureMVC.Patterns.MacroCommand:

PureMVC.Patterns.Notifier PureMVC.Interfaces.ICommand PureMVC.Interfaces.INotifier PureMVC.Interfaces.INotifier

List of all members.

Public Member Functions

 MacroCommand ()
void Execute (INotification notification)
 Execute this MacroCommand's SubCommands.

Protected Member Functions

virtual void InitializeMacroCommand ()
void AddSubCommand (Type commandType)
 Add a SubCommand.


Detailed Description

A base ICommand implementation that executes other ICommands.

A MacroCommand maintains an list of ICommand Class references called SubCommands

When execute is called, the MacroCommand instantiates and calls execute on each of its SubCommands turn. Each SubCommand will be passed a reference to the original INotification that was passed to the MacroCommand's execute method

Unlike SimpleCommand, your subclass should not override execute, but instead, should override the initializeMacroCommand method, calling addSubCommand once for each SubCommand to be executed

PureMVC.Core.Controller PureMVC.Patterns.Notification PureMVC.Patterns.SimpleCommand


Constructor & Destructor Documentation

PureMVC.Patterns.MacroCommand.MacroCommand (  ) 

Constructs a new macro command

You should not need to define a constructor, instead, override the initializeMacroCommand method

If your subclass does define a constructor, be sure to call super()


Member Function Documentation

void PureMVC.Patterns.MacroCommand.AddSubCommand ( Type  commandType  )  [protected]

Add a SubCommand.

Parameters:
commandType A a reference to the Type of the ICommand

The SubCommands will be called in First In/First Out (FIFO) order

void PureMVC.Patterns.MacroCommand.Execute ( INotification  notification  ) 

Execute this MacroCommand's SubCommands.

Parameters:
notification The INotification object to be passsed to each SubCommand

The SubCommands will be called in First In/First Out (FIFO) order

Implements PureMVC.Interfaces.ICommand.

virtual void PureMVC.Patterns.MacroCommand.InitializeMacroCommand (  )  [protected, virtual]

Initialize the MacroCommand

In your subclass, override this method to initialize the MacroCommand's SubCommand list with ICommand class references like this:

                        // Initialize MyMacroCommand
                        protected override initializeMacroCommand( )
                        {
                            addSubCommand( com.me.myapp.controller.FirstCommand );
                            addSubCommand( com.me.myapp.controller.SecondCommand );
                            addSubCommand( com.me.myapp.controller.ThirdCommand );
                        }

Note that SubCommands may be any ICommand implementor, MacroCommands or SimpleCommands are both acceptable


The documentation for this class was generated from the following file:

Generated on Thu Jan 1 16:26:46 2009 for PureMVC by  doxygen 1.5.8