puremvc-as3 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/2.0.4/asdoc/all-classes.html +81 -0
- data/2.0.4/asdoc/all-index-A.html +59 -0
- data/2.0.4/asdoc/all-index-B.html +52 -0
- data/2.0.4/asdoc/all-index-C.html +92 -0
- data/2.0.4/asdoc/all-index-D.html +58 -0
- data/2.0.4/asdoc/all-index-E.html +89 -0
- data/2.0.4/asdoc/all-index-F.html +72 -0
- data/2.0.4/asdoc/all-index-G.html +190 -0
- data/2.0.4/asdoc/all-index-H.html +174 -0
- data/2.0.4/asdoc/all-index-I.html +202 -0
- data/2.0.4/asdoc/all-index-J.html +52 -0
- data/2.0.4/asdoc/all-index-K.html +52 -0
- data/2.0.4/asdoc/all-index-L.html +67 -0
- data/2.0.4/asdoc/all-index-M.html +112 -0
- data/2.0.4/asdoc/all-index-N.html +128 -0
- data/2.0.4/asdoc/all-index-O.html +178 -0
- data/2.0.4/asdoc/all-index-P.html +79 -0
- data/2.0.4/asdoc/all-index-Q.html +52 -0
- data/2.0.4/asdoc/all-index-R.html +308 -0
- data/2.0.4/asdoc/all-index-S.html +193 -0
- data/2.0.4/asdoc/all-index-T.html +67 -0
- data/2.0.4/asdoc/all-index-U.html +52 -0
- data/2.0.4/asdoc/all-index-V.html +84 -0
- data/2.0.4/asdoc/all-index-W.html +52 -0
- data/2.0.4/asdoc/all-index-X.html +52 -0
- data/2.0.4/asdoc/all-index-Y.html +52 -0
- data/2.0.4/asdoc/all-index-Z.html +52 -0
- data/2.0.4/asdoc/appendixes.html +47 -0
- data/2.0.4/asdoc/asdoc.js +273 -0
- data/2.0.4/asdoc/class-summary.html +174 -0
- data/2.0.4/asdoc/cookies.js +84 -0
- data/2.0.4/asdoc/images/collapsed.gif +0 -0
- data/2.0.4/asdoc/images/detailHeaderRule.jpg +0 -0
- data/2.0.4/asdoc/images/detailSectionHeader.jpg +0 -0
- data/2.0.4/asdoc/images/expanded.gif +0 -0
- data/2.0.4/asdoc/images/inherit-arrow.gif +0 -0
- data/2.0.4/asdoc/images/inheritedSummary.gif +0 -0
- data/2.0.4/asdoc/images/logo.jpg +0 -0
- data/2.0.4/asdoc/images/titleTableBottom.jpg +0 -0
- data/2.0.4/asdoc/images/titleTableMiddle.jpg +0 -0
- data/2.0.4/asdoc/images/titleTableTop.jpg +0 -0
- data/2.0.4/asdoc/index-list.html +121 -0
- data/2.0.4/asdoc/index.html +63 -0
- data/2.0.4/asdoc/mxml-tags.html +45 -0
- data/2.0.4/asdoc/org/puremvc/as3/core/Controller.html +433 -0
- data/2.0.4/asdoc/org/puremvc/as3/core/Model.html +405 -0
- data/2.0.4/asdoc/org/puremvc/as3/core/View.html +524 -0
- data/2.0.4/asdoc/org/puremvc/as3/core/class-list.html +30 -0
- data/2.0.4/asdoc/org/puremvc/as3/core/package-detail.html +65 -0
- data/2.0.4/asdoc/org/puremvc/as3/interfaces/ICommand.html +110 -0
- data/2.0.4/asdoc/org/puremvc/as3/interfaces/IController.html +226 -0
- data/2.0.4/asdoc/org/puremvc/as3/interfaces/IFacade.html +520 -0
- data/2.0.4/asdoc/org/puremvc/as3/interfaces/IMediator.html +345 -0
- data/2.0.4/asdoc/org/puremvc/as3/interfaces/IModel.html +226 -0
- data/2.0.4/asdoc/org/puremvc/as3/interfaces/INotification.html +269 -0
- data/2.0.4/asdoc/org/puremvc/as3/interfaces/INotifier.html +151 -0
- data/2.0.4/asdoc/org/puremvc/as3/interfaces/IObserver.html +234 -0
- data/2.0.4/asdoc/org/puremvc/as3/interfaces/IProxy.html +217 -0
- data/2.0.4/asdoc/org/puremvc/as3/interfaces/IView.html +350 -0
- data/2.0.4/asdoc/org/puremvc/as3/interfaces/class-list.html +54 -0
- data/2.0.4/asdoc/org/puremvc/as3/interfaces/package-detail.html +93 -0
- data/2.0.4/asdoc/org/puremvc/as3/patterns/command/MacroCommand.html +284 -0
- data/2.0.4/asdoc/org/puremvc/as3/patterns/command/SimpleCommand.html +164 -0
- data/2.0.4/asdoc/org/puremvc/as3/patterns/command/class-list.html +27 -0
- data/2.0.4/asdoc/org/puremvc/as3/patterns/command/package-detail.html +61 -0
- data/2.0.4/asdoc/org/puremvc/as3/patterns/facade/Facade.html +940 -0
- data/2.0.4/asdoc/org/puremvc/as3/patterns/facade/class-list.html +24 -0
- data/2.0.4/asdoc/org/puremvc/as3/patterns/facade/package-detail.html +57 -0
- data/2.0.4/asdoc/org/puremvc/as3/patterns/mediator/Mediator.html +402 -0
- data/2.0.4/asdoc/org/puremvc/as3/patterns/mediator/class-list.html +24 -0
- data/2.0.4/asdoc/org/puremvc/as3/patterns/mediator/package-detail.html +57 -0
- data/2.0.4/asdoc/org/puremvc/as3/patterns/observer/Notification.html +312 -0
- data/2.0.4/asdoc/org/puremvc/as3/patterns/observer/Notifier.html +180 -0
- data/2.0.4/asdoc/org/puremvc/as3/patterns/observer/Observer.html +253 -0
- data/2.0.4/asdoc/org/puremvc/as3/patterns/observer/class-list.html +30 -0
- data/2.0.4/asdoc/org/puremvc/as3/patterns/observer/package-detail.html +65 -0
- data/2.0.4/asdoc/org/puremvc/as3/patterns/proxy/Proxy.html +338 -0
- data/2.0.4/asdoc/org/puremvc/as3/patterns/proxy/class-list.html +24 -0
- data/2.0.4/asdoc/org/puremvc/as3/patterns/proxy/package-detail.html +57 -0
- data/2.0.4/asdoc/package-frame.html +36 -0
- data/2.0.4/asdoc/package-list.html +52 -0
- data/2.0.4/asdoc/package-summary.html +68 -0
- data/2.0.4/asdoc/print.css +110 -0
- data/2.0.4/asdoc/style.css +565 -0
- data/2.0.4/asdoc/title-bar.html +55 -0
- data/2.0.4/bin/PureMVC_AS3_2_0_4.swc +0 -0
- data/2.0.4/license.txt +61 -0
- data/2.0.4/src/org/puremvc/as3/core/Controller.as +183 -0
- data/2.0.4/src/org/puremvc/as3/core/Model.as +144 -0
- data/2.0.4/src/org/puremvc/as3/core/View.as +271 -0
- data/2.0.4/src/org/puremvc/as3/interfaces/ICommand.as +21 -0
- data/2.0.4/src/org/puremvc/as3/interfaces/IController.as +64 -0
- data/2.0.4/src/org/puremvc/as3/interfaces/IFacade.as +131 -0
- data/2.0.4/src/org/puremvc/as3/interfaces/IMediator.as +150 -0
- data/2.0.4/src/org/puremvc/as3/interfaces/IModel.as +57 -0
- data/2.0.4/src/org/puremvc/as3/interfaces/INotification.as +76 -0
- data/2.0.4/src/org/puremvc/as3/interfaces/INotifier.as +46 -0
- data/2.0.4/src/org/puremvc/as3/interfaces/IObserver.as +81 -0
- data/2.0.4/src/org/puremvc/as3/interfaces/IProxy.as +61 -0
- data/2.0.4/src/org/puremvc/as3/interfaces/IView.as +106 -0
- data/2.0.4/src/org/puremvc/as3/patterns/command/MacroCommand.as +121 -0
- data/2.0.4/src/org/puremvc/as3/patterns/command/SimpleCommand.as +42 -0
- data/2.0.4/src/org/puremvc/as3/patterns/facade/Facade.as +419 -0
- data/2.0.4/src/org/puremvc/as3/patterns/mediator/Mediator.as +115 -0
- data/2.0.4/src/org/puremvc/as3/patterns/observer/Notification.as +128 -0
- data/2.0.4/src/org/puremvc/as3/patterns/observer/Notifier.as +55 -0
- data/2.0.4/src/org/puremvc/as3/patterns/observer/Observer.as +114 -0
- data/2.0.4/src/org/puremvc/as3/patterns/proxy/Proxy.as +88 -0
- data/2.0.4/src/puremvc-manifest.xml +20 -0
- data/2.0.4/version.txt +117 -0
- data/Gemfile +4 -0
- data/README.textile +107 -0
- data/Rakefile +24 -0
- data/lib/puremvc-as3.rb +29 -0
- data/lib/rake/rename.rb +34 -0
- metadata +198 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
/*
|
2
|
+
PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
|
3
|
+
Your reuse is governed by the Creative Commons Attribution 3.0 United States License
|
4
|
+
*/
|
5
|
+
package org.puremvc.as3.interfaces
|
6
|
+
{
|
7
|
+
/**
|
8
|
+
* The interface definition for a PureMVC Command.
|
9
|
+
*
|
10
|
+
* @see org.puremvc.as3.interfaces INotification
|
11
|
+
*/
|
12
|
+
public interface ICommand
|
13
|
+
{
|
14
|
+
/**
|
15
|
+
* Execute the <code>ICommand</code>'s logic to handle a given <code>INotification</code>.
|
16
|
+
*
|
17
|
+
* @param note an <code>INotification</code> to handle.
|
18
|
+
*/
|
19
|
+
function execute( notification:INotification ) : void;
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
/*
|
2
|
+
PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
|
3
|
+
Your reuse is governed by the Creative Commons Attribution 3.0 United States License
|
4
|
+
*/
|
5
|
+
package org.puremvc.as3.interfaces
|
6
|
+
{
|
7
|
+
/**
|
8
|
+
* The interface definition for a PureMVC Controller.
|
9
|
+
*
|
10
|
+
* <P>
|
11
|
+
* In PureMVC, an <code>IController</code> implementor
|
12
|
+
* follows the 'Command and Controller' strategy, and
|
13
|
+
* assumes these responsibilities:
|
14
|
+
* <UL>
|
15
|
+
* <LI> Remembering which <code>ICommand</code>s
|
16
|
+
* are intended to handle which <code>INotifications</code>.</LI>
|
17
|
+
* <LI> Registering itself as an <code>IObserver</code> with
|
18
|
+
* the <code>View</code> for each <code>INotification</code>
|
19
|
+
* that it has an <code>ICommand</code> mapping for.</LI>
|
20
|
+
* <LI> Creating a new instance of the proper <code>ICommand</code>
|
21
|
+
* to handle a given <code>INotification</code> when notified by the <code>View</code>.</LI>
|
22
|
+
* <LI> Calling the <code>ICommand</code>'s <code>execute</code>
|
23
|
+
* method, passing in the <code>INotification</code>.</LI>
|
24
|
+
* </UL>
|
25
|
+
*
|
26
|
+
* @see org.puremvc.as3.interfaces INotification
|
27
|
+
* @see org.puremvc.as3.interfaces ICommand
|
28
|
+
*/
|
29
|
+
public interface IController
|
30
|
+
{
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Register a particular <code>ICommand</code> class as the handler
|
34
|
+
* for a particular <code>INotification</code>.
|
35
|
+
*
|
36
|
+
* @param notificationName the name of the <code>INotification</code>
|
37
|
+
* @param commandClassRef the Class of the <code>ICommand</code>
|
38
|
+
*/
|
39
|
+
function registerCommand( notificationName : String, commandClassRef : Class ) : void;
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Execute the <code>ICommand</code> previously registered as the
|
43
|
+
* handler for <code>INotification</code>s with the given notification name.
|
44
|
+
*
|
45
|
+
* @param notification the <code>INotification</code> to execute the associated <code>ICommand</code> for
|
46
|
+
*/
|
47
|
+
function executeCommand( notification : INotification ) : void;
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Remove a previously registered <code>ICommand</code> to <code>INotification</code> mapping.
|
51
|
+
*
|
52
|
+
* @param notificationName the name of the <code>INotification</code> to remove the <code>ICommand</code> 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 <code>notificationName</code>.
|
61
|
+
*/
|
62
|
+
function hasCommand( notificationName:String ) : Boolean;
|
63
|
+
}
|
64
|
+
}
|
@@ -0,0 +1,131 @@
|
|
1
|
+
/*
|
2
|
+
PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
|
3
|
+
Your reuse is governed by the Creative Commons Attribution 3.0 United States License
|
4
|
+
*/
|
5
|
+
package org.puremvc.as3.interfaces
|
6
|
+
{
|
7
|
+
|
8
|
+
/**
|
9
|
+
* The interface definition for a PureMVC Facade.
|
10
|
+
*
|
11
|
+
* <P>
|
12
|
+
* The Facade Pattern suggests providing a single
|
13
|
+
* class to act as a central point of communication
|
14
|
+
* for a subsystem. </P>
|
15
|
+
*
|
16
|
+
* <P>
|
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.</P>
|
20
|
+
*
|
21
|
+
* @see org.puremvc.as3.interfaces.IModel IModel
|
22
|
+
* @see org.puremvc.as3.interfaces.IView IView
|
23
|
+
* @see org.puremvc.as3.interfaces.IController IController
|
24
|
+
* @see org.puremvc.as3.interfaces.ICommand ICommand
|
25
|
+
* @see org.puremvc.as3.interfaces.INotification INotification
|
26
|
+
*/
|
27
|
+
public interface IFacade extends INotifier
|
28
|
+
{
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Register an <code>IProxy</code> with the <code>Model</code> by name.
|
32
|
+
*
|
33
|
+
* @param proxy the <code>IProxy</code> to be registered with the <code>Model</code>.
|
34
|
+
*/
|
35
|
+
function registerProxy( proxy:IProxy ) : void;
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Retrieve a <code>IProxy</code> from the <code>Model</code> by name.
|
39
|
+
*
|
40
|
+
* @param proxyName the name of the <code>IProxy</code> instance to be retrieved.
|
41
|
+
* @return the <code>IProxy</code> previously regisetered by <code>proxyName</code> with the <code>Model</code>.
|
42
|
+
*/
|
43
|
+
function retrieveProxy( proxyName:String ) : IProxy;
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Remove an <code>IProxy</code> instance from the <code>Model</code> by name.
|
47
|
+
*
|
48
|
+
* @param proxyName the <code>IProxy</code> to remove from the <code>Model</code>.
|
49
|
+
* @return the <code>IProxy</code> that was removed from the <code>Model</code>
|
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 <code>proxyName</code>.
|
58
|
+
*/
|
59
|
+
function hasProxy( proxyName:String ) : Boolean;
|
60
|
+
|
61
|
+
/**
|
62
|
+
* Register an <code>ICommand</code> with the <code>Controller</code>.
|
63
|
+
*
|
64
|
+
* @param noteName the name of the <code>INotification</code> to associate the <code>ICommand</code> with.
|
65
|
+
* @param commandClassRef a reference to the <code>Class</code> of the <code>ICommand</code>.
|
66
|
+
*/
|
67
|
+
function registerCommand( noteName : String, commandClassRef : Class ) : void;
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Remove a previously registered <code>ICommand</code> to <code>INotification</code> mapping from the Controller.
|
71
|
+
*
|
72
|
+
* @param notificationName the name of the <code>INotification</code> to remove the <code>ICommand</code> 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 <code>notificationName</code>.
|
81
|
+
*/
|
82
|
+
function hasCommand( notificationName:String ) : Boolean;
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Register an <code>IMediator</code> instance with the <code>View</code>.
|
86
|
+
*
|
87
|
+
* @param mediator a reference to the <code>IMediator</code> instance
|
88
|
+
*/
|
89
|
+
function registerMediator( mediator:IMediator ) : void;
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Retrieve an <code>IMediator</code> instance from the <code>View</code>.
|
93
|
+
*
|
94
|
+
* @param mediatorName the name of the <code>IMediator</code> instance to retrievve
|
95
|
+
* @return the <code>IMediator</code> previously registered with the given <code>mediatorName</code>.
|
96
|
+
*/
|
97
|
+
function retrieveMediator( mediatorName:String ) : IMediator;
|
98
|
+
|
99
|
+
/**
|
100
|
+
* Remove a <code>IMediator</code> instance from the <code>View</code>.
|
101
|
+
*
|
102
|
+
* @param mediatorName name of the <code>IMediator</code> instance to be removed.
|
103
|
+
* @return the <code>IMediator</code> instance previously registered with the given <code>mediatorName</code>.
|
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 <code>mediatorName</code>.
|
112
|
+
*/
|
113
|
+
function hasMediator( mediatorName:String ) : Boolean;
|
114
|
+
|
115
|
+
/**
|
116
|
+
* Notify the <code>IObservers</code> for a particular <code>INotification</code>.
|
117
|
+
*
|
118
|
+
* <P>
|
119
|
+
* All previously attached <code>IObservers</code> for this <code>INotification</code>'s
|
120
|
+
* list are notified and are passed a reference to the <code>INotification</code> in
|
121
|
+
* the order in which they were registered.</P>
|
122
|
+
* <P>
|
123
|
+
* NOTE: Use this method only if you are sending custom Notifications. Otherwise
|
124
|
+
* use the sendNotification method which does not require you to create the
|
125
|
+
* Notification instance.</P>
|
126
|
+
*
|
127
|
+
* @param notification the <code>INotification</code> to notify <code>IObservers</code> of.
|
128
|
+
*/
|
129
|
+
function notifyObservers( note:INotification ) : void;
|
130
|
+
}
|
131
|
+
}
|
@@ -0,0 +1,150 @@
|
|
1
|
+
/*
|
2
|
+
PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
|
3
|
+
Your reuse is governed by the Creative Commons Attribution 3.0 United States License
|
4
|
+
*/
|
5
|
+
package org.puremvc.as3.interfaces
|
6
|
+
{
|
7
|
+
|
8
|
+
/**
|
9
|
+
* The interface definition for a PureMVC Mediator.
|
10
|
+
*
|
11
|
+
* <P>
|
12
|
+
* In PureMVC, <code>IMediator</code> implementors assume these responsibilities:</P>
|
13
|
+
* <UL>
|
14
|
+
* <LI>Implement a common method which returns a list of all <code>INotification</code>s
|
15
|
+
* the <code>IMediator</code> has interest in.</LI>
|
16
|
+
* <LI>Implement a notification callback method.</LI>
|
17
|
+
* <LI>Implement methods that are called when the IMediator is registered or removed from the View.</LI>
|
18
|
+
* </UL>
|
19
|
+
* <P>
|
20
|
+
* Additionally, <code>IMediator</code>s typically:
|
21
|
+
* <UL>
|
22
|
+
* <LI>Act as an intermediary between one or more view components such as text boxes or
|
23
|
+
* list controls, maintaining references and coordinating their behavior.</LI>
|
24
|
+
* <LI>In Flash-based apps, this is often the place where event listeners are
|
25
|
+
* added to view components, and their handlers implemented.</LI>
|
26
|
+
* <LI>Respond to and generate <code>INotifications</code>, interacting with of
|
27
|
+
* the rest of the PureMVC app.
|
28
|
+
* </UL></P>
|
29
|
+
* <P>
|
30
|
+
* When an <code>IMediator</code> is registered with the <code>IView</code>,
|
31
|
+
* the <code>IView</code> will call the <code>IMediator</code>'s
|
32
|
+
* <code>listNotificationInterests</code> method. The <code>IMediator</code> will
|
33
|
+
* return an <code>Array</code> of <code>INotification</code> names which
|
34
|
+
* it wishes to be notified about.</P>
|
35
|
+
*
|
36
|
+
* <P>
|
37
|
+
* The <code>IView</code> will then create an <code>Observer</code> object
|
38
|
+
* encapsulating that <code>IMediator</code>'s (<code>handleNotification</code>) method
|
39
|
+
* and register it as an Observer for each <code>INotification</code> name returned by
|
40
|
+
* <code>listNotificationInterests</code>.</P>
|
41
|
+
*
|
42
|
+
* <P>
|
43
|
+
* A concrete IMediator implementor usually looks something like this:</P>
|
44
|
+
*
|
45
|
+
* <listing>
|
46
|
+
* import org.puremvc.as3.patterns.mediator.~~;
|
47
|
+
* import org.puremvc.as3.patterns.observer.~~;
|
48
|
+
* import org.puremvc.as3.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
|
+
* </listing>
|
98
|
+
*
|
99
|
+
* @see org.puremvc.as3.interfaces.INotification INotification
|
100
|
+
*/
|
101
|
+
public interface IMediator
|
102
|
+
{
|
103
|
+
|
104
|
+
/**
|
105
|
+
* Get the <code>IMediator</code> instance name
|
106
|
+
*
|
107
|
+
* @return the <code>IMediator</code> instance name
|
108
|
+
*/
|
109
|
+
function getMediatorName():String;
|
110
|
+
|
111
|
+
/**
|
112
|
+
* Get the <code>IMediator</code>'s view component.
|
113
|
+
*
|
114
|
+
* @return Object the view component
|
115
|
+
*/
|
116
|
+
function getViewComponent():Object;
|
117
|
+
|
118
|
+
/**
|
119
|
+
* Set the <code>IMediator</code>'s view component.
|
120
|
+
*
|
121
|
+
* @param Object the view component
|
122
|
+
*/
|
123
|
+
function setViewComponent( viewComponent:Object ):void;
|
124
|
+
|
125
|
+
/**
|
126
|
+
* List <code>INotification</code> interests.
|
127
|
+
*
|
128
|
+
* @return an <code>Array</code> of the <code>INotification</code> names this <code>IMediator</code> has an interest in.
|
129
|
+
*/
|
130
|
+
function listNotificationInterests( ):Array;
|
131
|
+
|
132
|
+
/**
|
133
|
+
* Handle an <code>INotification</code>.
|
134
|
+
*
|
135
|
+
* @param notification the <code>INotification</code> 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
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
/*
|
2
|
+
PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
|
3
|
+
Your reuse is governed by the Creative Commons Attribution 3.0 United States License
|
4
|
+
*/
|
5
|
+
package org.puremvc.as3.interfaces
|
6
|
+
{
|
7
|
+
/**
|
8
|
+
* The interface definition for a PureMVC Model.
|
9
|
+
*
|
10
|
+
* <P>
|
11
|
+
* In PureMVC, <code>IModel</code> implementors provide
|
12
|
+
* access to <code>IProxy</code> objects by named lookup. </P>
|
13
|
+
*
|
14
|
+
* <P>
|
15
|
+
* An <code>IModel</code> assumes these responsibilities:</P>
|
16
|
+
*
|
17
|
+
* <UL>
|
18
|
+
* <LI>Maintain a cache of <code>IProxy</code> instances</LI>
|
19
|
+
* <LI>Provide methods for registering, retrieving, and removing <code>IProxy</code> instances</LI>
|
20
|
+
* </UL>
|
21
|
+
*/
|
22
|
+
public interface IModel
|
23
|
+
{
|
24
|
+
/**
|
25
|
+
* Register an <code>IProxy</code> instance with the <code>Model</code>.
|
26
|
+
*
|
27
|
+
* @param proxyName the name to associate with this <code>IProxy</code> instance.
|
28
|
+
* @param proxy an object reference to be held by the <code>Model</code>.
|
29
|
+
*/
|
30
|
+
function registerProxy( proxy:IProxy ) : void;
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Retrieve an <code>IProxy</code> instance from the Model.
|
34
|
+
*
|
35
|
+
* @param proxyName
|
36
|
+
* @return the <code>IProxy</code> instance previously registered with the given <code>proxyName</code>.
|
37
|
+
*/
|
38
|
+
function retrieveProxy( proxyName:String ) : IProxy;
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Remove an <code>IProxy</code> instance from the Model.
|
42
|
+
*
|
43
|
+
* @param proxyName name of the <code>IProxy</code> instance to be removed.
|
44
|
+
* @return the <code>IProxy</code> that was removed from the <code>Model</code>
|
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 <code>proxyName</code>.
|
53
|
+
*/
|
54
|
+
function hasProxy( proxyName:String ) : Boolean;
|
55
|
+
|
56
|
+
}
|
57
|
+
}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
/*
|
2
|
+
PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
|
3
|
+
Your reuse is governed by the Creative Commons Attribution 3.0 United States License
|
4
|
+
*/
|
5
|
+
package org.puremvc.as3.interfaces
|
6
|
+
{
|
7
|
+
/**
|
8
|
+
* The interface definition for a PureMVC Notification.
|
9
|
+
*
|
10
|
+
* <P>
|
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.</P>
|
14
|
+
*
|
15
|
+
* <P>
|
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.</P>
|
19
|
+
*
|
20
|
+
* <P>
|
21
|
+
* Notifications are not meant to be a replacement for Events
|
22
|
+
* in Flex/Flash/AIR. Generally, <code>IMediator</code> 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 <code>Notification</code>s to
|
25
|
+
* trigger <code>ICommand</code>s or to communicate with other <code>IMediators</code>. <code>IProxy</code> and <code>ICommand</code>
|
26
|
+
* instances communicate with each other and <code>IMediator</code>s
|
27
|
+
* by broadcasting <code>INotification</code>s.</P>
|
28
|
+
*
|
29
|
+
* <P>
|
30
|
+
* A key difference between Flash <code>Event</code>s and PureMVC
|
31
|
+
* <code>Notification</code>s is that <code>Event</code>s follow the
|
32
|
+
* 'Chain of Responsibility' pattern, 'bubbling' up the display hierarchy
|
33
|
+
* until some parent component handles the <code>Event</code>, while
|
34
|
+
* PureMVC <code>Notification</code>s 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 <code>Notification</code>s.
|
38
|
+
*
|
39
|
+
* @see org.puremvc.as3.interfaces.IView IView
|
40
|
+
* @see org.puremvc.as3.interfaces.IObserver IObserver
|
41
|
+
*/
|
42
|
+
public interface INotification
|
43
|
+
{
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Get the name of the <code>INotification</code> instance.
|
47
|
+
* No setter, should be set by constructor only
|
48
|
+
*/
|
49
|
+
function getName():String;
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Set the body of the <code>INotification</code> instance
|
53
|
+
*/
|
54
|
+
function setBody( body:Object ):void;
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Get the body of the <code>INotification</code> instance
|
58
|
+
*/
|
59
|
+
function getBody():Object;
|
60
|
+
|
61
|
+
/**
|
62
|
+
* Set the type of the <code>INotification</code> instance
|
63
|
+
*/
|
64
|
+
function setType( type:String ):void;
|
65
|
+
|
66
|
+
/**
|
67
|
+
* Get the type of the <code>INotification</code> instance
|
68
|
+
*/
|
69
|
+
function getType():String;
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Get the string representation of the <code>INotification</code> instance
|
73
|
+
*/
|
74
|
+
function toString():String;
|
75
|
+
}
|
76
|
+
}
|