├── asdoc ├── images │ ├── logo.jpg │ ├── collapsed.gif │ ├── expanded.gif │ ├── inherit-arrow.gif │ ├── titleTableTop.jpg │ ├── detailHeaderRule.jpg │ ├── inheritedSummary.gif │ ├── titleTableBottom.jpg │ ├── titleTableMiddle.jpg │ └── detailSectionHeader.jpg ├── org │ └── puremvc │ │ └── as3 │ │ └── multicore │ │ ├── patterns │ │ ├── proxy │ │ │ ├── class-list.html │ │ │ └── package-detail.html │ │ ├── facade │ │ │ ├── class-list.html │ │ │ └── package-detail.html │ │ ├── mediator │ │ │ ├── class-list.html │ │ │ └── package-detail.html │ │ ├── command │ │ │ ├── class-list.html │ │ │ └── package-detail.html │ │ └── observer │ │ │ ├── class-list.html │ │ │ └── package-detail.html │ │ ├── core │ │ ├── class-list.html │ │ └── package-detail.html │ │ └── interfaces │ │ ├── class-list.html │ │ ├── package-detail.html │ │ └── ICommand.html ├── package-frame.html ├── mxml-tags.html ├── index.html ├── index-list.html ├── package-list.html ├── appendixes.html ├── cookies.js ├── print.css ├── all-classes.html ├── title-bar.html ├── package-summary.html ├── all-index-B.html ├── all-index-J.html ├── all-index-K.html ├── all-index-Q.html ├── all-index-U.html ├── all-index-W.html ├── all-index-X.html ├── all-index-Y.html └── all-index-Z.html ├── bin └── PureMVC_AS3_MultiCore_1_0_5.swc ├── src └── org │ └── puremvc │ └── as3 │ └── multicore │ ├── interfaces │ ├── ICommand.as │ ├── IProxy.as │ ├── IModel.as │ ├── INotifier.as │ ├── IController.as │ ├── INotification.as │ ├── IObserver.as │ ├── IView.as │ ├── IFacade.as │ └── IMediator.as │ ├── patterns │ ├── command │ │ ├── SimpleCommand.as │ │ └── MacroCommand.as │ ├── proxy │ │ └── Proxy.as │ ├── mediator │ │ └── Mediator.as │ └── observer │ │ ├── Observer.as │ │ ├── Notifier.as │ │ └── Notification.as │ └── core │ ├── Model.as │ └── Controller.as ├── LICENSE ├── VERSION └── README.md /asdoc/images/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-as3-multicore-framework/HEAD/asdoc/images/logo.jpg -------------------------------------------------------------------------------- /asdoc/images/collapsed.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-as3-multicore-framework/HEAD/asdoc/images/collapsed.gif -------------------------------------------------------------------------------- /asdoc/images/expanded.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-as3-multicore-framework/HEAD/asdoc/images/expanded.gif -------------------------------------------------------------------------------- /asdoc/images/inherit-arrow.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-as3-multicore-framework/HEAD/asdoc/images/inherit-arrow.gif -------------------------------------------------------------------------------- /asdoc/images/titleTableTop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-as3-multicore-framework/HEAD/asdoc/images/titleTableTop.jpg -------------------------------------------------------------------------------- /asdoc/images/detailHeaderRule.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-as3-multicore-framework/HEAD/asdoc/images/detailHeaderRule.jpg -------------------------------------------------------------------------------- /asdoc/images/inheritedSummary.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-as3-multicore-framework/HEAD/asdoc/images/inheritedSummary.gif -------------------------------------------------------------------------------- /asdoc/images/titleTableBottom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-as3-multicore-framework/HEAD/asdoc/images/titleTableBottom.jpg -------------------------------------------------------------------------------- /asdoc/images/titleTableMiddle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-as3-multicore-framework/HEAD/asdoc/images/titleTableMiddle.jpg -------------------------------------------------------------------------------- /asdoc/images/detailSectionHeader.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-as3-multicore-framework/HEAD/asdoc/images/detailSectionHeader.jpg -------------------------------------------------------------------------------- /bin/PureMVC_AS3_MultiCore_1_0_5.swc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-as3-multicore-framework/HEAD/bin/PureMVC_AS3_MultiCore_1_0_5.swc -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/interfaces/ICommand.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.interfaces 6 | { 7 | /** 8 | * The interface definition for a PureMVC Command. 9 | * 10 | * @see org.puremvc.as3.multicore.interfaces INotification 11 | */ 12 | public interface ICommand extends INotifier 13 | { 14 | /** 15 | * Execute the ICommand's logic to handle a given INotification. 16 | * 17 | * @param note an INotification to handle. 18 | */ 19 | function execute( notification:INotification ) : void; 20 | } 21 | } -------------------------------------------------------------------------------- /asdoc/org/puremvc/as3/multicore/patterns/proxy/class-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | org.puremvc.as3.multicore.patterns.proxy - API Documentation 6 | 7 | 8 | 9 | 10 | 11 |

12 | Package org.puremvc.as3.multicore.patterns.proxy 13 |

14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
Classes
Proxy
22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /asdoc/org/puremvc/as3/multicore/patterns/facade/class-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | org.puremvc.as3.multicore.patterns.facade - API Documentation 6 | 7 | 8 | 9 | 10 | 11 |

12 | Package org.puremvc.as3.multicore.patterns.facade 13 |

14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
Classes
Facade
22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /asdoc/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Adobe Flex 2 Language Reference 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | <body> 20 | 21 | <h2>Frame Alert</h2> 22 | 23 | <p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. 24 | <br> 25 | Link to<a href="package-summary.html">Non-frame version.</a> 26 | 27 | </p> 28 | 29 | </body> 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /asdoc/org/puremvc/as3/multicore/patterns/mediator/class-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | org.puremvc.as3.multicore.patterns.mediator - API Documentation 6 | 7 | 8 | 9 | 10 | 11 |

12 | Package org.puremvc.as3.multicore.patterns.mediator 13 |

14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
Classes
Mediator
22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /asdoc/org/puremvc/as3/multicore/patterns/command/class-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | org.puremvc.as3.multicore.patterns.command - API Documentation 6 | 7 | 8 | 9 | 10 | 11 |

12 | Package org.puremvc.as3.multicore.patterns.command 13 |

14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
Classes
MacroCommand
SimpleCommand
25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /asdoc/org/puremvc/as3/multicore/core/class-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | org.puremvc.as3.multicore.core - API Documentation 6 | 7 | 8 | 9 | 10 | 11 |

12 | Package org.puremvc.as3.multicore.core 13 |

14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
Classes
Controller
Model
View
28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /asdoc/org/puremvc/as3/multicore/patterns/observer/class-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | org.puremvc.as3.multicore.patterns.observer - API Documentation 6 | 7 | 8 | 9 | 10 | 11 |

12 | Package org.puremvc.as3.multicore.patterns.observer 13 |

14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
Classes
Notification
Notifier
Observer
28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /asdoc/mxml-tags.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | MXML Only Components - Adobe Flex 2 Language Reference 10 | 11 | 12 | 13 | 14 | 15 | 16 |

MXML Only Components

17 | 18 | <mx:Binding> 19 |
20 | 21 | <mx:Component> 22 |
23 | 24 | <mx:Metadata> 25 |
26 | 27 | <mx:Model> 28 |
29 | 30 | <mx:Script> 31 |
32 | 33 | <mx:Style> 34 |
35 | 36 | <mx:XML> 37 |
38 | 39 | <mx:XMLList> 40 |
41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | * PureMVC AS3 MultiCore Framework - Copyright © 2006-2012 Futurescale, Inc. 2 | * All rights reserved. 3 | 4 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | * Neither the name of Futurescale, Inc., PureMVC.org, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 9 | 10 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/patterns/command/SimpleCommand.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.patterns.command 6 | { 7 | 8 | import org.puremvc.as3.multicore.interfaces.*; 9 | import org.puremvc.as3.multicore.patterns.observer.Notifier; 10 | 11 | /** 12 | * A base ICommand implementation. 13 | * 14 | *

15 | * Your subclass should override the execute 16 | * method where your business logic will handle the INotification.

17 | * 18 | * @see org.puremvc.as3.multicore.core.Controller Controller 19 | * @see org.puremvc.as3.multicore.patterns.observer.Notification Notification 20 | * @see org.puremvc.as3.multicore.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 INotification. 27 | * 28 | *

29 | * In the Command Pattern, an application use-case typically 30 | * begins with some user action, which results in an INotification being broadcast, which 31 | * is handled by business logic in the execute method of an 32 | * ICommand.

33 | * 34 | * @param notification the INotification to handle. 35 | */ 36 | public function execute( notification:INotification ) : void 37 | { 38 | 39 | } 40 | 41 | } 42 | } -------------------------------------------------------------------------------- /asdoc/org/puremvc/as3/multicore/interfaces/class-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | org.puremvc.as3.multicore.interfaces - API Documentation 6 | 7 | 8 | 9 | 10 | 11 |

12 | Package org.puremvc.as3.multicore.interfaces 13 |

14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 |
Interfaces
ICommand
IController
IFacade
IMediator
IModel
INotification
INotifier
IObserver
IProxy
IView
 
52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/interfaces/IProxy.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.interfaces 6 | { 7 | 8 | /** 9 | * The interface definition for a PureMVC Proxy. 10 | * 11 | *

12 | * In PureMVC, IProxy implementors assume these responsibilities:

13 | * 17 | *

18 | * Additionally, IProxys typically:

19 | * 26 | */ 27 | public interface IProxy extends INotifier 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 | } 62 | } -------------------------------------------------------------------------------- /asdoc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Adobe Flex 2 Language Reference 8 | 9 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | <body> 46 | 47 | <h2>Frame Alert</h2> 48 | 49 | <p> 50 | This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. 51 | <br> 52 | Link to <a href="package-summary.html">Non-frame version.</a> 53 | 54 | </p> 55 | 56 | </body> 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/interfaces/IModel.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.interfaces 6 | { 7 | /** 8 | * The interface definition for a PureMVC Model. 9 | * 10 | *

11 | * In PureMVC, IModel implementors provide 12 | * access to IProxy objects by named lookup.

13 | * 14 | *

15 | * An IModel assumes these responsibilities:

16 | * 17 | * 21 | */ 22 | public interface IModel 23 | { 24 | /** 25 | * Register an IProxy instance with the Model. 26 | * 27 | * @param proxyName the name to associate with this IProxy instance. 28 | * @param proxy an object reference to be held by the Model. 29 | */ 30 | function registerProxy( proxy:IProxy ) : void; 31 | 32 | /** 33 | * Retrieve an IProxy instance from the Model. 34 | * 35 | * @param proxyName 36 | * @return the IProxy instance previously registered with the given proxyName. 37 | */ 38 | function retrieveProxy( proxyName:String ) : IProxy; 39 | 40 | /** 41 | * Remove an IProxy instance from the Model. 42 | * 43 | * @param proxyName name of the IProxy instance to be removed. 44 | * @return the IProxy that was removed from the Model 45 | */ 46 | function removeProxy( proxyName:String ) : IProxy; 47 | 48 | /** 49 | * Check if a Proxy is registered 50 | * 51 | * @param proxyName 52 | * @return whether a Proxy is currently registered with the given proxyName. 53 | */ 54 | function hasProxy( proxyName:String ) : Boolean; 55 | 56 | } 57 | } -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/interfaces/INotifier.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.interfaces 6 | { 7 | /** 8 | * The interface definition for a PureMVC Notifier. 9 | * 10 | *

11 | * MacroCommand, Command, Mediator and Proxy 12 | * all have a need to send Notifications.

13 | * 14 | *

15 | * The INotifier interface provides a common method called 16 | * sendNotification that relieves implementation code of 17 | * the necessity to actually construct Notifications.

18 | * 19 | *

20 | * The Notifier class, which all of the above mentioned classes 21 | * extend, also provides an initialized reference to the Facade 22 | * Singleton, which is required for the convienience method 23 | * for sending Notifications, but also eases implementation as these 24 | * classes have frequent Facade interactions and usually require 25 | * access to the facade anyway.

26 | * 27 | * @see org.puremvc.as3.multicore.interfaces.IFacade IFacade 28 | * @see org.puremvc.as3.multicore.interfaces.INotification INotification 29 | */ 30 | public interface INotifier 31 | { 32 | /** 33 | * Send a INotification. 34 | * 35 | *

36 | * Convenience method to prevent having to construct new 37 | * notification instances in our implementation code.

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 | * Initialize this INotifier instance. 47 | *

48 | * This is how a Notifier gets its multitonKey. 49 | * Calls to sendNotification or to access the 50 | * facade will fail until after this method 51 | * has been called.

52 | * 53 | * @param key the multitonKey for this INotifier to use 54 | */ 55 | function initializeNotifier( key:String ): void; 56 | } 57 | } -------------------------------------------------------------------------------- /asdoc/index-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Adobe Flex 2 Language Reference 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |

Index

19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 |
AN
BO
CP
DQ
ER
FS
GT
HU
IV
JW
KX
LY
MZ
117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /asdoc/package-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Package List - API Documentation 6 | 7 | 8 | 9 | 10 | 11 | 12 |

13 | Packages 14 |

15 | 16 | 17 | 20 | 21 | 22 | 25 | 26 | 27 | 30 | 31 | 32 | 35 | 36 | 37 | 40 | 41 | 42 | 45 | 46 | 47 | 48 | 49 |
org.puremvc.as3.multicore.core 18 |
19 |
org.puremvc.as3.multicore.interfaces 23 |
24 |
org.puremvc.as3.multicore.patterns.command 28 |
29 |
org.puremvc.as3.multicore.patterns.facade 33 |
34 |
org.puremvc.as3.multicore.patterns.mediator 38 |
39 |
org.puremvc.as3.multicore.patterns.observer 43 |
44 |
org.puremvc.as3.multicore.patterns.proxy
50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /asdoc/appendixes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Appendixes 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |
34 | 35 | 36 | 37 | 38 |
 AppendixDescription
39 |

40 | 44 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/patterns/proxy/Proxy.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.patterns.proxy 6 | { 7 | import org.puremvc.as3.multicore.interfaces.IProxy; 8 | import org.puremvc.as3.multicore.interfaces.INotifier; 9 | import org.puremvc.as3.multicore.patterns.observer.Notifier; 10 | 11 | /** 12 | * A base IProxy implementation. 13 | * 14 | *

15 | * In PureMVC, Proxy classes are used to manage parts of the 16 | * application's data model.

17 | * 18 | *

19 | * A Proxy might simply manage a reference to a local data object, 20 | * in which case interacting with it might involve setting and 21 | * getting of its data in synchronous fashion.

22 | * 23 | *

24 | * Proxy classes are also used to encapsulate the application's 25 | * interaction with remote services to save or retrieve data, in which case, 26 | * we adopt an asyncronous idiom; setting data (or calling a method) on the 27 | * Proxy and listening for a Notification to be sent 28 | * when the Proxy has retrieved the data from the service.

29 | * 30 | * @see org.puremvc.as3.multicore.core.Model Model 31 | */ 32 | public class Proxy extends Notifier implements IProxy, INotifier 33 | { 34 | 35 | public static var NAME:String = 'Proxy'; 36 | 37 | /** 38 | * Constructor 39 | */ 40 | public function Proxy( proxyName:String=null, data:Object=null ) 41 | { 42 | 43 | this.proxyName = (proxyName != null)?proxyName:NAME; 44 | if (data != null) setData(data); 45 | } 46 | 47 | /** 48 | * Get the proxy name 49 | */ 50 | public function getProxyName():String 51 | { 52 | return proxyName; 53 | } 54 | 55 | /** 56 | * Set the data object 57 | */ 58 | public function setData( data:Object ):void 59 | { 60 | this.data = data; 61 | } 62 | 63 | /** 64 | * Get the data object 65 | */ 66 | public function getData():Object 67 | { 68 | return data; 69 | } 70 | 71 | /** 72 | * Called by the Model when the Proxy is registered 73 | */ 74 | public function onRegister( ):void {} 75 | 76 | /** 77 | * Called by the Model when the Proxy is removed 78 | */ 79 | public function onRemove( ):void {} 80 | 81 | // the proxy name 82 | protected var proxyName:String; 83 | 84 | // the data object 85 | protected var data:Object; 86 | } 87 | } -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | PureMVC AS3 MultiCore Framework 2 | -------------------------------------------------------------------------- 3 | Release Date: 8/14/08 4 | Platform: ActionScript 3 (Flash, Flex, AIR) 5 | Version: 1 6 | Revision: 0 7 | Minor: 5 8 | Author: Cliff Hall 9 | -------------------------------------------------------------------------- 10 | 1.0.5 - Added a public static hasCore method to Facade and IFacade. 11 | Made Facade.removeCore public static. 12 | Made Model.removeModel public static; 13 | Made View.removeView public static. 14 | Made Controller.removeController public static. 15 | Removed IFacade.removeCore. (interfaces are for instance methods) 16 | Removed IModel.removeModel. (...) 17 | Removed IView.removeView. (...) 18 | Removed IController.removeController. (...) 19 | ...AND... 20 | Followed the changes to in Standard Version 2.0.4, which fixed 21 | 2 outstanding bugs that were common to both versions of the 22 | framework for AS3: Dissallowed re-registration of Mediators in 23 | View.registerMediator. For more on this bug, see: 24 | http://forums.puremvc.org/index.php?topic=372 25 | Modified View.notifyObservers to notify from a copy of the 26 | observer list rather than the actual observer list, which may 27 | change during the notification loop. For more on this bug, see: 28 | http://forums.puremvc.org/index.php?topic=490 29 | 30 | 1.0.4 - Added notifyObservers back to the IFacade interface. This was the 31 | same change made in the Standard Version 2.0.2 32 | 33 | 1.0.3 - Refactored View.removeMediator method, moving the logic for removing 34 | an observer into a removeObserver method (also on IView), which is 35 | now called by the Controller.removeCommand method as well as the 36 | View.removeMediator method. This fixes the issue described here: 37 | http://forums.puremvc.org/index.php?topic=308.0 38 | Also, the Proxy.removeProxy method only attempts to remove the Proxy 39 | if it is registered. This was the same change made in the Standard 40 | Version 2.0.2 41 | 42 | 1.0.2 - Facade and IFacade get removeCore method. Model and IModel get 43 | removeModel method View and IView get removeView method. 44 | Controller and IController get removeController method. Corrected 45 | documentation references to core actors, which were moved together 46 | into the core package. 47 | 48 | 1.0.1 - Corrected issue with SimpleCommands not getting their initializeNotifier 49 | method called. 50 | 51 | 1.0 - Initial AS3 MultiCore Port. Based on PureMVC 2.0.1 feature set. 52 | -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/interfaces/IController.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.interfaces 6 | { 7 | /** 8 | * The interface definition for a PureMVC Controller. 9 | * 10 | *

11 | * In PureMVC, an IController implementor 12 | * follows the 'Command and Controller' strategy, and 13 | * assumes these responsibilities: 14 | *

25 | * 26 | * @see org.puremvc.as3.multicore.interfaces INotification 27 | * @see org.puremvc.as3.multicore.interfaces ICommand 28 | */ 29 | public interface IController 30 | { 31 | 32 | /** 33 | * Register a particular ICommand class as the handler 34 | * for a particular INotification. 35 | * 36 | * @param notificationName the name of the INotification 37 | * @param commandClassRef the Class of the ICommand 38 | */ 39 | function registerCommand( notificationName : String, commandClassRef : Class ) : void; 40 | 41 | /** 42 | * Execute the ICommand previously registered as the 43 | * handler for INotifications with the given notification name. 44 | * 45 | * @param notification the INotification to execute the associated ICommand for 46 | */ 47 | function executeCommand( notification : INotification ) : void; 48 | 49 | /** 50 | * Remove a previously registered ICommand to INotification mapping. 51 | * 52 | * @param notificationName the name of the INotification to remove the ICommand mapping for 53 | */ 54 | function removeCommand( notificationName : String ):void; 55 | 56 | /** 57 | * Check if a Command is registered for a given Notification 58 | * 59 | * @param notificationName 60 | * @return whether a Command is currently registered for the given notificationName. 61 | */ 62 | function hasCommand( notificationName:String ) : Boolean; 63 | 64 | } 65 | } -------------------------------------------------------------------------------- /asdoc/cookies.js: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // ADOBE SYSTEMS INCORPORATED 4 | // Copyright 2006-2007 Adobe Systems Incorporated 5 | // All Rights Reserved. 6 | // 7 | // NOTICE: Adobe permits you to use, modify, and distribute this file 8 | // in accordance with the terms of the license agreement accompanying it. 9 | // 10 | //////////////////////////////////////////////////////////////////////////////// 11 | 12 | /** 13 | * Read the JavaScript cookies tutorial at: 14 | * http://www.netspade.com/articles/javascript/cookies.xml 15 | */ 16 | 17 | /** 18 | * Sets a Cookie with the given name and value. 19 | * 20 | * name Name of the cookie 21 | * value Value of the cookie 22 | * [expires] Expiration date of the cookie (default: end of current session) 23 | * [path] Path where the cookie is valid (default: path of calling document) 24 | * [domain] Domain where the cookie is valid 25 | * (default: domain of calling document) 26 | * [secure] Boolean value indicating if the cookie transmission requires a 27 | * secure transmission 28 | */ 29 | function setCookie(name, value, expires, path, domain, secure) 30 | { 31 | document.cookie= name + "=" + escape(value) + 32 | ((expires) ? "; expires=" + expires.toGMTString() : "") + 33 | ((path) ? "; path=" + path : "") + 34 | ((domain) ? "; domain=" + domain : "") + 35 | ((secure) ? "; secure" : ""); 36 | } 37 | 38 | /** 39 | * Gets the value of the specified cookie. 40 | * 41 | * name Name of the desired cookie. 42 | * 43 | * Returns a string containing value of specified cookie, 44 | * or null if cookie does not exist. 45 | */ 46 | function getCookie(name) 47 | { 48 | var dc = document.cookie; 49 | var prefix = name + "="; 50 | var begin = dc.indexOf("; " + prefix); 51 | if (begin == -1) 52 | { 53 | begin = dc.indexOf(prefix); 54 | if (begin != 0) return null; 55 | } 56 | else 57 | { 58 | begin += 2; 59 | } 60 | var end = document.cookie.indexOf(";", begin); 61 | if (end == -1) 62 | { 63 | end = dc.length; 64 | } 65 | return unescape(dc.substring(begin + prefix.length, end)); 66 | } 67 | 68 | /** 69 | * Deletes the specified cookie. 70 | * 71 | * name name of the cookie 72 | * [path] path of the cookie (must be same as path used to create cookie) 73 | * [domain] domain of the cookie (must be same as domain used to create cookie) 74 | */ 75 | function deleteCookie(name, path, domain) 76 | { 77 | if (getCookie(name)) 78 | { 79 | document.cookie = name + "=" + 80 | ((path) ? "; path=" + path : "") + 81 | ((domain) ? "; domain=" + domain : "") + 82 | "; expires=Thu, 01-Jan-70 00:00:01 GMT"; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /asdoc/print.css: -------------------------------------------------------------------------------- 1 | /* 2 | //////////////////////////////////////////////////////////////////////////////// 3 | // 4 | // ADOBE SYSTEMS INCORPORATED 5 | // Copyright 2005-2007 Adobe Systems Incorporated 6 | // All Rights Reserved. 7 | // 8 | // NOTICE: Adobe permits you to use, modify, and distribute this file 9 | // in accordance with the terms of the license agreement accompanying it. 10 | // 11 | //////////////////////////////////////////////////////////////////////////////// 12 | */ 13 | 14 | body { 15 | color: #000000; 16 | background: #ffffff; 17 | font-family: "Times New Roman", Times, serif; 18 | font-size: 12pt; 19 | } 20 | a { 21 | text-decoration: none; 22 | color: #000000; 23 | } 24 | pre { 25 | white-space: -moz-pre-wrap; /* Mozilla */ 26 | white-space: -pre-wrap; /* Opera 4-6 */ 27 | white-space: -o-pre-wrap; /* Opera 7 */ 28 | word-wrap: break-word; /* IE */ 29 | } 30 | .titleTableTopNav, .titleTableSubNav, .logoImage { 31 | display: none; 32 | } 33 | .packageFrame { 34 | display: none; 35 | } 36 | .titleTableSubTitle { 37 | font-weight: bold; 38 | } 39 | .classHeaderTableLabel { 40 | padding-right: 10px; 41 | vertical-align: top; 42 | } 43 | .showHideLinks { 44 | display: none; 45 | } 46 | html>body code { 47 | font-size: 10pt; 48 | } 49 | .summaryTableTitle, .detailSectionHeader { 50 | font-size: 14pt; 51 | font-weight: bold; 52 | padding-top: 15px; 53 | padding-bottom: 5px; 54 | } 55 | .summaryTable { 56 | border: 1px solid #000000; 57 | border-collapse: collapse; 58 | width: 100%; 59 | } 60 | .summaryTableDescription { 61 | padding-bottom: 20px; 62 | } 63 | .summaryTableSignatureCol, .summaryTableOwnerCol, .summaryTableLastCol, .summaryTableCol { 64 | border: 1px solid #000000; 65 | } 66 | .summaryTablePaddingCol { 67 | border: 1px solid #000000; 68 | border-right: 0px; 69 | } 70 | .summaryTableInheritanceCol, .summaryTableOperatorCol, .summaryTableStatementCol, .summaryTableSecondCol { 71 | border: 1px solid #000000; 72 | border-left: 0px; 73 | } 74 | .summaryTableLastCol { 75 | vertical-align: top; 76 | } 77 | .detailHeader { 78 | font-size: 13pt; 79 | padding-top: 100px; 80 | } 81 | .detailHeaderName { 82 | font-weight: bold; 83 | } 84 | .detailHeaderType { 85 | padding-left: 5px; 86 | } 87 | .detailHeaderRule { 88 | background: #FF0000; 89 | } 90 | .seeAlso { 91 | padding-bottom: 20px; 92 | margin-top: -20px; 93 | } 94 | .innertable { 95 | border-collapse: collapse; 96 | } 97 | .innertable td,.innertable th { 98 | border: 1px solid #000000; 99 | padding-left: 5px; 100 | padding-right: 5px; 101 | } 102 | .listing { 103 | font-size: 10pt; 104 | } 105 | .feedbackLink { 106 | display: none; 107 | } 108 | .copyright { 109 | font-size: 10pt; 110 | } -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/interfaces/INotification.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.interfaces 6 | { 7 | /** 8 | * The interface definition for a PureMVC Notification. 9 | * 10 | *

11 | * PureMVC does not rely upon underlying event models such 12 | * as the one provided with Flash, and ActionScript 3 does 13 | * not have an inherent event model.

14 | * 15 | *

16 | * The Observer Pattern as implemented within PureMVC exists 17 | * to support event-driven communication between the 18 | * application and the actors of the MVC triad.

19 | * 20 | *

21 | * Notifications are not meant to be a replacement for Events 22 | * in Flex/Flash/AIR. Generally, IMediator implementors 23 | * place event listeners on their view components, which they 24 | * then handle in the usual way. This may lead to the broadcast of Notifications to 25 | * trigger ICommands or to communicate with other IMediators. IProxy and ICommand 26 | * instances communicate with each other and IMediators 27 | * by broadcasting INotifications.

28 | * 29 | *

30 | * A key difference between Flash Events and PureMVC 31 | * Notifications is that Events follow the 32 | * 'Chain of Responsibility' pattern, 'bubbling' up the display hierarchy 33 | * until some parent component handles the Event, while 34 | * PureMVC Notifications follow a 'Publish/Subscribe' 35 | * pattern. PureMVC classes need not be related to each other in a 36 | * parent/child relationship in order to communicate with one another 37 | * using Notifications. 38 | * 39 | * @see org.puremvc.as3.multicore.interfaces.IView IView 40 | * @see org.puremvc.as3.multicore.interfaces.IObserver IObserver 41 | */ 42 | public interface INotification 43 | { 44 | 45 | /** 46 | * Get the name of the INotification instance. 47 | * No setter, should be set by constructor only 48 | */ 49 | function getName():String; 50 | 51 | /** 52 | * Set the body of the INotification instance 53 | */ 54 | function setBody( body:Object ):void; 55 | 56 | /** 57 | * Get the body of the INotification instance 58 | */ 59 | function getBody():Object; 60 | 61 | /** 62 | * Set the type of the INotification instance 63 | */ 64 | function setType( type:String ):void; 65 | 66 | /** 67 | * Get the type of the INotification instance 68 | */ 69 | function getType():String; 70 | 71 | /** 72 | * Get the string representation of the INotification instance 73 | */ 74 | function toString():String; 75 | } 76 | } -------------------------------------------------------------------------------- /asdoc/all-classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | All Classes - API Documentation 6 | 7 | 8 | 9 | 10 | 11 |

12 | All Classes 13 |

14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |
Controller
Facade
ICommand
IController
IFacade
IMediator
IModel
INotification
INotifier
IObserver
IProxy
IView
MacroCommand
Mediator
Model
Notification
Notifier
Observer
Proxy
SimpleCommand
View
79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/interfaces/IObserver.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.interfaces 6 | { 7 | 8 | /** 9 | * The interface definition for a PureMVC Observer. 10 | * 11 | *

12 | * In PureMVC, IObserver implementors assume these responsibilities: 13 | *

19 | * 20 | *

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.

25 | * 26 | *

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.

31 | * 32 | *

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 INotification is broadcast. The Observer then 36 | * acts as a proxy for notifying the interested object. 37 | * 38 | *

39 | * Observers can receive Notifications by having their 40 | * notifyObserver method invoked, passing 41 | * in an object implementing the INotification interface, such 42 | * as a subclass of Notification.

43 | * 44 | * @see org.puremvc.as3.multicore.interfaces.IView IView 45 | * @see org.puremvc.as3.multicore.interfaces.INotification INotification 46 | */ 47 | public interface IObserver 48 | { 49 | /** 50 | * Set the notification method. 51 | * 52 | *

53 | * The notification method should take one parameter of type INotification

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 INotification 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 | } -------------------------------------------------------------------------------- /asdoc/org/puremvc/as3/multicore/patterns/proxy/package-detail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | org.puremvc.as3.multicore.patterns.proxy Summary 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |
34 |
35 | 36 |
Classes
37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 |
 ClassDescription
 Proxy 43 | A base IProxy implementation.
46 |

47 |
48 |

49 | 53 |
54 |
55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /asdoc/org/puremvc/as3/multicore/patterns/facade/package-detail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | org.puremvc.as3.multicore.patterns.facade Summary 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |
34 |
35 | 36 |
Classes
37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 |
 ClassDescription
 Facade 43 | A base Multiton IFacade implementation.
46 |

47 |
48 |

49 | 53 |
54 |
55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /asdoc/org/puremvc/as3/multicore/patterns/mediator/package-detail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | org.puremvc.as3.multicore.patterns.mediator Summary 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |
34 |
35 | 36 |
Classes
37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 |
 ClassDescription
 Mediator 43 | A base IMediator implementation.
46 |

47 |
48 |

49 | 53 |
54 |
55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/patterns/mediator/Mediator.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.patterns.mediator 6 | { 7 | import org.puremvc.as3.multicore.interfaces.*; 8 | import org.puremvc.as3.multicore.patterns.observer.Notifier; 9 | 10 | /** 11 | * A base IMediator implementation. 12 | * 13 | * @see org.puremvc.as3.multicore.core.View View 14 | */ 15 | public class Mediator extends Notifier implements IMediator, INotifier 16 | { 17 | 18 | /** 19 | * The name of the Mediator. 20 | * 21 | *

22 | * Typically, a Mediator will be written to serve 23 | * one specific control or group controls and so, 24 | * will not have a need to be dynamically named.

25 | */ 26 | public static const NAME:String = 'Mediator'; 27 | 28 | /** 29 | * Constructor. 30 | */ 31 | public function Mediator( mediatorName:String=null, viewComponent:Object=null ) { 32 | this.mediatorName = (mediatorName != null)?mediatorName:NAME; 33 | this.viewComponent = viewComponent; 34 | } 35 | 36 | /** 37 | * Get the name of the Mediator. 38 | * @return the Mediator name 39 | */ 40 | public function getMediatorName():String 41 | { 42 | return mediatorName; 43 | } 44 | 45 | /** 46 | * Set the IMediator's view component. 47 | * 48 | * @param Object the view component 49 | */ 50 | public function setViewComponent( viewComponent:Object ):void 51 | { 52 | this.viewComponent = viewComponent; 53 | } 54 | 55 | /** 56 | * Get the Mediator's view component. 57 | * 58 | *

59 | * Additionally, an implicit getter will usually 60 | * be defined in the subclass that casts the view 61 | * object to a type, like this:

62 | * 63 | * 64 | * private function get comboBox : mx.controls.ComboBox 65 | * { 66 | * return viewComponent as mx.controls.ComboBox; 67 | * } 68 | * 69 | * 70 | * @return the view component 71 | */ 72 | public function getViewComponent():Object 73 | { 74 | return viewComponent; 75 | } 76 | 77 | /** 78 | * List the INotification names this 79 | * Mediator is interested in being notified of. 80 | * 81 | * @return Array the list of INotification names 82 | */ 83 | public function listNotificationInterests():Array 84 | { 85 | return [ ]; 86 | } 87 | 88 | /** 89 | * Handle INotifications. 90 | * 91 | *

92 | * Typically this will be handled in a switch statement, 93 | * with one 'case' entry per INotification 94 | * the Mediator is interested in. 95 | */ 96 | public function handleNotification( notification:INotification ):void {} 97 | 98 | /** 99 | * Called by the View when the Mediator is registered 100 | */ 101 | public function onRegister( ):void {} 102 | 103 | /** 104 | * Called by the View when the Mediator is removed 105 | */ 106 | public function onRemove( ):void {} 107 | 108 | // the mediator name 109 | protected var mediatorName:String; 110 | 111 | // The view component 112 | protected var viewComponent:Object; 113 | } 114 | } -------------------------------------------------------------------------------- /asdoc/org/puremvc/as3/multicore/patterns/command/package-detail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | org.puremvc.as3.multicore.patterns.command Summary 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |

32 |
33 |
34 |
35 | 36 |
Classes
37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 | 46 | 48 | 49 |
 ClassDescription
 MacroCommand 43 | A base ICommand implementation that executes other ICommands.
 SimpleCommand 47 | A base ICommand implementation.
50 |

51 |
52 |

53 | 57 |
58 |
59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /asdoc/org/puremvc/as3/multicore/core/package-detail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | org.puremvc.as3.multicore.core Summary 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |
34 |
35 | 36 |
Classes
37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 | 46 | 48 | 49 | 50 | 52 | 53 |
 ClassDescription
 Controller 43 | A Multiton IController implementation.
 Model 47 | A Multiton IModel implementation.
 View 51 | A Multiton IView implementation.
54 |

55 |
56 |

57 | 61 |
62 |
63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/patterns/observer/Observer.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.patterns.observer 6 | { 7 | import org.puremvc.as3.multicore.interfaces.*; 8 | 9 | /** 10 | * A base IObserver implementation. 11 | * 12 | *

13 | * An Observer is an object that encapsulates information 14 | * about an interested object with a method that should 15 | * be called when a particular INotification is broadcast.

16 | * 17 | *

18 | * In PureMVC, the Observer class assumes these responsibilities: 19 | *

25 | * 26 | * @see org.puremvc.as3.multicore.core.View View 27 | * @see org.puremvc.as3.multicore.patterns.observer.Notification Notification 28 | */ 29 | public class Observer implements IObserver 30 | { 31 | private var notify:Function; 32 | private var context:Object; 33 | 34 | /** 35 | * Constructor. 36 | * 37 | *

38 | * The notification method on the interested object should take 39 | * one parameter of type INotification

40 | * 41 | * @param notifyMethod the notification method of the interested object 42 | * @param notifyContext the notification context of the interested object 43 | */ 44 | public function Observer( notifyMethod:Function, notifyContext:Object ) 45 | { 46 | setNotifyMethod( notifyMethod ); 47 | setNotifyContext( notifyContext ); 48 | } 49 | 50 | /** 51 | * Set the notification method. 52 | * 53 | *

54 | * The notification method should take one parameter of type INotification.

55 | * 56 | * @param notifyMethod the notification (callback) method of the interested object. 57 | */ 58 | public function setNotifyMethod( notifyMethod:Function ):void 59 | { 60 | notify = notifyMethod; 61 | } 62 | 63 | /** 64 | * Set the notification context. 65 | * 66 | * @param notifyContext the notification context (this) of the interested object. 67 | */ 68 | public function setNotifyContext( notifyContext:Object ):void 69 | { 70 | context = notifyContext; 71 | } 72 | 73 | /** 74 | * Get the notification method. 75 | * 76 | * @return the notification (callback) method of the interested object. 77 | */ 78 | private function getNotifyMethod():Function 79 | { 80 | return notify; 81 | } 82 | 83 | /** 84 | * Get the notification context. 85 | * 86 | * @return the notification context (this) of the interested object. 87 | */ 88 | private function getNotifyContext():Object 89 | { 90 | return context; 91 | } 92 | 93 | /** 94 | * Notify the interested object. 95 | * 96 | * @param notification the INotification to pass to the interested object's notification method. 97 | */ 98 | public function notifyObserver( notification:INotification ):void 99 | { 100 | this.getNotifyMethod().apply(this.getNotifyContext(),[notification]); 101 | } 102 | 103 | /** 104 | * Compare an object to the notification context. 105 | * 106 | * @param object the object to compare 107 | * @return boolean indicating if the object and the notification context are the same 108 | */ 109 | public function compareNotifyContext( object:Object ):Boolean 110 | { 111 | return object === this.context; 112 | } 113 | } 114 | } -------------------------------------------------------------------------------- /asdoc/org/puremvc/as3/multicore/patterns/observer/package-detail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | org.puremvc.as3.multicore.patterns.observer Summary 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |
34 |
35 | 36 |
Classes
37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 | 46 | 48 | 49 | 50 | 52 | 53 |
 ClassDescription
 Notification 43 | A base INotification implementation.
 Notifier 47 | A Base INotifier implementation.
 Observer 51 | A base IObserver implementation.
54 |

55 |
56 |

57 | 61 |
62 |
63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## [PureMVC](http://puremvc.github.com/) ActionScript 3 MultiCore Framework 2 | PureMVC is a lightweight framework for creating applications based upon the classic [Model-View-Controller](http://en.wikipedia.org/wiki/Model-view-controller) design meta-pattern. This is the reference implementation of the MultiCore Version, written for the ActionScript 3 language. It supports [modular programming](http://en.wikipedia.org/wiki/Modular_programming) through the use of [Multiton](http://en.wikipedia.org/wiki/Multiton) Core actors instead of the [Singleton](http://en.wikipedia.org/wiki/Singleton_pattern)s used in the [Standard Version](https://github.com/PureMVC/puremvc-as3-standard-framework/wiki). 3 | 4 | * [API Docs](http://puremvc.org/pages/docs/AS3/multicore/framework_asdoc/) 5 | * [Unit Tests](https://github.com/PureMVC/puremvc-as3-multicore-unittests/wiki) 6 | * [Discussion](http://forums.puremvc.org/index.php?board=27.0) 7 | * [MultiCore Version Overview Presentation](http://puremvc.tv/#P002) 8 | * [ActionScript Developer's Guide to PureMVC (O'Reilly)](http://oreil.ly/puremvc) 9 | 10 | ## Demos 11 | * For FLEX 12 | * [App Skeleton](https://github.com/PureMVC/puremvc-as3-demo-flex-appskeleton/wiki) 13 | * [Modularity](https://github.com/PureMVC/puremvc-as3-demo-flex-modularity/wiki) 14 | * [Pipe Works](https://github.com/PureMVC/puremvc-as3-demo-flex-pipeworks/wiki) 15 | * [Sequential](https://github.com/PureMVC/puremvc-as3-demo-flex-sequential/wiki) 16 | * [StopWatch](https://github.com/PureMVC/puremvc-as3-demo-flex-stopwatch/wiki) 17 | 18 | ## Utilities 19 | * For FLEX, FLASH, or AIR 20 | * [Async Command](https://github.com/PureMVC/puremvc-as3-util-asynccommand/wiki) 21 | * [Loadup](https://github.com/PureMVC/puremvc-as3-util-loadup/wiki) 22 | * [Pipes](https://github.com/PureMVC/puremvc-as3-util-pipes/wiki) 23 | * [State Machine](https://github.com/PureMVC/puremvc-as3-util-statemachine/wiki) 24 | * For FLEX or AIR 25 | * [Deployment Config](https://github.com/PureMVC/puremvc-as3-util-flex-deploymentconfig/wiki) 26 | * For AIR 27 | * [Desktop Citizen](https://github.com/PureMVC/puremvc-as3-util-air-desktopcitizen/wiki) 28 | * [XML Database](https://github.com/PureMVC/puremvc-as3-util-air-xmldatabase/wiki) 29 | 30 | ## Status 31 | Production - [Version 1.0.5](https://github.com/PureMVC/puremvc-as3-multicore-framework/blob/master/VERSION) 32 | 33 | ## Platforms / Technologies 34 | * [ActionScript 3](http://en.wikipedia.org/wiki/ActionScript) 35 | * [Flex](http://en.wikipedia.org/wiki/Adobe_flash) 36 | * [Flash](http://en.wikipedia.org/wiki/Adobe_Flex) 37 | * [AIR](http://en.wikipedia.org/wiki/Adobe_Air) 38 | 39 | ## License 40 | * PureMVC AS3 MultiCore Framework - Copyright © 2006-2012 Futurescale, Inc. 41 | * All rights reserved. 42 | 43 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 44 | 45 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 46 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 47 | * Neither the name of Futurescale, Inc., PureMVC.org, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 48 | 49 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 50 | -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/patterns/observer/Notifier.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.patterns.observer 6 | { 7 | import org.puremvc.as3.multicore.interfaces.*; 8 | import org.puremvc.as3.multicore.patterns.facade.Facade; 9 | 10 | /** 11 | * A Base INotifier implementation. 12 | * 13 | *

14 | * MacroCommand, Command, Mediator and Proxy 15 | * all have a need to send Notifications.

16 | *

17 | * The INotifier interface provides a common method called 18 | * sendNotification that relieves implementation code of 19 | * the necessity to actually construct Notifications.

20 | * 21 | *

22 | * The Notifier class, which all of the above mentioned classes 23 | * extend, provides an initialized reference to the Facade 24 | * Multiton, which is required for the convienience method 25 | * for sending Notifications, but also eases implementation as these 26 | * classes have frequent Facade interactions and usually require 27 | * access to the facade anyway.

28 | * 29 | *

30 | * NOTE: In the MultiCore version of the framework, there is one caveat to 31 | * notifiers, they cannot send notifications or reach the facade until they 32 | * have a valid multitonKey. 33 | * 34 | * The multitonKey is set: 35 | * * on a Command when it is executed by the Controller 36 | * * on a Mediator is registered with the View 37 | * * on a Proxy is registered with the Model. 38 | * 39 | * @see org.puremvc.as3.multicore.patterns.proxy.Proxy Proxy 40 | * @see org.puremvc.as3.multicore.patterns.facade.Facade Facade 41 | * @see org.puremvc.as3.multicore.patterns.mediator.Mediator Mediator 42 | * @see org.puremvc.as3.multicore.patterns.command.MacroCommand MacroCommand 43 | * @see org.puremvc.as3.multicore.patterns.command.SimpleCommand SimpleCommand 44 | */ 45 | public class Notifier implements INotifier 46 | { 47 | /** 48 | * Create and send an INotification. 49 | * 50 | *

51 | * Keeps us from having to construct new INotification 52 | * instances in our implementation code. 53 | * @param notificationName the name of the notiification to send 54 | * @param body the body of the notification (optional) 55 | * @param type the type of the notification (optional) 56 | */ 57 | public function sendNotification( notificationName:String, body:Object=null, type:String=null ):void 58 | { 59 | if (facade != null) 60 | facade.sendNotification( notificationName, body, type ); 61 | } 62 | 63 | /** 64 | * Initialize this INotifier instance. 65 | *

66 | * This is how a Notifier gets its multitonKey. 67 | * Calls to sendNotification or to access the 68 | * facade will fail until after this method 69 | * has been called.

70 | * 71 | *

72 | * Mediators, Commands or Proxies may override 73 | * this method in order to send notifications 74 | * or access the Multiton Facade instance as 75 | * soon as possible. They CANNOT access the facade 76 | * in their constructors, since this method will not 77 | * yet have been called.

78 | * 79 | * @param key the multitonKey for this INotifier to use 80 | */ 81 | public function initializeNotifier( key:String ):void 82 | { 83 | multitonKey = key; 84 | } 85 | 86 | // Return the Multiton Facade instance 87 | protected function get facade():IFacade 88 | { 89 | if ( multitonKey == null ) throw Error( MULTITON_MSG ); 90 | return Facade.getInstance( multitonKey ); 91 | } 92 | 93 | // The Multiton Key for this app 94 | protected var multitonKey : String; 95 | 96 | // Message Constants 97 | protected const MULTITON_MSG : String = "multitonKey for this Notifier not yet initialized!"; 98 | 99 | } 100 | } -------------------------------------------------------------------------------- /asdoc/title-bar.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Adobe Flex 2 Language Reference 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 28 | 29 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |
PureMVC AS3 Framework - [MultiCore Version] 26 | All Packages | All Classes | Index | No Frames   27 | 30 |

31 |
 
 
51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/patterns/command/MacroCommand.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.patterns.command 6 | { 7 | 8 | import org.puremvc.as3.multicore.interfaces.*; 9 | import org.puremvc.as3.multicore.patterns.observer.*; 10 | 11 | /** 12 | * A base ICommand implementation that executes other ICommands. 13 | * 14 | *

15 | * A MacroCommand maintains an list of 16 | * ICommand Class references called SubCommands.

17 | * 18 | *

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

24 | * 25 | *

26 | * Unlike SimpleCommand, your subclass 27 | * should not override execute, but instead, should 28 | * override the initializeMacroCommand method, 29 | * calling addSubCommand once for each SubCommand 30 | * to be executed.

31 | * 32 | *

33 | * 34 | * @see org.puremvc.as3.multicore.core.Controller Controller 35 | * @see org.puremvc.as3.multicore.patterns.observer.Notification Notification 36 | * @see org.puremvc.as3.multicore.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 | *

47 | * You should not need to define a constructor, 48 | * instead, override the initializeMacroCommand 49 | * method.

50 | * 51 | *

52 | * If your subclass does define a constructor, be 53 | * sure to call super().

54 | */ 55 | public function MacroCommand() 56 | { 57 | subCommands = new Array(); 58 | initializeMacroCommand(); 59 | } 60 | 61 | /** 62 | * Initialize the MacroCommand. 63 | * 64 | *

65 | * In your subclass, override this method to 66 | * initialize the MacroCommand's SubCommand 67 | * list with ICommand class references like 68 | * this:

69 | * 70 | * 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 | * 79 | * 80 | *

81 | * Note that SubCommands may be any ICommand implementor, 82 | * MacroCommands or SimpleCommands are both acceptable. 83 | */ 84 | protected function initializeMacroCommand():void 85 | { 86 | } 87 | 88 | /** 89 | * Add a SubCommand. 90 | * 91 | *

92 | * The SubCommands will be called in First In/First Out (FIFO) 93 | * order.

94 | * 95 | * @param commandClassRef a reference to the Class of the ICommand. 96 | */ 97 | protected function addSubCommand( commandClassRef:Class ): void 98 | { 99 | subCommands.push(commandClassRef); 100 | } 101 | 102 | /** 103 | * Execute this MacroCommand's SubCommands. 104 | * 105 | *

106 | * The SubCommands will be called in First In/First Out (FIFO) 107 | * order. 108 | * 109 | * @param notification the INotification object to be passsed to each SubCommand. 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.initializeNotifier( multitonKey ); 117 | commandInstance.execute( notification ); 118 | } 119 | } 120 | 121 | } 122 | } -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/patterns/observer/Notification.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.patterns.observer 6 | { 7 | import org.puremvc.as3.multicore.interfaces.*; 8 | 9 | /** 10 | * A base INotification implementation. 11 | * 12 | *

13 | * PureMVC does not rely upon underlying event models such 14 | * as the one provided with Flash, and ActionScript 3 does 15 | * not have an inherent event model.

16 | * 17 | *

18 | * The Observer Pattern as implemented within PureMVC exists 19 | * to support event-driven communication between the 20 | * application and the actors of the MVC triad.

21 | * 22 | *

23 | * Notifications are not meant to be a replacement for Events 24 | * in Flex/Flash/Apollo. Generally, IMediator implementors 25 | * place event listeners on their view components, which they 26 | * then handle in the usual way. This may lead to the broadcast of Notifications to 27 | * trigger ICommands or to communicate with other IMediators. IProxy and ICommand 28 | * instances communicate with each other and IMediators 29 | * by broadcasting INotifications.

30 | * 31 | *

32 | * A key difference between Flash Events and PureMVC 33 | * Notifications is that Events follow the 34 | * 'Chain of Responsibility' pattern, 'bubbling' up the display hierarchy 35 | * until some parent component handles the Event, while 36 | * PureMVC Notifications follow a 'Publish/Subscribe' 37 | * pattern. PureMVC classes need not be related to each other in a 38 | * parent/child relationship in order to communicate with one another 39 | * using Notifications. 40 | * 41 | * @see org.puremvc.as3.multicore.patterns.observer.Observer Observer 42 | * 43 | */ 44 | public class Notification implements INotification 45 | { 46 | 47 | /** 48 | * Constructor. 49 | * 50 | * @param name name of the Notification instance. (required) 51 | * @param body the Notification body. (optional) 52 | * @param type the type of the Notification (optional) 53 | */ 54 | public function Notification( name:String, body:Object=null, type:String=null ) 55 | { 56 | this.name = name; 57 | this.body = body; 58 | this.type = type; 59 | } 60 | 61 | /** 62 | * Get the name of the Notification instance. 63 | * 64 | * @return the name of the Notification instance. 65 | */ 66 | public function getName():String 67 | { 68 | return name; 69 | } 70 | 71 | /** 72 | * Set the body of the Notification instance. 73 | */ 74 | public function setBody( body:Object ):void 75 | { 76 | this.body = body; 77 | } 78 | 79 | /** 80 | * Get the body of the Notification instance. 81 | * 82 | * @return the body object. 83 | */ 84 | public function getBody():Object 85 | { 86 | return body; 87 | } 88 | 89 | /** 90 | * Set the type of the Notification instance. 91 | */ 92 | public function setType( type:String ):void 93 | { 94 | this.type = type; 95 | } 96 | 97 | /** 98 | * Get the type of the Notification instance. 99 | * 100 | * @return the type 101 | */ 102 | public function getType():String 103 | { 104 | return type; 105 | } 106 | 107 | /** 108 | * Get the string representation of the Notification instance. 109 | * 110 | * @return the string representation of the Notification instance. 111 | */ 112 | public function toString():String 113 | { 114 | var msg:String = "Notification Name: "+getName(); 115 | msg += "\nBody:"+(( body == null )?"null":body.toString()); 116 | msg += "\nType:"+(( type == null )?"null":type); 117 | return msg; 118 | } 119 | 120 | // the name of the notification instance 121 | private var name : String; 122 | // the type of the notification instance 123 | private var type : String; 124 | // the body of the notification instance 125 | private var body : Object; 126 | 127 | } 128 | } -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/interfaces/IView.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.interfaces 6 | { 7 | 8 | /** 9 | * The interface definition for a PureMVC View. 10 | * 11 | *

12 | * In PureMVC, IView implementors assume these responsibilities:

13 | * 14 | *

15 | * In PureMVC, the View class assumes these responsibilities: 16 | *

24 | * 25 | * @see org.puremvc.as3.multicore.interfaces.IMediator IMediator 26 | * @see org.puremvc.as3.multicore.interfaces.IObserver IObserver 27 | * @see org.puremvc.as3.multicore.interfaces.INotification INotification 28 | */ 29 | public interface IView 30 | { 31 | 32 | /** 33 | * Register an IObserver to be notified 34 | * of INotifications with a given name. 35 | * 36 | * @param notificationName the name of the INotifications to notify this IObserver of 37 | * @param observer the IObserver 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 | *

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 IObservers for a particular INotification. 51 | * 52 | *

53 | * All previously attached IObservers for this INotification's 54 | * list are notified and are passed a reference to the INotification in 55 | * the order in which they were registered.

56 | * 57 | * @param notification the INotification to notify IObservers of. 58 | */ 59 | function notifyObservers( note:INotification ) : void; 60 | 61 | /** 62 | * Register an IMediator instance with the View. 63 | * 64 | *

65 | * Registers the IMediator so that it can be retrieved by name, 66 | * and further interrogates the IMediator for its 67 | * INotification interests.

68 | *

69 | * If the IMediator returns any INotification 70 | * names to be notified about, an Observer is created encapsulating 71 | * the IMediator instance's handleNotification method 72 | * and registering it as an Observer for all INotifications the 73 | * IMediator is interested in.

74 | * 75 | * @param mediatorName the name to associate with this IMediator instance 76 | * @param mediator a reference to the IMediator instance 77 | */ 78 | function registerMediator( mediator:IMediator ) : void; 79 | 80 | /** 81 | * Retrieve an IMediator from the View. 82 | * 83 | * @param mediatorName the name of the IMediator instance to retrieve. 84 | * @return the IMediator instance previously registered with the given mediatorName. 85 | */ 86 | function retrieveMediator( mediatorName:String ) : IMediator; 87 | 88 | /** 89 | * Remove an IMediator from the View. 90 | * 91 | * @param mediatorName name of the IMediator instance to be removed. 92 | * @return the IMediator that was removed from the View 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 mediatorName. 101 | */ 102 | function hasMediator( mediatorName:String ) : Boolean; 103 | 104 | } 105 | 106 | } -------------------------------------------------------------------------------- /asdoc/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | All Packages 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |
34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |
 PackageDescription
 org.puremvc.as3.multicore.core 
 org.puremvc.as3.multicore.interfaces 
 org.puremvc.as3.multicore.patterns.command 
 org.puremvc.as3.multicore.patterns.facade 
 org.puremvc.as3.multicore.patterns.mediator 
 org.puremvc.as3.multicore.patterns.observer 
 org.puremvc.as3.multicore.patterns.proxy 
60 |

61 | 65 |
66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/core/Model.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.core 6 | { 7 | 8 | import org.puremvc.as3.multicore.interfaces.*; 9 | 10 | /** 11 | * A Multiton IModel implementation. 12 | * 13 | *

14 | * In PureMVC, the Model class provides 15 | * access to model objects (Proxies) by named lookup. 16 | * 17 | *

18 | * The Model assumes these responsibilities:

19 | * 20 | * 25 | * 26 | *

27 | * Your application must register IProxy instances 28 | * with the Model. Typically, you use an 29 | * ICommand to create and register IProxy 30 | * instances once the Facade has initialized the Core 31 | * actors.

32 | * 33 | * @see org.puremvc.as3.multicore.patterns.proxy.Proxy Proxy 34 | * @see org.puremvc.as3.multicore.interfaces.IProxy IProxy 35 | */ 36 | public class Model implements IModel 37 | { 38 | /** 39 | * Constructor. 40 | * 41 | *

42 | * This IModel implementation is a Multiton, 43 | * so you should not call the constructor 44 | * directly, but instead call the static Multiton 45 | * Factory method Model.getInstance( multitonKey ) 46 | * 47 | * @throws Error Error if instance for this Multiton key instance has already been constructed 48 | * 49 | */ 50 | public function Model( key:String ) 51 | { 52 | if (instanceMap[ key ] != null) throw Error(MULTITON_MSG); 53 | multitonKey = key; 54 | instanceMap[ multitonKey ] = this; 55 | proxyMap = new Array(); 56 | initializeModel(); 57 | } 58 | 59 | /** 60 | * Initialize the Model instance. 61 | * 62 | *

63 | * Called automatically by the constructor, this 64 | * is your opportunity to initialize the Singleton 65 | * instance in your subclass without overriding the 66 | * constructor.

67 | * 68 | * @return void 69 | */ 70 | protected function initializeModel( ) : void 71 | { 72 | } 73 | 74 | /** 75 | * Model Multiton Factory method. 76 | * 77 | * @return the instance for this Multiton key 78 | */ 79 | public static function getInstance( key:String ) : IModel 80 | { 81 | if (instanceMap[ key ] == null) instanceMap[key] = new Model( key ); 82 | return instanceMap[key]; 83 | } 84 | 85 | /** 86 | * Register an IProxy with the Model. 87 | * 88 | * @param proxy an IProxy to be held by the Model. 89 | */ 90 | public function registerProxy( proxy:IProxy ) : void 91 | { 92 | proxy.initializeNotifier( multitonKey ); 93 | proxyMap[ proxy.getProxyName() ] = proxy; 94 | proxy.onRegister(); 95 | } 96 | 97 | /** 98 | * Retrieve an IProxy from the Model. 99 | * 100 | * @param proxyName 101 | * @return the IProxy instance previously registered with the given proxyName. 102 | */ 103 | public function retrieveProxy( proxyName:String ) : IProxy 104 | { 105 | return proxyMap[ proxyName ]; 106 | } 107 | 108 | /** 109 | * Check if a Proxy is registered 110 | * 111 | * @param proxyName 112 | * @return whether a Proxy is currently registered with the given proxyName. 113 | */ 114 | public function hasProxy( proxyName:String ) : Boolean 115 | { 116 | return proxyMap[ proxyName ] != null; 117 | } 118 | 119 | /** 120 | * Remove an IProxy from the Model. 121 | * 122 | * @param proxyName name of the IProxy instance to be removed. 123 | * @return the IProxy that was removed from the Model 124 | */ 125 | public function removeProxy( proxyName:String ) : IProxy 126 | { 127 | var proxy:IProxy = proxyMap [ proxyName ] as IProxy; 128 | if ( proxy ) 129 | { 130 | proxyMap[ proxyName ] = null; 131 | proxy.onRemove(); 132 | } 133 | return proxy; 134 | } 135 | 136 | /** 137 | * Remove an IModel instance 138 | * 139 | * @param multitonKey of IModel instance to remove 140 | */ 141 | public static function removeModel( key:String ):void 142 | { 143 | delete instanceMap[ key ]; 144 | } 145 | 146 | // Mapping of proxyNames to IProxy instances 147 | protected var proxyMap : Array; 148 | 149 | // Singleton instance 150 | protected static var instanceMap:Array = new Array(); 151 | 152 | // The Multiton Key for this Core 153 | protected var multitonKey : String; 154 | 155 | // Message Constants 156 | protected const MULTITON_MSG:String = "Model instance for this Multiton key already constructed!"; 157 | 158 | } 159 | 160 | } 161 | -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/interfaces/IFacade.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.interfaces 6 | { 7 | 8 | /** 9 | * The interface definition for a PureMVC Facade. 10 | * 11 | *

12 | * The Facade Pattern suggests providing a single 13 | * class to act as a central point of communication 14 | * for a subsystem.

15 | * 16 | *

17 | * In PureMVC, the Facade acts as an interface between 18 | * the core MVC actors (Model, View, Controller) and 19 | * the rest of your application.

20 | * 21 | * @see org.puremvc.as3.multicore.interfaces.IModel IModel 22 | * @see org.puremvc.as3.multicore.interfaces.IView IView 23 | * @see org.puremvc.as3.multicore.interfaces.IController IController 24 | * @see org.puremvc.as3.multicore.interfaces.ICommand ICommand 25 | * @see org.puremvc.as3.multicore.interfaces.INotification INotification 26 | */ 27 | public interface IFacade extends INotifier 28 | { 29 | 30 | /** 31 | * Register an IProxy with the Model by name. 32 | * 33 | * @param proxy the IProxy to be registered with the Model. 34 | */ 35 | function registerProxy( proxy:IProxy ) : void; 36 | 37 | /** 38 | * Retrieve a IProxy from the Model by name. 39 | * 40 | * @param proxyName the name of the IProxy instance to be retrieved. 41 | * @return the IProxy previously regisetered by proxyName with the Model. 42 | */ 43 | function retrieveProxy( proxyName:String ) : IProxy; 44 | 45 | /** 46 | * Remove an IProxy instance from the Model by name. 47 | * 48 | * @param proxyName the IProxy to remove from the Model. 49 | * @return the IProxy that was removed from the Model 50 | */ 51 | function removeProxy( proxyName:String ) : IProxy; 52 | 53 | /** 54 | * Check if a Proxy is registered 55 | * 56 | * @param proxyName 57 | * @return whether a Proxy is currently registered with the given proxyName. 58 | */ 59 | function hasProxy( proxyName:String ) : Boolean; 60 | 61 | /** 62 | * Register an ICommand with the Controller. 63 | * 64 | * @param noteName the name of the INotification to associate the ICommand with. 65 | * @param commandClassRef a reference to the Class of the ICommand. 66 | */ 67 | function registerCommand( noteName : String, commandClassRef : Class ) : void; 68 | 69 | /** 70 | * Remove a previously registered ICommand to INotification mapping from the Controller. 71 | * 72 | * @param notificationName the name of the INotification to remove the ICommand mapping for 73 | */ 74 | function removeCommand( notificationName:String ): void; 75 | 76 | /** 77 | * Check if a Command is registered for a given Notification 78 | * 79 | * @param notificationName 80 | * @return whether a Command is currently registered for the given notificationName. 81 | */ 82 | function hasCommand( notificationName:String ) : Boolean; 83 | 84 | /** 85 | * Register an IMediator instance with the View. 86 | * 87 | * @param mediator a reference to the IMediator instance 88 | */ 89 | function registerMediator( mediator:IMediator ) : void; 90 | 91 | /** 92 | * Retrieve an IMediator instance from the View. 93 | * 94 | * @param mediatorName the name of the IMediator instance to retrievve 95 | * @return the IMediator previously registered with the given mediatorName. 96 | */ 97 | function retrieveMediator( mediatorName:String ) : IMediator; 98 | 99 | /** 100 | * Remove a IMediator instance from the View. 101 | * 102 | * @param mediatorName name of the IMediator instance to be removed. 103 | * @return the IMediator instance previously registered with the given mediatorName. 104 | */ 105 | function removeMediator( mediatorName:String ) : IMediator; 106 | 107 | /** 108 | * Check if a Mediator is registered or not 109 | * 110 | * @param mediatorName 111 | * @return whether a Mediator is registered with the given mediatorName. 112 | */ 113 | function hasMediator( mediatorName:String ) : Boolean; 114 | 115 | /** 116 | * Notify Observers. 117 | *

118 | * This method is left public mostly for backward 119 | * compatibility, and to allow you to send custom 120 | * notification classes using the facade.

121 | *

122 | * Usually you should just call sendNotification 123 | * and pass the parameters, never having to 124 | * construct the notification yourself.

125 | * 126 | * @param notification the INotification to have the View notify Observers of. 127 | */ 128 | function notifyObservers( notification:INotification ):void; 129 | 130 | } 131 | } -------------------------------------------------------------------------------- /asdoc/org/puremvc/as3/multicore/interfaces/package-detail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | org.puremvc.as3.multicore.interfaces Summary 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 |
34 |
35 | 36 |
Interfaces
37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 | 46 | 48 | 49 | 50 | 52 | 53 | 54 | 56 | 57 | 58 | 60 | 61 | 62 | 64 | 65 | 66 | 68 | 69 | 70 | 72 | 73 | 74 | 76 | 77 | 78 | 80 | 81 |
 InterfaceDescription
 ICommand 43 | The interface definition for a PureMVC Command.
 IController 47 | The interface definition for a PureMVC Controller.
 IFacade 51 | The interface definition for a PureMVC Facade.
 IMediator 55 | The interface definition for a PureMVC Mediator.
 IModel 59 | The interface definition for a PureMVC Model.
 INotification 63 | The interface definition for a PureMVC Notification.
 INotifier 67 | The interface definition for a PureMVC Notifier.
 IObserver 71 | The interface definition for a PureMVC Observer.
 IProxy 75 | The interface definition for a PureMVC Proxy.
 IView 79 | The interface definition for a PureMVC View.
82 |

83 |
84 |

85 | 89 |
90 |
91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/interfaces/IMediator.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.interfaces 6 | { 7 | 8 | /** 9 | * The interface definition for a PureMVC Mediator. 10 | * 11 | *

12 | * In PureMVC, IMediator implementors assume these responsibilities:

13 | * 19 | *

20 | * Additionally, IMediators typically: 21 | *

29 | *

30 | * When an IMediator is registered with the IView, 31 | * the IView will call the IMediator's 32 | * listNotificationInterests method. The IMediator will 33 | * return an Array of INotification names which 34 | * it wishes to be notified about.

35 | * 36 | *

37 | * The IView will then create an Observer object 38 | * encapsulating that IMediator's (handleNotification) method 39 | * and register it as an Observer for each INotification name returned by 40 | * listNotificationInterests.

41 | * 42 | *

43 | * A concrete IMediator implementor usually looks something like this:

44 | * 45 | * 46 | * import org.puremvc.as3.multicore.patterns.mediator.~~; 47 | * import org.puremvc.as3.multicore.patterns.observer.~~; 48 | * import org.puremvc.as3.multicore.core.view.~~; 49 | * 50 | * import com.me.myapp.model.~~; 51 | * import com.me.myapp.view.~~; 52 | * import com.me.myapp.controller.~~; 53 | * 54 | * import mx.controls.ComboBox; 55 | * import mx.events.ListEvent; 56 | * 57 | * public class MyMediator extends Mediator implements IMediator { 58 | * 59 | * public function MyComboMediator( viewComponent:Object ) { 60 | * super( viewComponent ); 61 | * combo.addEventListener( Event.CHANGE, onChange ); 62 | * } 63 | * 64 | * override public function listNotificationInterests():Array { 65 | * return [ MyFacade.SET_SELECTION, 66 | * MyFacade.SET_DATAPROVIDER ]; 67 | * } 68 | * 69 | * override public function handleNotification( notification:INotification ):void { 70 | * switch ( notification.getName() ) { 71 | * case MyFacade.SET_SELECTION: 72 | * setSelection(notification); 73 | * break; 74 | * case MyFacade.SET_DATAPROVIDER: 75 | * setDataProvider(notification); 76 | * break; 77 | * } 78 | * } 79 | * 80 | * // Set the data provider of the combo box 81 | * protected function setDataProvider( notification:INotification ):void { 82 | * combo.dataProvider = notification.getBody() as Array; 83 | * } 84 | * 85 | * // Invoked when the combo box dispatches a change event, we send a 86 | * // notification with the 87 | * protected function onChange(event:ListEvent):void { 88 | * sendNotification( MyFacade.MYCOMBO_CHANGED, this ); 89 | * } 90 | * 91 | * // A private getter for accessing the view object by class 92 | * protected function get combo():ComboBox { 93 | * return view as ComboBox; 94 | * } 95 | * 96 | * } 97 | * 98 | * 99 | * @see org.puremvc.as3.multicore.interfaces.INotification INotification 100 | */ 101 | public interface IMediator extends INotifier 102 | { 103 | 104 | /** 105 | * Get the IMediator instance name 106 | * 107 | * @return the IMediator instance name 108 | */ 109 | function getMediatorName():String; 110 | 111 | /** 112 | * Get the IMediator's view component. 113 | * 114 | * @return Object the view component 115 | */ 116 | function getViewComponent():Object; 117 | 118 | /** 119 | * Set the IMediator's view component. 120 | * 121 | * @param Object the view component 122 | */ 123 | function setViewComponent( viewComponent:Object ):void; 124 | 125 | /** 126 | * List INotification interests. 127 | * 128 | * @return an Array of the INotification names this IMediator has an interest in. 129 | */ 130 | function listNotificationInterests( ):Array; 131 | 132 | /** 133 | * Handle an INotification. 134 | * 135 | * @param notification the INotification to be handled 136 | */ 137 | function handleNotification( notification:INotification ):void; 138 | 139 | /** 140 | * Called by the View when the Mediator is registered 141 | */ 142 | function onRegister( ):void; 143 | 144 | /** 145 | * Called by the View when the Mediator is removed 146 | */ 147 | function onRemove( ):void; 148 | 149 | } 150 | } -------------------------------------------------------------------------------- /asdoc/all-index-B.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | B Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 49 |
50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /asdoc/all-index-J.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | J Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 49 |
50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /asdoc/all-index-K.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | K Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 49 |
50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /asdoc/all-index-Q.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Q Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 49 |
50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /asdoc/all-index-U.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | U Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 49 |
50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /asdoc/all-index-W.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | W Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 49 |
50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /asdoc/all-index-X.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | X Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 49 |
50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /asdoc/all-index-Y.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Y Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 49 |
50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /asdoc/all-index-Z.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Z Index 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  
44 |

45 | 49 |
50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /src/org/puremvc/as3/multicore/core/Controller.as: -------------------------------------------------------------------------------- 1 | /* 2 | PureMVC MultiCore - 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.multicore.core 6 | { 7 | import org.puremvc.as3.multicore.interfaces.*; 8 | import org.puremvc.as3.multicore.patterns.observer.*; 9 | 10 | /** 11 | * A Multiton IController implementation. 12 | * 13 | *

14 | * In PureMVC, the Controller class follows the 15 | * 'Command and Controller' strategy, and assumes these 16 | * responsibilities: 17 | *

28 | * 29 | *

30 | * Your application must register ICommands with the 31 | * Controller. 32 | *

33 | * The simplest way is to subclass Facade, 34 | * and use its initializeController method to add your 35 | * registrations. 36 | * 37 | * @see org.puremvc.as3.multicore.core.View View 38 | * @see org.puremvc.as3.multicore.patterns.observer.Observer Observer 39 | * @see org.puremvc.as3.multicore.patterns.observer.Notification Notification 40 | * @see org.puremvc.as3.multicore.patterns.command.SimpleCommand SimpleCommand 41 | * @see org.puremvc.as3.multicore.patterns.command.MacroCommand MacroCommand 42 | */ 43 | public class Controller implements IController 44 | { 45 | 46 | /** 47 | * Constructor. 48 | * 49 | *

50 | * This IController implementation is a Multiton, 51 | * so you should not call the constructor 52 | * directly, but instead call the static Factory method, 53 | * passing the unique key for this instance 54 | * Controller.getInstance( multitonKey ) 55 | * 56 | * @throws Error Error if instance for this Multiton key has already been constructed 57 | * 58 | */ 59 | public function Controller( key:String ) 60 | { 61 | if (instanceMap[ key ] != null) throw Error(MULTITON_MSG); 62 | multitonKey = key; 63 | instanceMap[ multitonKey ] = this; 64 | commandMap = new Array(); 65 | initializeController(); 66 | } 67 | 68 | /** 69 | * Initialize the Multiton Controller instance. 70 | * 71 | *

Called automatically by the constructor.

72 | * 73 | *

Note that if you are using a subclass of View 74 | * in your application, you should also subclass Controller 75 | * and override the initializeController method in the 76 | * following way:

77 | * 78 | * 79 | * // ensure that the Controller is talking to my IView implementation 80 | * override public function initializeController( ) : void 81 | * { 82 | * view = MyView.getInstance(); 83 | * } 84 | * 85 | * 86 | * @return void 87 | */ 88 | protected function initializeController( ) : void 89 | { 90 | view = View.getInstance( multitonKey ); 91 | } 92 | 93 | /** 94 | * Controller Multiton Factory method. 95 | * 96 | * @return the Multiton instance of Controller 97 | */ 98 | public static function getInstance( key:String ) : IController 99 | { 100 | if ( instanceMap[ key ] == null ) instanceMap[ key ] = new Controller( key ); 101 | return instanceMap[ key ]; 102 | } 103 | 104 | /** 105 | * If an ICommand has previously been registered 106 | * to handle a the given INotification, then it is executed. 107 | * 108 | * @param note an INotification 109 | */ 110 | public function executeCommand( note : INotification ) : void 111 | { 112 | var commandClassRef : Class = commandMap[ note.getName() ]; 113 | if ( commandClassRef == null ) return; 114 | 115 | var commandInstance : ICommand = new commandClassRef(); 116 | commandInstance.initializeNotifier( multitonKey ); 117 | commandInstance.execute( note ); 118 | } 119 | 120 | /** 121 | * Register a particular ICommand class as the handler 122 | * for a particular INotification. 123 | * 124 | *

125 | * If an ICommand has already been registered to 126 | * handle INotifications with this name, it is no longer 127 | * used, the new ICommand is used instead.

128 | * 129 | * The Observer for the new ICommand is only created if this the 130 | * first time an ICommand has been regisered for this Notification name. 131 | * 132 | * @param notificationName the name of the INotification 133 | * @param commandClassRef the Class of the ICommand 134 | */ 135 | public function registerCommand( notificationName : String, commandClassRef : Class ) : void 136 | { 137 | if ( commandMap[ notificationName ] == null ) { 138 | view.registerObserver( notificationName, new Observer( executeCommand, this ) ); 139 | } 140 | commandMap[ notificationName ] = commandClassRef; 141 | } 142 | 143 | /** 144 | * Check if a Command is registered for a given Notification 145 | * 146 | * @param notificationName 147 | * @return whether a Command is currently registered for the given notificationName. 148 | */ 149 | public function hasCommand( notificationName:String ) : Boolean 150 | { 151 | return commandMap[ notificationName ] != null; 152 | } 153 | 154 | /** 155 | * Remove a previously registered ICommand to INotification mapping. 156 | * 157 | * @param notificationName the name of the INotification to remove the ICommand mapping for 158 | */ 159 | public function removeCommand( notificationName : String ) : void 160 | { 161 | // if the Command is registered... 162 | if ( hasCommand( notificationName ) ) 163 | { 164 | // remove the observer 165 | view.removeObserver( notificationName, this ); 166 | 167 | // remove the command 168 | commandMap[ notificationName ] = null; 169 | } 170 | } 171 | 172 | /** 173 | * Remove an IController instance 174 | * 175 | * @param multitonKey of IController instance to remove 176 | */ 177 | public static function removeController( key:String ):void 178 | { 179 | delete instanceMap[ key ]; 180 | } 181 | 182 | // Local reference to View 183 | protected var view : IView; 184 | 185 | // Mapping of Notification names to Command Class references 186 | protected var commandMap : Array; 187 | 188 | // The Multiton Key for this Core 189 | protected var multitonKey : String; 190 | 191 | // Singleton instance 192 | protected static var instanceMap : Array = new Array(); 193 | 194 | // Message Constants 195 | protected const MULTITON_MSG : String = "Controller instance for this Multiton key already constructed!"; 196 | 197 | } 198 | } -------------------------------------------------------------------------------- /asdoc/org/puremvc/as3/multicore/interfaces/ICommand.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | org.puremvc.as3.multicore.interfaces.ICommand 9 | 10 | 11 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
Packageorg.puremvc.as3.multicore.interfaces
Interfacepublic interface ICommand extends INotifier
ImplementorsMacroCommand, SimpleCommand
44 |

45 | The interface definition for a PureMVC Command. 46 |

47 |

48 | See also 49 |

50 |
51 | INotification 52 |
53 |
54 |
55 |
56 | 57 |
58 |
Public Methods
59 | 67 | 68 | 69 | 70 | 71 | 72 | 78 | 79 | 80 | 86 | 87 | 88 | 94 | 95 |
 MethodDefined by
   73 |
74 | execute(notification:INotification):void
75 |
76 | Execute the ICommand's logic to handle a given INotification.
77 |
ICommand
 Inherited 81 |
82 | initializeNotifier(key:String):void
83 |
84 | Initialize this INotifier instance.
85 |
INotifier
 Inherited 89 |
90 | sendNotification(notificationName:String, body:Object = null, type:String = null):void
91 |
92 | Send a INotification.
93 |
INotifier
96 |
97 | 101 |
102 | 103 |
Method detail
104 | 105 | 106 | 107 | 108 | 109 |
execute()method
110 |
111 | public function execute(notification:INotification):void

112 | Execute the ICommand's logic to handle a given INotification. 113 | 114 |

Parameters 115 | 116 | 117 | 119 | 120 |
notification:INotification — an INotification to handle. 118 |
121 |
122 |
123 |
124 |
125 |
126 |

127 | 131 |
132 | 133 | 134 | 135 | --------------------------------------------------------------------------------