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,128 @@
|
|
1
|
+
/*
|
2
|
+
PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
|
3
|
+
Your reuse is governed by the Creative Commons Attribution 3.0 United States License
|
4
|
+
*/
|
5
|
+
package org.puremvc.as3.patterns.observer
|
6
|
+
{
|
7
|
+
import org.puremvc.as3.interfaces.*;
|
8
|
+
|
9
|
+
/**
|
10
|
+
* A base <code>INotification</code> implementation.
|
11
|
+
*
|
12
|
+
* <P>
|
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.</P>
|
16
|
+
*
|
17
|
+
* <P>
|
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.</P>
|
21
|
+
*
|
22
|
+
* <P>
|
23
|
+
* Notifications are not meant to be a replacement for Events
|
24
|
+
* in Flex/Flash/Apollo. Generally, <code>IMediator</code> 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 <code>Notification</code>s to
|
27
|
+
* trigger <code>ICommand</code>s or to communicate with other <code>IMediators</code>. <code>IProxy</code> and <code>ICommand</code>
|
28
|
+
* instances communicate with each other and <code>IMediator</code>s
|
29
|
+
* by broadcasting <code>INotification</code>s.</P>
|
30
|
+
*
|
31
|
+
* <P>
|
32
|
+
* A key difference between Flash <code>Event</code>s and PureMVC
|
33
|
+
* <code>Notification</code>s is that <code>Event</code>s follow the
|
34
|
+
* 'Chain of Responsibility' pattern, 'bubbling' up the display hierarchy
|
35
|
+
* until some parent component handles the <code>Event</code>, while
|
36
|
+
* PureMVC <code>Notification</code>s 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 <code>Notification</code>s.
|
40
|
+
*
|
41
|
+
* @see org.puremvc.as3.patterns.observer.Observer Observer
|
42
|
+
*
|
43
|
+
*/
|
44
|
+
public class Notification implements INotification
|
45
|
+
{
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Constructor.
|
49
|
+
*
|
50
|
+
* @param name name of the <code>Notification</code> instance. (required)
|
51
|
+
* @param body the <code>Notification</code> body. (optional)
|
52
|
+
* @param type the type of the <code>Notification</code> (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 <code>Notification</code> instance.
|
63
|
+
*
|
64
|
+
* @return the name of the <code>Notification</code> instance.
|
65
|
+
*/
|
66
|
+
public function getName():String
|
67
|
+
{
|
68
|
+
return name;
|
69
|
+
}
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Set the body of the <code>Notification</code> instance.
|
73
|
+
*/
|
74
|
+
public function setBody( body:Object ):void
|
75
|
+
{
|
76
|
+
this.body = body;
|
77
|
+
}
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Get the body of the <code>Notification</code> 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 <code>Notification</code> instance.
|
91
|
+
*/
|
92
|
+
public function setType( type:String ):void
|
93
|
+
{
|
94
|
+
this.type = type;
|
95
|
+
}
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Get the type of the <code>Notification</code> 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 <code>Notification</code> instance.
|
109
|
+
*
|
110
|
+
* @return the string representation of the <code>Notification</code> 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
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
/*
|
2
|
+
PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
|
3
|
+
Your reuse is governed by the Creative Commons Attribution 3.0 United States License
|
4
|
+
*/
|
5
|
+
package org.puremvc.as3.patterns.observer
|
6
|
+
{
|
7
|
+
import org.puremvc.as3.interfaces.*;
|
8
|
+
import org.puremvc.as3.patterns.facade.Facade;
|
9
|
+
|
10
|
+
/**
|
11
|
+
* A Base <code>INotifier</code> implementation.
|
12
|
+
*
|
13
|
+
* <P>
|
14
|
+
* <code>MacroCommand, Command, Mediator</code> and <code>Proxy</code>
|
15
|
+
* all have a need to send <code>Notifications</code>. <P>
|
16
|
+
* <P>
|
17
|
+
* The <code>INotifier</code> interface provides a common method called
|
18
|
+
* <code>sendNotification</code> that relieves implementation code of
|
19
|
+
* the necessity to actually construct <code>Notifications</code>.</P>
|
20
|
+
*
|
21
|
+
* <P>
|
22
|
+
* The <code>Notifier</code> class, which all of the above mentioned classes
|
23
|
+
* extend, provides an initialized reference to the <code>Facade</code>
|
24
|
+
* Singleton, which is required for the convienience method
|
25
|
+
* for sending <code>Notifications</code>, but also eases implementation as these
|
26
|
+
* classes have frequent <code>Facade</code> interactions and usually require
|
27
|
+
* access to the facade anyway.</P>
|
28
|
+
*
|
29
|
+
* @see org.puremvc.as3.patterns.facade.Facade Facade
|
30
|
+
* @see org.puremvc.as3.patterns.mediator.Mediator Mediator
|
31
|
+
* @see org.puremvc.as3.patterns.proxy.Proxy Proxy
|
32
|
+
* @see org.puremvc.as3.patterns.command.SimpleCommand SimpleCommand
|
33
|
+
* @see org.puremvc.as3.patterns.command.MacroCommand MacroCommand
|
34
|
+
*/
|
35
|
+
public class Notifier implements INotifier
|
36
|
+
{
|
37
|
+
/**
|
38
|
+
* Create and send an <code>INotification</code>.
|
39
|
+
*
|
40
|
+
* <P>
|
41
|
+
* Keeps us from having to construct new INotification
|
42
|
+
* instances in our implementation code.
|
43
|
+
* @param notificationName the name of the notiification to send
|
44
|
+
* @param body the body of the notification (optional)
|
45
|
+
* @param type the type of the notification (optional)
|
46
|
+
*/
|
47
|
+
public function sendNotification( notificationName:String, body:Object=null, type:String=null ):void
|
48
|
+
{
|
49
|
+
facade.sendNotification( notificationName, body, type );
|
50
|
+
}
|
51
|
+
|
52
|
+
// Local reference to the Facade Singleton
|
53
|
+
protected var facade:IFacade = Facade.getInstance();
|
54
|
+
}
|
55
|
+
}
|
@@ -0,0 +1,114 @@
|
|
1
|
+
/*
|
2
|
+
PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
|
3
|
+
Your reuse is governed by the Creative Commons Attribution 3.0 United States License
|
4
|
+
*/
|
5
|
+
package org.puremvc.as3.patterns.observer
|
6
|
+
{
|
7
|
+
import org.puremvc.as3.interfaces.*;
|
8
|
+
|
9
|
+
/**
|
10
|
+
* A base <code>IObserver</code> implementation.
|
11
|
+
*
|
12
|
+
* <P>
|
13
|
+
* An <code>Observer</code> is an object that encapsulates information
|
14
|
+
* about an interested object with a method that should
|
15
|
+
* be called when a particular <code>INotification</code> is broadcast. </P>
|
16
|
+
*
|
17
|
+
* <P>
|
18
|
+
* In PureMVC, the <code>Observer</code> class assumes these responsibilities:
|
19
|
+
* <UL>
|
20
|
+
* <LI>Encapsulate the notification (callback) method of the interested object.</LI>
|
21
|
+
* <LI>Encapsulate the notification context (this) of the interested object.</LI>
|
22
|
+
* <LI>Provide methods for setting the notification method and context.</LI>
|
23
|
+
* <LI>Provide a method for notifying the interested object.</LI>
|
24
|
+
* </UL>
|
25
|
+
*
|
26
|
+
* @see org.puremvc.as3.core.view.View View
|
27
|
+
* @see org.puremvc.as3.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
|
+
* <P>
|
38
|
+
* The notification method on the interested object should take
|
39
|
+
* one parameter of type <code>INotification</code></P>
|
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
|
+
* <P>
|
54
|
+
* The notification method should take one parameter of type <code>INotification</code>.</P>
|
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 (<code>this</code>) 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 <code>INotification</code> 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
|
+
}
|
@@ -0,0 +1,88 @@
|
|
1
|
+
/*
|
2
|
+
PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
|
3
|
+
Your reuse is governed by the Creative Commons Attribution 3.0 United States License
|
4
|
+
*/
|
5
|
+
package org.puremvc.as3.patterns.proxy
|
6
|
+
{
|
7
|
+
import org.puremvc.as3.interfaces.*;
|
8
|
+
import org.puremvc.as3.patterns.observer.*;
|
9
|
+
import org.puremvc.as3.patterns.facade.Facade;
|
10
|
+
|
11
|
+
/**
|
12
|
+
* A base <code>IProxy</code> implementation.
|
13
|
+
*
|
14
|
+
* <P>
|
15
|
+
* In PureMVC, <code>Proxy</code> classes are used to manage parts of the
|
16
|
+
* application's data model. </P>
|
17
|
+
*
|
18
|
+
* <P>
|
19
|
+
* A <code>Proxy</code> 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.</P>
|
22
|
+
*
|
23
|
+
* <P>
|
24
|
+
* <code>Proxy</code> 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
|
+
* <code>Proxy</code> and listening for a <code>Notification</code> to be sent
|
28
|
+
* when the <code>Proxy</code> has retrieved the data from the service. </P>
|
29
|
+
*
|
30
|
+
* @see org.puremvc.as3.core.model.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
|
+
|
82
|
+
// the proxy name
|
83
|
+
protected var proxyName:String;
|
84
|
+
|
85
|
+
// the data object
|
86
|
+
protected var data:Object;
|
87
|
+
}
|
88
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<!--
|
3
|
+
PureMVC - Copyright(c) 2006-2008 Futurescale, Inc., Some rights reserved.
|
4
|
+
Your reuse is governed by the Creative Commons Attribution 3.0 United States License
|
5
|
+
-->
|
6
|
+
<componentPackage>
|
7
|
+
<!-- Core Components -->
|
8
|
+
<component id="Controller" class="org.puremvc.as3.core.Controller"/>
|
9
|
+
<component id="Model" class="org.puremvc.as3.core.Model"/>
|
10
|
+
<component id="View" class="org.puremvc.as3.core.View"/>
|
11
|
+
<!-- Pattern Components -->
|
12
|
+
<component id="Notifier" class="org.puremvc.as3.patterns.observer.Notifier"/>
|
13
|
+
<component id="Facade" class="org.puremvc.as3.patterns.facade.Facade"/>
|
14
|
+
<component id="Observer" class="org.puremvc.as3.patterns.observer.Observer"/>
|
15
|
+
<component id="Notification" class="org.puremvc.as3.patterns.observer.Notification"/>
|
16
|
+
<component id="Mediator" class="org.puremvc.as3.patterns.mediator.Mediator"/>
|
17
|
+
<component id="Proxy" class="org.puremvc.as3.patterns.proxy.Proxy"/>
|
18
|
+
<component id="SimpleCommand" class="org.puremvc.as3.patterns.command.SimpleCommand"/>
|
19
|
+
<component id="MacroCommand" class="org.puremvc.as3.patterns.command.MacroCommand"/>
|
20
|
+
</componentPackage>
|
data/2.0.4/version.txt
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
|
2
|
+
--------------------------------------------------------------------------
|
3
|
+
Release Date: 08/14/08
|
4
|
+
Platform: ActionScript 3 (Flash, Flex, AIR)
|
5
|
+
Version: 2
|
6
|
+
Revision: 0
|
7
|
+
Minor: 4
|
8
|
+
Author: Cliff Hall <cliff@puremvc.org>
|
9
|
+
License: Creative Commons Attribution 3.0 United States License
|
10
|
+
--------------------------------------------------------------------------
|
11
|
+
2.0.4 Dissallowed re-registration of Mediators in View.registerMediator.
|
12
|
+
For more on this bug, see:
|
13
|
+
http://forums.puremvc.org/index.php?topic=372
|
14
|
+
Modified View.notifyObservers to notify from a copy of the
|
15
|
+
observer list rather than the actual observer list, which may
|
16
|
+
change during the notification loop. For more on this bug, see:
|
17
|
+
http://forums.puremvc.org/index.php?topic=490
|
18
|
+
|
19
|
+
2.0.3 Added notifyObservers back to IFacade, where it is required
|
20
|
+
if you are sending custom Notifications. No unit tests required.
|
21
|
+
|
22
|
+
2.0.2 Refactored View.removeMediator method, moving the logic for removing
|
23
|
+
an observer into a removeObserver method (also on IView), which is now
|
24
|
+
called by the Controller.removeCommand method as well as the
|
25
|
+
View.removeMediator method. This fixes the issue described here:
|
26
|
+
http://forums.puremvc.org/index.php?topic=308.0
|
27
|
+
Also, the Proxy.removeProxy method only attempts to remove the Proxy
|
28
|
+
if it is registered.
|
29
|
+
|
30
|
+
2.0.1 This is the public release, due to the limited release of 2.0 which
|
31
|
+
did not contain onRegister and onRemove for Proxy and IProxy. Also
|
32
|
+
Model, View and Controller classes have been moved together in the
|
33
|
+
core package. This has impact to you only if you are extending or
|
34
|
+
importing Model, View or Controller directly. Since access to
|
35
|
+
these actors is generally through the Facade, this should not be
|
36
|
+
an issue.
|
37
|
+
|
38
|
+
2.0 This release breaks backward compatibility with any previous release
|
39
|
+
because the package structure has changed to incorporate the language
|
40
|
+
for this release. Also, the Mediator naming scheme changed to match
|
41
|
+
that of the Proxy. Now the constructor to the Mediator takes a
|
42
|
+
mediatorName argument before the viewComponent argument. This means
|
43
|
+
that you no longer need to override the getMediatorName method in
|
44
|
+
your Mediators, you merely send the name to super to be set in the
|
45
|
+
constructor.The Mediator also gets a setViewComponent method so that
|
46
|
+
transient view components are supported. The Model, View and Facade
|
47
|
+
removeProxy and removeMediator methods now return a reference to the
|
48
|
+
Proxy or Mediator that was removed from the Model or the View. This
|
49
|
+
supports dynamic unregistration and reregistration of Proxies and
|
50
|
+
Mediators. And the Facade now implements INotifier, adding a
|
51
|
+
sendNotification method. This method makes use of the facade's
|
52
|
+
notifyObservers method, and so Notifier's sendNotification method now
|
53
|
+
calls facade.sendNotification. This means that you never have
|
54
|
+
to create a notification inside the facade and call notifyObservers,
|
55
|
+
you may simply call sendNotification with the parameters in the same
|
56
|
+
way that Commands, Mediators and Proxies do. It is left public in the
|
57
|
+
facade only so that you may still create and send custom notification
|
58
|
+
classes. Model and Facade get hasProxy method; View and Facade get a
|
59
|
+
hasMediator method to. Mediator and Proxy get onRegister and onRemove
|
60
|
+
methods. Notification.toString method was fixed.
|
61
|
+
|
62
|
+
1.7.1 A unneeded break statement was in the view's removeMediator method after the
|
63
|
+
refactor for 1.7. This bug was not flushed out because of a flaw in the test
|
64
|
+
which has been corrected. Here is the associated forum post:
|
65
|
+
http://forums.puremvc.org/index.php?topic=181.msg579#msg579
|
66
|
+
|
67
|
+
1.7 The Controller's registerCommand method was modified to only create the corresponding
|
68
|
+
Observer for the ICommand being registered if no previous ICommand was registered
|
69
|
+
to the Notification name in question. The behavior of the method is the same in that
|
70
|
+
if an ICommand was previously registered for the Notification, it is no longer used
|
71
|
+
and the newly registered ICommand is. However, the previous implementation created
|
72
|
+
and registered an extra Observer, which could lead to the new ICommand being executed
|
73
|
+
twice. Added removeCommand method to the Facade, which is passed through to the
|
74
|
+
Controller. Being such a little-used method its omission was intentional, but it is
|
75
|
+
included now as a matter of form. Added to the removeCommand to the IFacade interface
|
76
|
+
as well. An issue with the View's removeMediator method was fixed. The previous
|
77
|
+
implementation iterated through the observer list, removing associated Observers,
|
78
|
+
however this caused the length of the Observer list to change, leading to the
|
79
|
+
possibility that some Observers would not be removed when they should have been. The
|
80
|
+
issue is discussed here: http://forums.puremvc.org/index.php?topic=145.msg478#msg478
|
81
|
+
|
82
|
+
1.6 The 1.5 removeMediator implementation created a new situation where after an
|
83
|
+
observerMap array was nulled due to its length falling to zero. subsequent calls
|
84
|
+
to removeMediator could throw an exception. This was because the method of removing
|
85
|
+
the only reference to the array was setting the observerMap value to null for the
|
86
|
+
observerMap key in question. This method was used since Adobe's 'Programming
|
87
|
+
ActionScript 3.0 > Core ActionScript 3.0 Data Types and Classes > Working with
|
88
|
+
Arrays' says: "You may come across code that uses the delete operator on an array
|
89
|
+
element. The delete operator sets the value of an array element to undefined, but
|
90
|
+
it does not remove the element from the array". However, this proves to no longer
|
91
|
+
be the case. So now, the delete operator is used to remove both observerMap and
|
92
|
+
mediatorMap entries.
|
93
|
+
|
94
|
+
1.5 Amended removeMediator method to remove associated Observer references from
|
95
|
+
the observerMap. When a notificationName's observer list length falls to zero
|
96
|
+
the reference to the observer list is also removed. Added compareNotifyContext
|
97
|
+
method to the Observer class and IObserver interface, which compares a given
|
98
|
+
object to the Observer's notification context and returns a Boolean indicating
|
99
|
+
their equality. This allows the View to compare the Mediator being removed with
|
100
|
+
the Observer's notification context without breaking the Observer's encapsulation.
|
101
|
+
|
102
|
+
1.4 Added INotifier interface and Notifier class. MacroCommand, Command, Mediator
|
103
|
+
and Proxy all extend Notifier and implement INotifier. The sendNotification
|
104
|
+
method in Proxy and Mediator was moved to Notifier and is now available to
|
105
|
+
Commands. Also the protected facade property was moved from Proxy and Mediator
|
106
|
+
into Notifier, so Commands now get the facade reference at construction time.
|
107
|
+
|
108
|
+
1.3 Obviated the need for AbstractProxy and AbstractMediator in applications:
|
109
|
+
* Implemented sendNotification convenience method in Proxy and Mediator
|
110
|
+
* Added protected facade:Ifacade property initialized to Facade.getInstance()
|
111
|
+
on both Mediator and Proxy. The concrete Facade must be instantiated
|
112
|
+
first, but this call will return the concrete instance, even though the
|
113
|
+
framework Facade.getInstance is called.
|
114
|
+
|
115
|
+
1.2 - Removed old files that were inadvertently included.
|
116
|
+
|
117
|
+
1.1 - Repackaged zip and updated inline docs
|