puremvc-as3 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/2.0.4/asdoc/all-classes.html +81 -0
  2. data/2.0.4/asdoc/all-index-A.html +59 -0
  3. data/2.0.4/asdoc/all-index-B.html +52 -0
  4. data/2.0.4/asdoc/all-index-C.html +92 -0
  5. data/2.0.4/asdoc/all-index-D.html +58 -0
  6. data/2.0.4/asdoc/all-index-E.html +89 -0
  7. data/2.0.4/asdoc/all-index-F.html +72 -0
  8. data/2.0.4/asdoc/all-index-G.html +190 -0
  9. data/2.0.4/asdoc/all-index-H.html +174 -0
  10. data/2.0.4/asdoc/all-index-I.html +202 -0
  11. data/2.0.4/asdoc/all-index-J.html +52 -0
  12. data/2.0.4/asdoc/all-index-K.html +52 -0
  13. data/2.0.4/asdoc/all-index-L.html +67 -0
  14. data/2.0.4/asdoc/all-index-M.html +112 -0
  15. data/2.0.4/asdoc/all-index-N.html +128 -0
  16. data/2.0.4/asdoc/all-index-O.html +178 -0
  17. data/2.0.4/asdoc/all-index-P.html +79 -0
  18. data/2.0.4/asdoc/all-index-Q.html +52 -0
  19. data/2.0.4/asdoc/all-index-R.html +308 -0
  20. data/2.0.4/asdoc/all-index-S.html +193 -0
  21. data/2.0.4/asdoc/all-index-T.html +67 -0
  22. data/2.0.4/asdoc/all-index-U.html +52 -0
  23. data/2.0.4/asdoc/all-index-V.html +84 -0
  24. data/2.0.4/asdoc/all-index-W.html +52 -0
  25. data/2.0.4/asdoc/all-index-X.html +52 -0
  26. data/2.0.4/asdoc/all-index-Y.html +52 -0
  27. data/2.0.4/asdoc/all-index-Z.html +52 -0
  28. data/2.0.4/asdoc/appendixes.html +47 -0
  29. data/2.0.4/asdoc/asdoc.js +273 -0
  30. data/2.0.4/asdoc/class-summary.html +174 -0
  31. data/2.0.4/asdoc/cookies.js +84 -0
  32. data/2.0.4/asdoc/images/collapsed.gif +0 -0
  33. data/2.0.4/asdoc/images/detailHeaderRule.jpg +0 -0
  34. data/2.0.4/asdoc/images/detailSectionHeader.jpg +0 -0
  35. data/2.0.4/asdoc/images/expanded.gif +0 -0
  36. data/2.0.4/asdoc/images/inherit-arrow.gif +0 -0
  37. data/2.0.4/asdoc/images/inheritedSummary.gif +0 -0
  38. data/2.0.4/asdoc/images/logo.jpg +0 -0
  39. data/2.0.4/asdoc/images/titleTableBottom.jpg +0 -0
  40. data/2.0.4/asdoc/images/titleTableMiddle.jpg +0 -0
  41. data/2.0.4/asdoc/images/titleTableTop.jpg +0 -0
  42. data/2.0.4/asdoc/index-list.html +121 -0
  43. data/2.0.4/asdoc/index.html +63 -0
  44. data/2.0.4/asdoc/mxml-tags.html +45 -0
  45. data/2.0.4/asdoc/org/puremvc/as3/core/Controller.html +433 -0
  46. data/2.0.4/asdoc/org/puremvc/as3/core/Model.html +405 -0
  47. data/2.0.4/asdoc/org/puremvc/as3/core/View.html +524 -0
  48. data/2.0.4/asdoc/org/puremvc/as3/core/class-list.html +30 -0
  49. data/2.0.4/asdoc/org/puremvc/as3/core/package-detail.html +65 -0
  50. data/2.0.4/asdoc/org/puremvc/as3/interfaces/ICommand.html +110 -0
  51. data/2.0.4/asdoc/org/puremvc/as3/interfaces/IController.html +226 -0
  52. data/2.0.4/asdoc/org/puremvc/as3/interfaces/IFacade.html +520 -0
  53. data/2.0.4/asdoc/org/puremvc/as3/interfaces/IMediator.html +345 -0
  54. data/2.0.4/asdoc/org/puremvc/as3/interfaces/IModel.html +226 -0
  55. data/2.0.4/asdoc/org/puremvc/as3/interfaces/INotification.html +269 -0
  56. data/2.0.4/asdoc/org/puremvc/as3/interfaces/INotifier.html +151 -0
  57. data/2.0.4/asdoc/org/puremvc/as3/interfaces/IObserver.html +234 -0
  58. data/2.0.4/asdoc/org/puremvc/as3/interfaces/IProxy.html +217 -0
  59. data/2.0.4/asdoc/org/puremvc/as3/interfaces/IView.html +350 -0
  60. data/2.0.4/asdoc/org/puremvc/as3/interfaces/class-list.html +54 -0
  61. data/2.0.4/asdoc/org/puremvc/as3/interfaces/package-detail.html +93 -0
  62. data/2.0.4/asdoc/org/puremvc/as3/patterns/command/MacroCommand.html +284 -0
  63. data/2.0.4/asdoc/org/puremvc/as3/patterns/command/SimpleCommand.html +164 -0
  64. data/2.0.4/asdoc/org/puremvc/as3/patterns/command/class-list.html +27 -0
  65. data/2.0.4/asdoc/org/puremvc/as3/patterns/command/package-detail.html +61 -0
  66. data/2.0.4/asdoc/org/puremvc/as3/patterns/facade/Facade.html +940 -0
  67. data/2.0.4/asdoc/org/puremvc/as3/patterns/facade/class-list.html +24 -0
  68. data/2.0.4/asdoc/org/puremvc/as3/patterns/facade/package-detail.html +57 -0
  69. data/2.0.4/asdoc/org/puremvc/as3/patterns/mediator/Mediator.html +402 -0
  70. data/2.0.4/asdoc/org/puremvc/as3/patterns/mediator/class-list.html +24 -0
  71. data/2.0.4/asdoc/org/puremvc/as3/patterns/mediator/package-detail.html +57 -0
  72. data/2.0.4/asdoc/org/puremvc/as3/patterns/observer/Notification.html +312 -0
  73. data/2.0.4/asdoc/org/puremvc/as3/patterns/observer/Notifier.html +180 -0
  74. data/2.0.4/asdoc/org/puremvc/as3/patterns/observer/Observer.html +253 -0
  75. data/2.0.4/asdoc/org/puremvc/as3/patterns/observer/class-list.html +30 -0
  76. data/2.0.4/asdoc/org/puremvc/as3/patterns/observer/package-detail.html +65 -0
  77. data/2.0.4/asdoc/org/puremvc/as3/patterns/proxy/Proxy.html +338 -0
  78. data/2.0.4/asdoc/org/puremvc/as3/patterns/proxy/class-list.html +24 -0
  79. data/2.0.4/asdoc/org/puremvc/as3/patterns/proxy/package-detail.html +57 -0
  80. data/2.0.4/asdoc/package-frame.html +36 -0
  81. data/2.0.4/asdoc/package-list.html +52 -0
  82. data/2.0.4/asdoc/package-summary.html +68 -0
  83. data/2.0.4/asdoc/print.css +110 -0
  84. data/2.0.4/asdoc/style.css +565 -0
  85. data/2.0.4/asdoc/title-bar.html +55 -0
  86. data/2.0.4/bin/PureMVC_AS3_2_0_4.swc +0 -0
  87. data/2.0.4/license.txt +61 -0
  88. data/2.0.4/src/org/puremvc/as3/core/Controller.as +183 -0
  89. data/2.0.4/src/org/puremvc/as3/core/Model.as +144 -0
  90. data/2.0.4/src/org/puremvc/as3/core/View.as +271 -0
  91. data/2.0.4/src/org/puremvc/as3/interfaces/ICommand.as +21 -0
  92. data/2.0.4/src/org/puremvc/as3/interfaces/IController.as +64 -0
  93. data/2.0.4/src/org/puremvc/as3/interfaces/IFacade.as +131 -0
  94. data/2.0.4/src/org/puremvc/as3/interfaces/IMediator.as +150 -0
  95. data/2.0.4/src/org/puremvc/as3/interfaces/IModel.as +57 -0
  96. data/2.0.4/src/org/puremvc/as3/interfaces/INotification.as +76 -0
  97. data/2.0.4/src/org/puremvc/as3/interfaces/INotifier.as +46 -0
  98. data/2.0.4/src/org/puremvc/as3/interfaces/IObserver.as +81 -0
  99. data/2.0.4/src/org/puremvc/as3/interfaces/IProxy.as +61 -0
  100. data/2.0.4/src/org/puremvc/as3/interfaces/IView.as +106 -0
  101. data/2.0.4/src/org/puremvc/as3/patterns/command/MacroCommand.as +121 -0
  102. data/2.0.4/src/org/puremvc/as3/patterns/command/SimpleCommand.as +42 -0
  103. data/2.0.4/src/org/puremvc/as3/patterns/facade/Facade.as +419 -0
  104. data/2.0.4/src/org/puremvc/as3/patterns/mediator/Mediator.as +115 -0
  105. data/2.0.4/src/org/puremvc/as3/patterns/observer/Notification.as +128 -0
  106. data/2.0.4/src/org/puremvc/as3/patterns/observer/Notifier.as +55 -0
  107. data/2.0.4/src/org/puremvc/as3/patterns/observer/Observer.as +114 -0
  108. data/2.0.4/src/org/puremvc/as3/patterns/proxy/Proxy.as +88 -0
  109. data/2.0.4/src/puremvc-manifest.xml +20 -0
  110. data/2.0.4/version.txt +117 -0
  111. data/Gemfile +4 -0
  112. data/README.textile +107 -0
  113. data/Rakefile +24 -0
  114. data/lib/puremvc-as3.rb +29 -0
  115. data/lib/rake/rename.rb +34 -0
  116. metadata +198 -0
@@ -0,0 +1,46 @@
1
+ /*
2
+ PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
3
+ Your reuse is governed by the Creative Commons Attribution 3.0 United States License
4
+ */
5
+ package org.puremvc.as3.interfaces
6
+ {
7
+ /**
8
+ * The interface definition for a PureMVC Notifier.
9
+ *
10
+ * <P>
11
+ * <code>MacroCommand, Command, Mediator</code> and <code>Proxy</code>
12
+ * all have a need to send <code>Notifications</code>. </P>
13
+ *
14
+ * <P>
15
+ * The <code>INotifier</code> interface provides a common method called
16
+ * <code>sendNotification</code> that relieves implementation code of
17
+ * the necessity to actually construct <code>Notifications</code>.</P>
18
+ *
19
+ * <P>
20
+ * The <code>Notifier</code> class, which all of the above mentioned classes
21
+ * extend, also provides an initialized reference to the <code>Facade</code>
22
+ * Singleton, which is required for the convienience method
23
+ * for sending <code>Notifications</code>, but also eases implementation as these
24
+ * classes have frequent <code>Facade</code> interactions and usually require
25
+ * access to the facade anyway.</P>
26
+ *
27
+ * @see org.puremvc.as3.interfaces.IFacade IFacade
28
+ * @see org.puremvc.as3.interfaces.INotification INotification
29
+ */
30
+ public interface INotifier
31
+ {
32
+ /**
33
+ * Send a <code>INotification</code>.
34
+ *
35
+ * <P>
36
+ * Convenience method to prevent having to construct new
37
+ * notification instances in our implementation code.</P>
38
+ *
39
+ * @param notificationName the name of the notification to send
40
+ * @param body the body of the notification (optional)
41
+ * @param type the type of the notification (optional)
42
+ */
43
+ function sendNotification( notificationName:String, body:Object=null, type:String=null ):void;
44
+
45
+ }
46
+ }
@@ -0,0 +1,81 @@
1
+ /*
2
+ PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
3
+ Your reuse is governed by the Creative Commons Attribution 3.0 United States License
4
+ */
5
+ package org.puremvc.as3.interfaces
6
+ {
7
+
8
+ /**
9
+ * The interface definition for a PureMVC Observer.
10
+ *
11
+ * <P>
12
+ * In PureMVC, <code>IObserver</code> implementors assume these responsibilities:
13
+ * <UL>
14
+ * <LI>Encapsulate the notification (callback) method of the interested object.</LI>
15
+ * <LI>Encapsulate the notification context (this) of the interested object.</LI>
16
+ * <LI>Provide methods for setting the interested object' notification method and context.</LI>
17
+ * <LI>Provide a method for notifying the interested object.</LI>
18
+ * </UL>
19
+ *
20
+ * <P>
21
+ * PureMVC does not rely upon underlying event
22
+ * models such as the one provided with Flash,
23
+ * and ActionScript 3 does not have an inherent
24
+ * event model.</P>
25
+ *
26
+ * <P>
27
+ * The Observer Pattern as implemented within
28
+ * PureMVC exists to support event driven communication
29
+ * between the application and the actors of the
30
+ * MVC triad.</P>
31
+ *
32
+ * <P>
33
+ * An Observer is an object that encapsulates information
34
+ * about an interested object with a notification method that
35
+ * should be called when an </code>INotification</code> is broadcast. The Observer then
36
+ * acts as a proxy for notifying the interested object.
37
+ *
38
+ * <P>
39
+ * Observers can receive <code>Notification</code>s by having their
40
+ * <code>notifyObserver</code> method invoked, passing
41
+ * in an object implementing the <code>INotification</code> interface, such
42
+ * as a subclass of <code>Notification</code>.</P>
43
+ *
44
+ * @see org.puremvc.as3.interfaces.IView IView
45
+ * @see org.puremvc.as3.interfaces.INotification INotification
46
+ */
47
+ public interface IObserver
48
+ {
49
+ /**
50
+ * Set the notification method.
51
+ *
52
+ * <P>
53
+ * The notification method should take one parameter of type <code>INotification</code></P>
54
+ *
55
+ * @param notifyMethod the notification (callback) method of the interested object
56
+ */
57
+ function setNotifyMethod( notifyMethod:Function ):void;
58
+
59
+ /**
60
+ * Set the notification context.
61
+ *
62
+ * @param notifyContext the notification context (this) of the interested object
63
+ */
64
+ function setNotifyContext( notifyContext:Object ):void;
65
+
66
+ /**
67
+ * Notify the interested object.
68
+ *
69
+ * @param notification the <code>INotification</code> to pass to the interested object's notification method
70
+ */
71
+ function notifyObserver( notification:INotification ):void;
72
+
73
+ /**
74
+ * Compare the given object to the notificaiton context object.
75
+ *
76
+ * @param object the object to compare.
77
+ * @return boolean indicating if the notification context and the object are the same.
78
+ */
79
+ function compareNotifyContext( object:Object ):Boolean;
80
+ }
81
+ }
@@ -0,0 +1,61 @@
1
+ /*
2
+ PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
3
+ Your reuse is governed by the Creative Commons Attribution 3.0 United States License
4
+ */
5
+ package org.puremvc.as3.interfaces
6
+ {
7
+
8
+ /**
9
+ * The interface definition for a PureMVC Proxy.
10
+ *
11
+ * <P>
12
+ * In PureMVC, <code>IProxy</code> implementors assume these responsibilities:</P>
13
+ * <UL>
14
+ * <LI>Implement a common method which returns the name of the Proxy.</LI>
15
+ * <LI>Provide methods for setting and getting the data object.</LI>
16
+ * </UL>
17
+ * <P>
18
+ * Additionally, <code>IProxy</code>s typically:</P>
19
+ * <UL>
20
+ * <LI>Maintain references to one or more pieces of model data.</LI>
21
+ * <LI>Provide methods for manipulating that data.</LI>
22
+ * <LI>Generate <code>INotifications</code> when their model data changes.</LI>
23
+ * <LI>Expose their name as a <code>public static const</code> called <code>NAME</code>, if they are not instantiated multiple times.</LI>
24
+ * <LI>Encapsulate interaction with local or remote services used to fetch and persist model data.</LI>
25
+ * </UL>
26
+ */
27
+ public interface IProxy
28
+ {
29
+
30
+ /**
31
+ * Get the Proxy name
32
+ *
33
+ * @return the Proxy instance name
34
+ */
35
+ function getProxyName():String;
36
+
37
+ /**
38
+ * Set the data object
39
+ *
40
+ * @param data the data object
41
+ */
42
+ function setData( data:Object ):void;
43
+
44
+ /**
45
+ * Get the data object
46
+ *
47
+ * @return the data as type Object
48
+ */
49
+ function getData():Object;
50
+
51
+ /**
52
+ * Called by the Model when the Proxy is registered
53
+ */
54
+ function onRegister( ):void;
55
+
56
+ /**
57
+ * Called by the Model when the Proxy is removed
58
+ */
59
+ function onRemove( ):void;
60
+ }
61
+ }
@@ -0,0 +1,106 @@
1
+ /*
2
+ PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
3
+ Your reuse is governed by the Creative Commons Attribution 3.0 United States License
4
+ */
5
+ package org.puremvc.as3.interfaces
6
+ {
7
+
8
+ /**
9
+ * The interface definition for a PureMVC View.
10
+ *
11
+ * <P>
12
+ * In PureMVC, <code>IView</code> implementors assume these responsibilities:</P>
13
+ *
14
+ * <P>
15
+ * In PureMVC, the <code>View</code> class assumes these responsibilities:
16
+ * <UL>
17
+ * <LI>Maintain a cache of <code>IMediator</code> instances.</LI>
18
+ * <LI>Provide methods for registering, retrieving, and removing <code>IMediators</code>.</LI>
19
+ * <LI>Managing the observer lists for each <code>INotification</code> in the application.</LI>
20
+ * <LI>Providing a method for attaching <code>IObservers</code> to an <code>INotification</code>'s observer list.</LI>
21
+ * <LI>Providing a method for broadcasting an <code>INotification</code>.</LI>
22
+ * <LI>Notifying the <code>IObservers</code> of a given <code>INotification</code> when it broadcast.</LI>
23
+ * </UL>
24
+ *
25
+ * @see org.puremvc.as3.interfaces.IMediator IMediator
26
+ * @see org.puremvc.as3.interfaces.IObserver IObserver
27
+ * @see org.puremvc.as3.interfaces.INotification INotification
28
+ */
29
+ public interface IView
30
+ {
31
+
32
+ /**
33
+ * Register an <code>IObserver</code> to be notified
34
+ * of <code>INotifications</code> with a given name.
35
+ *
36
+ * @param notificationName the name of the <code>INotifications</code> to notify this <code>IObserver</code> of
37
+ * @param observer the <code>IObserver</code> to register
38
+ */
39
+ function registerObserver( notificationName:String, observer:IObserver ) : void;
40
+
41
+ /**
42
+ * Remove a group of observers from the observer list for a given Notification name.
43
+ * <P>
44
+ * @param notificationName which observer list to remove from
45
+ * @param notifyContext removed the observers with this object as their notifyContext
46
+ */
47
+ function removeObserver( notificationName:String, notifyContext:Object ):void;
48
+
49
+ /**
50
+ * Notify the <code>IObservers</code> for a particular <code>INotification</code>.
51
+ *
52
+ * <P>
53
+ * All previously attached <code>IObservers</code> for this <code>INotification</code>'s
54
+ * list are notified and are passed a reference to the <code>INotification</code> in
55
+ * the order in which they were registered.</P>
56
+ *
57
+ * @param notification the <code>INotification</code> to notify <code>IObservers</code> of.
58
+ */
59
+ function notifyObservers( note:INotification ) : void;
60
+
61
+ /**
62
+ * Register an <code>IMediator</code> instance with the <code>View</code>.
63
+ *
64
+ * <P>
65
+ * Registers the <code>IMediator</code> so that it can be retrieved by name,
66
+ * and further interrogates the <code>IMediator</code> for its
67
+ * <code>INotification</code> interests.</P>
68
+ * <P>
69
+ * If the <code>IMediator</code> returns any <code>INotification</code>
70
+ * names to be notified about, an <code>Observer</code> is created encapsulating
71
+ * the <code>IMediator</code> instance's <code>handleNotification</code> method
72
+ * and registering it as an <code>Observer</code> for all <code>INotifications</code> the
73
+ * <code>IMediator</code> is interested in.</p>
74
+ *
75
+ * @param mediatorName the name to associate with this <code>IMediator</code> instance
76
+ * @param mediator a reference to the <code>IMediator</code> instance
77
+ */
78
+ function registerMediator( mediator:IMediator ) : void;
79
+
80
+ /**
81
+ * Retrieve an <code>IMediator</code> from the <code>View</code>.
82
+ *
83
+ * @param mediatorName the name of the <code>IMediator</code> instance to retrieve.
84
+ * @return the <code>IMediator</code> instance previously registered with the given <code>mediatorName</code>.
85
+ */
86
+ function retrieveMediator( mediatorName:String ) : IMediator;
87
+
88
+ /**
89
+ * Remove an <code>IMediator</code> from the <code>View</code>.
90
+ *
91
+ * @param mediatorName name of the <code>IMediator</code> instance to be removed.
92
+ * @return the <code>IMediator</code> that was removed from the <code>View</code>
93
+ */
94
+ function removeMediator( mediatorName:String ) : IMediator;
95
+
96
+ /**
97
+ * Check if a Mediator is registered or not
98
+ *
99
+ * @param mediatorName
100
+ * @return whether a Mediator is registered with the given <code>mediatorName</code>.
101
+ */
102
+ function hasMediator( mediatorName:String ) : Boolean;
103
+
104
+ }
105
+
106
+ }
@@ -0,0 +1,121 @@
1
+ /*
2
+ PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
3
+ Your reuse is governed by the Creative Commons Attribution 3.0 United States License
4
+ */
5
+ package org.puremvc.as3.patterns.command
6
+ {
7
+
8
+ import org.puremvc.as3.interfaces.*;
9
+ import org.puremvc.as3.patterns.observer.*;
10
+
11
+ /**
12
+ * A base <code>ICommand</code> implementation that executes other <code>ICommand</code>s.
13
+ *
14
+ * <P>
15
+ * A <code>MacroCommand</code> maintains an list of
16
+ * <code>ICommand</code> Class references called <i>SubCommands</i>.</P>
17
+ *
18
+ * <P>
19
+ * When <code>execute</code> is called, the <code>MacroCommand</code>
20
+ * instantiates and calls <code>execute</code> on each of its <i>SubCommands</i> turn.
21
+ * Each <i>SubCommand</i> will be passed a reference to the original
22
+ * <code>INotification</code> that was passed to the <code>MacroCommand</code>'s
23
+ * <code>execute</code> method.</P>
24
+ *
25
+ * <P>
26
+ * Unlike <code>SimpleCommand</code>, your subclass
27
+ * should not override <code>execute</code>, but instead, should
28
+ * override the <code>initializeMacroCommand</code> method,
29
+ * calling <code>addSubCommand</code> once for each <i>SubCommand</i>
30
+ * to be executed.</P>
31
+ *
32
+ * <P>
33
+ *
34
+ * @see org.puremvc.as3.core.controller.Controller Controller
35
+ * @see org.puremvc.as3.patterns.observer.Notification Notification
36
+ * @see org.puremvc.as3.patterns.command.SimpleCommand SimpleCommand
37
+ */
38
+ public class MacroCommand extends Notifier implements ICommand, INotifier
39
+ {
40
+
41
+ private var subCommands:Array;
42
+
43
+ /**
44
+ * Constructor.
45
+ *
46
+ * <P>
47
+ * You should not need to define a constructor,
48
+ * instead, override the <code>initializeMacroCommand</code>
49
+ * method.</P>
50
+ *
51
+ * <P>
52
+ * If your subclass does define a constructor, be
53
+ * sure to call <code>super()</code>.</P>
54
+ */
55
+ public function MacroCommand()
56
+ {
57
+ subCommands = new Array();
58
+ initializeMacroCommand();
59
+ }
60
+
61
+ /**
62
+ * Initialize the <code>MacroCommand</code>.
63
+ *
64
+ * <P>
65
+ * In your subclass, override this method to
66
+ * initialize the <code>MacroCommand</code>'s <i>SubCommand</i>
67
+ * list with <code>ICommand</code> class references like
68
+ * this:</P>
69
+ *
70
+ * <listing>
71
+ * // Initialize MyMacroCommand
72
+ * override protected function initializeMacroCommand( ) : void
73
+ * {
74
+ * addSubCommand( com.me.myapp.controller.FirstCommand );
75
+ * addSubCommand( com.me.myapp.controller.SecondCommand );
76
+ * addSubCommand( com.me.myapp.controller.ThirdCommand );
77
+ * }
78
+ * </listing>
79
+ *
80
+ * <P>
81
+ * Note that <i>SubCommand</i>s may be any <code>ICommand</code> implementor,
82
+ * <code>MacroCommand</code>s or <code>SimpleCommands</code> are both acceptable.
83
+ */
84
+ protected function initializeMacroCommand():void
85
+ {
86
+ }
87
+
88
+ /**
89
+ * Add a <i>SubCommand</i>.
90
+ *
91
+ * <P>
92
+ * The <i>SubCommands</i> will be called in First In/First Out (FIFO)
93
+ * order.</P>
94
+ *
95
+ * @param commandClassRef a reference to the <code>Class</code> of the <code>ICommand</code>.
96
+ */
97
+ protected function addSubCommand( commandClassRef:Class ): void
98
+ {
99
+ subCommands.push(commandClassRef);
100
+ }
101
+
102
+ /**
103
+ * Execute this <code>MacroCommand</code>'s <i>SubCommands</i>.
104
+ *
105
+ * <P>
106
+ * The <i>SubCommands</i> will be called in First In/First Out (FIFO)
107
+ * order.
108
+ *
109
+ * @param notification the <code>INotification</code> object to be passsed to each <i>SubCommand</i>.
110
+ */
111
+ public final function execute( notification:INotification ) : void
112
+ {
113
+ while ( subCommands.length > 0) {
114
+ var commandClassRef : Class = subCommands.shift();
115
+ var commandInstance : ICommand = new commandClassRef();
116
+ commandInstance.execute( notification );
117
+ }
118
+ }
119
+
120
+ }
121
+ }
@@ -0,0 +1,42 @@
1
+ /*
2
+ PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
3
+ Your reuse is governed by the Creative Commons Attribution 3.0 United States License
4
+ */
5
+ package org.puremvc.as3.patterns.command
6
+ {
7
+
8
+ import org.puremvc.as3.interfaces.*;
9
+ import org.puremvc.as3.patterns.observer.Notifier;
10
+
11
+ /**
12
+ * A base <code>ICommand</code> implementation.
13
+ *
14
+ * <P>
15
+ * Your subclass should override the <code>execute</code>
16
+ * method where your business logic will handle the <code>INotification</code>. </P>
17
+ *
18
+ * @see org.puremvc.as3.core.controller.Controller Controller
19
+ * @see org.puremvc.as3.patterns.observer.Notification Notification
20
+ * @see org.puremvc.as3.patterns.command.MacroCommand MacroCommand
21
+ */
22
+ public class SimpleCommand extends Notifier implements ICommand, INotifier
23
+ {
24
+
25
+ /**
26
+ * Fulfill the use-case initiated by the given <code>INotification</code>.
27
+ *
28
+ * <P>
29
+ * In the Command Pattern, an application use-case typically
30
+ * begins with some user action, which results in an <code>INotification</code> being broadcast, which
31
+ * is handled by business logic in the <code>execute</code> method of an
32
+ * <code>ICommand</code>.</P>
33
+ *
34
+ * @param notification the <code>INotification</code> to handle.
35
+ */
36
+ public function execute( notification:INotification ) : void
37
+ {
38
+
39
+ }
40
+
41
+ }
42
+ }