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,55 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
2
|
+
<html>
|
3
|
+
|
4
|
+
<head>
|
5
|
+
<META http-equiv="Content-Type" content="text/html; charset=ISO-Latin-1">
|
6
|
+
|
7
|
+
<title>Adobe Flex 2 Language Reference</title>
|
8
|
+
|
9
|
+
<link rel="stylesheet" href="style.css" type="text/css" media="screen">
|
10
|
+
|
11
|
+
<link rel="stylesheet" href="print.css" type="text/css" media="print">
|
12
|
+
|
13
|
+
<script language="javascript" type="text/javascript" src="asdoc.js">
|
14
|
+
</script>
|
15
|
+
|
16
|
+
</head>
|
17
|
+
|
18
|
+
<body>
|
19
|
+
|
20
|
+
<table class="titleTable" cellpadding="0" cellspacing="0">
|
21
|
+
|
22
|
+
<tr>
|
23
|
+
|
24
|
+
<td class="titleTableTitle" align="left">PureMVC AS3 Framework - [Standard Version]</td>
|
25
|
+
<td class="titleTableTopNav" align="right">
|
26
|
+
<a target="classFrame" href="package-summary.html" onclick="loadClassListFrame('all-classes.html')">All Packages</a> | <a target="classFrame" href="class-summary.html" onclick="loadClassListFrame('all-classes.html')">All Classes</a> | <a target="classFrame" href="all-index-A.html" onclick="loadClassListFrame('index-list.html')">Index</a> | <a href="" onclick="parent.location=parent.classFrame.location">No Frames</a>
|
27
|
+
</td>
|
28
|
+
<!-- <td class="titleTableLogo" align="right" rowspan="3"><img src="images/logo.jpg" class="logoImage" title="Adobe Logo" alt="Adobe Logo" /></td> -->
|
29
|
+
<td align="right" rowspan="3">
|
30
|
+
<p></p>
|
31
|
+
</td>
|
32
|
+
|
33
|
+
</tr>
|
34
|
+
|
35
|
+
<tr class="titleTableRow2">
|
36
|
+
|
37
|
+
<td class="titleTableSubTitle" id="subTitle" align="left"> </td>
|
38
|
+
<td class="titleTableSubNav" id="subNav" align="right">
|
39
|
+
<a id="propertiesLink" href="#" onclick="javascript:titleBar_gotoClassFrameAnchor('propertySummary');" style="display:none">Properties</a><span id="propertiesBar" style="display:none"> | </span><a id="packagePropertiesLink" href="#" onclick="javascript:titleBar_gotoClassFrameAnchor('propertySummary');" style="display:none">Properties</a><span id="packagePropertiesBar" style="display:none"> | </span><a id="constructorLink" href="#" onclick="javascript:titleBar_gotoClassFrameAnchor('constructorSummary');" style="display:none">Constructor</a><span id="constructorBar" style="display:none"> | </span><a id="methodsLink" href="#" onclick="javascript:titleBar_gotoClassFrameAnchor('methodSummary');" style="display:none">Methods</a> <span id="methodsBar" style="display:none"> | </span><a id="packageFunctionsLink" href="#" onclick="javascript:titleBar_gotoClassFrameAnchor('methodSummary');" style="display:none">Functions</a><span id="packageFunctionsBar" style="display:none"> | </span><a id="eventsLink" href="#" onclick="javascript:titleBar_gotoClassFrameAnchor('eventSummary');" style="display:none">Events</a><span id="eventsBar" style="display:none"> | </span><a id="stylesLink" href="#" onclick="javascript:titleBar_gotoClassFrameAnchor('styleSummary');" style="display:none">Styles</a><span id="stylesBar" style="display:none"> | </span><a id="effectsLink" href="#" onclick="javascript:titleBar_gotoClassFrameAnchor('effectSummary');" style="display:none">Effects</a><span id="effectsBar" style="display:none"> | </span><a id="constantsLink" href="#" onclick="javascript:titleBar_gotoClassFrameAnchor('constantSummary');" style="display:none">Constants</a><span id="constantsBar" style="display:none"> | </span><a id="packageConstantsLink" href="#" onclick="javascript:titleBar_gotoClassFrameAnchor('constantSummary');" style="display:none">Constants</a><span id="packageConstantsBar" style="display:none"> | </span><a id="interfacesLink" href="#" onclick="javascript:titleBar_gotoClassFrameAnchor('interfaceSummary');" style="display:none">Interfaces</a><span id="interfacesBar" style="display:none"> | </span><a id="classesLink" href="#" onclick="javascript:titleBar_gotoClassFrameAnchor('classSummary');" style="display:none">Classes</a> <span id="classesBar" style="display:none"> | </span><a id="packageUseLink" href="#" onclick="javascript:titleBar_gotoClassFrameAnchor('package-use.html');" style="display:none">Use</a><span id="packageUseBar" style="display:none"> | </span><a id="examplesLink" href="#" onclick="javascript:titleBar_gotoClassFrameAnchor('includeExamplesSummary');" style="display:none">Examples</a>
|
40
|
+
</td>
|
41
|
+
|
42
|
+
</tr>
|
43
|
+
|
44
|
+
<tr class="titleTableRow3">
|
45
|
+
|
46
|
+
<td colspan="2"> </td>
|
47
|
+
|
48
|
+
</tr>
|
49
|
+
|
50
|
+
</table>
|
51
|
+
|
52
|
+
</body>
|
53
|
+
<!-- -->
|
54
|
+
|
55
|
+
</html>
|
Binary file
|
data/2.0.4/license.txt
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
PureMVC - Copyright(c) 2006-08 Futurescale, Inc., Some rights reserved.
|
2
|
+
--------------------------------------------------------------------------
|
3
|
+
Reuse governed by Creative Commons Attribution 3.0 United States License
|
4
|
+
View this license and the associated Creative Commons deed online at:
|
5
|
+
http://creativecommons.org/licenses/by/3.0/us/
|
6
|
+
You must leave all copyright and license
|
7
|
+
statements intact in your final product.
|
8
|
+
--------------------------------------------------------------------------
|
9
|
+
License
|
10
|
+
|
11
|
+
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
|
12
|
+
|
13
|
+
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
|
14
|
+
|
15
|
+
1. Definitions
|
16
|
+
|
17
|
+
1. "Collective Work" means a work, such as a periodical issue, anthology or encyclopedia, in which the Work in its entirety in unmodified form, along with one or more other contributions, constituting separate and independent works in themselves, are assembled into a collective whole. A work that constitutes a Collective Work will not be considered a Derivative Work (as defined below) for the purposes of this License.
|
18
|
+
2. "Derivative Work" means a work based upon the Work or upon the Work and other pre-existing works, such as a translation, musical arrangement, dramatization, fictionalization, motion picture version, sound recording, art reproduction, abridgment, condensation, or any other form in which the Work may be recast, transformed, or adapted, except that a work that constitutes a Collective Work will not be considered a Derivative Work for the purpose of this License. For the avoidance of doubt, where the Work is a musical composition or sound recording, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered a Derivative Work for the purpose of this License.
|
19
|
+
3. "Licensor" means the individual, individuals, entity or entities that offers the Work under the terms of this License.
|
20
|
+
4. "Original Author" means the individual, individuals, entity or entities who created the Work.
|
21
|
+
5. "Work" means the copyrightable work of authorship offered under the terms of this License.
|
22
|
+
6. "You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
|
23
|
+
|
24
|
+
2. Fair Use Rights. Nothing in this license is intended to reduce, limit, or restrict any rights arising from fair use, first sale or other limitations on the exclusive rights of the copyright owner under copyright law or other applicable laws.
|
25
|
+
|
26
|
+
3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:
|
27
|
+
|
28
|
+
1. to reproduce the Work, to incorporate the Work into one or more Collective Works, and to reproduce the Work as incorporated in the Collective Works;
|
29
|
+
2. to create and reproduce Derivative Works provided that any such Derivative Work, including any translation in any medium, takes reasonable steps to clearly label, demarcate or otherwise identify that changes were made to the original Work. For example, a translation could be marked "The original work was translated from English to Spanish," or a modification could indicate "The original work has been modified.";;
|
30
|
+
3. to distribute copies or phonorecords of, display publicly, perform publicly, and perform publicly by means of a digital audio transmission the Work including as incorporated in Collective Works;
|
31
|
+
4. to distribute copies or phonorecords of, display publicly, perform publicly, and perform publicly by means of a digital audio transmission Derivative Works.
|
32
|
+
5. For the avoidance of doubt, where the Work is a musical composition:
|
33
|
+
1. Performance Royalties Under Blanket Licenses. Licensor waives the exclusive right to collect, whether individually or, in the event that Licensor is a member of a performance rights society (e.g. ASCAP, BMI, SESAC), via that society, royalties for the public performance or public digital performance (e.g. webcast) of the Work.
|
34
|
+
2. Mechanical Rights and Statutory Royalties. Licensor waives the exclusive right to collect, whether individually or via a music rights agency or designated agent (e.g. Harry Fox Agency), royalties for any phonorecord You create from the Work ("cover version") and distribute, subject to the compulsory license created by 17 USC Section 115 of the US Copyright Act (or the equivalent in other jurisdictions).
|
35
|
+
6. Webcasting Rights and Statutory Royalties. For the avoidance of doubt, where the Work is a sound recording, Licensor waives the exclusive right to collect, whether individually or via a performance-rights society (e.g. SoundExchange), royalties for the public digital performance (e.g. webcast) of the Work, subject to the compulsory license created by 17 USC Section 114 of the US Copyright Act (or the equivalent in other jurisdictions).
|
36
|
+
|
37
|
+
The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. All rights not expressly granted by Licensor are hereby reserved.
|
38
|
+
|
39
|
+
4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:
|
40
|
+
|
41
|
+
1. You may distribute, publicly display, publicly perform, or publicly digitally perform the Work only under the terms of this License, and You must include a copy of, or the Uniform Resource Identifier for, this License with every copy or phonorecord of the Work You distribute, publicly display, publicly perform, or publicly digitally perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of a recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties. When You distribute, publicly display, publicly perform, or publicly digitally perform the Work, You may not impose any technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collective Work, but this does not require the Collective Work apart from the Work itself to be made subject to the terms of this License. If You create a Collective Work, upon notice from any Licensor You must, to the extent practicable, remove from the Collective Work any credit as required by Section 4(b), as requested. If You create a Derivative Work, upon notice from any Licensor You must, to the extent practicable, remove from the Derivative Work any credit as required by Section 4(b), as requested.
|
42
|
+
2. If You distribute, publicly display, publicly perform, or publicly digitally perform the Work (as defined in Section 1 above) or any Derivative Works (as defined in Section 1 above) or Collective Works (as defined in Section 1 above), You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or (ii) if the Original Author and/or Licensor designate another party or parties (e.g. a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; the title of the Work if supplied; to the extent reasonably practicable, the Uniform Resource Identifier, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and, consistent with Section 3(b) in the case of a Derivative Work, a credit identifying the use of the Work in the Derivative Work (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). The credit required by this Section 4(b) may be implemented in any reasonable manner; provided, however, that in the case of a Derivative Work or Collective Work, at a minimum such credit will appear, if a credit for all contributing authors of the Derivative Work or Collective Work appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties.
|
43
|
+
|
44
|
+
5. Representations, Warranties and Disclaimer
|
45
|
+
|
46
|
+
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND ONLY TO THE EXTENT OF ANY RIGHTS HELD IN THE LICENSED WORK BY THE LICENSOR. THE LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MARKETABILITY, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
|
47
|
+
|
48
|
+
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
49
|
+
|
50
|
+
7. Termination
|
51
|
+
|
52
|
+
1. This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Derivative Works (as defined in Section 1 above) or Collective Works (as defined in Section 1 above) from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
|
53
|
+
2. Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.
|
54
|
+
|
55
|
+
8. Miscellaneous
|
56
|
+
|
57
|
+
1. Each time You distribute or publicly digitally perform the Work (as defined in Section 1 above) or a Collective Work (as defined in Section 1 above), the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
|
58
|
+
2. Each time You distribute or publicly digitally perform a Derivative Work, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License.
|
59
|
+
3. If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
|
60
|
+
4. No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent.
|
61
|
+
5. This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.
|
@@ -0,0 +1,183 @@
|
|
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.core
|
6
|
+
{
|
7
|
+
import org.puremvc.as3.core.*;
|
8
|
+
import org.puremvc.as3.interfaces.*;
|
9
|
+
import org.puremvc.as3.patterns.observer.*;
|
10
|
+
|
11
|
+
/**
|
12
|
+
* A Singleton <code>IController</code> implementation.
|
13
|
+
*
|
14
|
+
* <P>
|
15
|
+
* In PureMVC, the <code>Controller</code> class follows the
|
16
|
+
* 'Command and Controller' strategy, and assumes these
|
17
|
+
* responsibilities:
|
18
|
+
* <UL>
|
19
|
+
* <LI> Remembering which <code>ICommand</code>s
|
20
|
+
* are intended to handle which <code>INotifications</code>.</LI>
|
21
|
+
* <LI> Registering itself as an <code>IObserver</code> with
|
22
|
+
* the <code>View</code> for each <code>INotification</code>
|
23
|
+
* that it has an <code>ICommand</code> mapping for.</LI>
|
24
|
+
* <LI> Creating a new instance of the proper <code>ICommand</code>
|
25
|
+
* to handle a given <code>INotification</code> when notified by the <code>View</code>.</LI>
|
26
|
+
* <LI> Calling the <code>ICommand</code>'s <code>execute</code>
|
27
|
+
* method, passing in the <code>INotification</code>.</LI>
|
28
|
+
* </UL>
|
29
|
+
*
|
30
|
+
* <P>
|
31
|
+
* Your application must register <code>ICommands</code> with the
|
32
|
+
* Controller.
|
33
|
+
* <P>
|
34
|
+
* The simplest way is to subclass </code>Facade</code>,
|
35
|
+
* and use its <code>initializeController</code> method to add your
|
36
|
+
* registrations.
|
37
|
+
*
|
38
|
+
* @see org.puremvc.as3.core.view.View View
|
39
|
+
* @see org.puremvc.as3.patterns.observer.Observer Observer
|
40
|
+
* @see org.puremvc.as3.patterns.observer.Notification Notification
|
41
|
+
* @see org.puremvc.as3.patterns.command.SimpleCommand SimpleCommand
|
42
|
+
* @see org.puremvc.as3.patterns.command.MacroCommand MacroCommand
|
43
|
+
*/
|
44
|
+
public class Controller implements IController
|
45
|
+
{
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Constructor.
|
49
|
+
*
|
50
|
+
* <P>
|
51
|
+
* This <code>IController</code> implementation is a Singleton,
|
52
|
+
* so you should not call the constructor
|
53
|
+
* directly, but instead call the static Singleton
|
54
|
+
* Factory method <code>Controller.getInstance()</code>
|
55
|
+
*
|
56
|
+
* @throws Error Error if Singleton instance has already been constructed
|
57
|
+
*
|
58
|
+
*/
|
59
|
+
public function Controller( )
|
60
|
+
{
|
61
|
+
if (instance != null) throw Error(SINGLETON_MSG);
|
62
|
+
instance = this;
|
63
|
+
commandMap = new Array();
|
64
|
+
initializeController();
|
65
|
+
}
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Initialize the Singleton <code>Controller</code> instance.
|
69
|
+
*
|
70
|
+
* <P>Called automatically by the constructor.</P>
|
71
|
+
*
|
72
|
+
* <P>Note that if you are using a subclass of <code>View</code>
|
73
|
+
* in your application, you should <i>also</i> subclass <code>Controller</code>
|
74
|
+
* and override the <code>initializeController</code> method in the
|
75
|
+
* following way:</P>
|
76
|
+
*
|
77
|
+
* <listing>
|
78
|
+
* // ensure that the Controller is talking to my IView implementation
|
79
|
+
* override public function initializeController( ) : void
|
80
|
+
* {
|
81
|
+
* view = MyView.getInstance();
|
82
|
+
* }
|
83
|
+
* </listing>
|
84
|
+
*
|
85
|
+
* @return void
|
86
|
+
*/
|
87
|
+
protected function initializeController( ) : void
|
88
|
+
{
|
89
|
+
view = View.getInstance();
|
90
|
+
}
|
91
|
+
|
92
|
+
/**
|
93
|
+
* <code>Controller</code> Singleton Factory method.
|
94
|
+
*
|
95
|
+
* @return the Singleton instance of <code>Controller</code>
|
96
|
+
*/
|
97
|
+
public static function getInstance() : IController
|
98
|
+
{
|
99
|
+
if ( instance == null ) instance = new Controller( );
|
100
|
+
return instance;
|
101
|
+
}
|
102
|
+
|
103
|
+
/**
|
104
|
+
* If an <code>ICommand</code> has previously been registered
|
105
|
+
* to handle a the given <code>INotification</code>, then it is executed.
|
106
|
+
*
|
107
|
+
* @param note an <code>INotification</code>
|
108
|
+
*/
|
109
|
+
public function executeCommand( note : INotification ) : void
|
110
|
+
{
|
111
|
+
var commandClassRef : Class = commandMap[ note.getName() ];
|
112
|
+
if ( commandClassRef == null ) return;
|
113
|
+
|
114
|
+
var commandInstance : ICommand = new commandClassRef();
|
115
|
+
commandInstance.execute( note );
|
116
|
+
}
|
117
|
+
|
118
|
+
/**
|
119
|
+
* Register a particular <code>ICommand</code> class as the handler
|
120
|
+
* for a particular <code>INotification</code>.
|
121
|
+
*
|
122
|
+
* <P>
|
123
|
+
* If an <code>ICommand</code> has already been registered to
|
124
|
+
* handle <code>INotification</code>s with this name, it is no longer
|
125
|
+
* used, the new <code>ICommand</code> is used instead.</P>
|
126
|
+
*
|
127
|
+
* The Observer for the new ICommand is only created if this the
|
128
|
+
* first time an ICommand has been regisered for this Notification name.
|
129
|
+
*
|
130
|
+
* @param notificationName the name of the <code>INotification</code>
|
131
|
+
* @param commandClassRef the <code>Class</code> of the <code>ICommand</code>
|
132
|
+
*/
|
133
|
+
public function registerCommand( notificationName : String, commandClassRef : Class ) : void
|
134
|
+
{
|
135
|
+
if ( commandMap[ notificationName ] == null ) {
|
136
|
+
view.registerObserver( notificationName, new Observer( executeCommand, this ) );
|
137
|
+
}
|
138
|
+
commandMap[ notificationName ] = commandClassRef;
|
139
|
+
}
|
140
|
+
|
141
|
+
/**
|
142
|
+
* Check if a Command is registered for a given Notification
|
143
|
+
*
|
144
|
+
* @param notificationName
|
145
|
+
* @return whether a Command is currently registered for the given <code>notificationName</code>.
|
146
|
+
*/
|
147
|
+
public function hasCommand( notificationName:String ) : Boolean
|
148
|
+
{
|
149
|
+
return commandMap[ notificationName ] != null;
|
150
|
+
}
|
151
|
+
|
152
|
+
/**
|
153
|
+
* Remove a previously registered <code>ICommand</code> to <code>INotification</code> mapping.
|
154
|
+
*
|
155
|
+
* @param notificationName the name of the <code>INotification</code> to remove the <code>ICommand</code> mapping for
|
156
|
+
*/
|
157
|
+
public function removeCommand( notificationName : String ) : void
|
158
|
+
{
|
159
|
+
// if the Command is registered...
|
160
|
+
if ( hasCommand( notificationName ) )
|
161
|
+
{
|
162
|
+
// remove the observer
|
163
|
+
view.removeObserver( notificationName, this );
|
164
|
+
|
165
|
+
// remove the command
|
166
|
+
commandMap[ notificationName ] = null;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
// Local reference to View
|
171
|
+
protected var view : IView;
|
172
|
+
|
173
|
+
// Mapping of Notification names to Command Class references
|
174
|
+
protected var commandMap : Array;
|
175
|
+
|
176
|
+
// Singleton instance
|
177
|
+
protected static var instance : IController;
|
178
|
+
|
179
|
+
// Message Constants
|
180
|
+
protected const SINGLETON_MSG : String = "Controller Singleton already constructed!";
|
181
|
+
|
182
|
+
}
|
183
|
+
}
|
@@ -0,0 +1,144 @@
|
|
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.core
|
6
|
+
{
|
7
|
+
|
8
|
+
import org.puremvc.as3.interfaces.*;
|
9
|
+
|
10
|
+
/**
|
11
|
+
* A Singleton <code>IModel</code> implementation.
|
12
|
+
*
|
13
|
+
* <P>
|
14
|
+
* In PureMVC, the <code>Model</code> class provides
|
15
|
+
* access to model objects (Proxies) by named lookup.
|
16
|
+
*
|
17
|
+
* <P>
|
18
|
+
* The <code>Model</code> assumes these responsibilities:</P>
|
19
|
+
*
|
20
|
+
* <UL>
|
21
|
+
* <LI>Maintain a cache of <code>IProxy</code> instances.</LI>
|
22
|
+
* <LI>Provide methods for registering, retrieving, and removing
|
23
|
+
* <code>IProxy</code> instances.</LI>
|
24
|
+
* </UL>
|
25
|
+
*
|
26
|
+
* <P>
|
27
|
+
* Your application must register <code>IProxy</code> instances
|
28
|
+
* with the <code>Model</code>. Typically, you use an
|
29
|
+
* <code>ICommand</code> to create and register <code>IProxy</code>
|
30
|
+
* instances once the <code>Facade</code> has initialized the Core
|
31
|
+
* actors.</p>
|
32
|
+
*
|
33
|
+
* @see org.puremvc.as3.patterns.proxy.Proxy Proxy
|
34
|
+
* @see org.puremvc.as3.interfaces.IProxy IProxy
|
35
|
+
*/
|
36
|
+
public class Model implements IModel
|
37
|
+
{
|
38
|
+
/**
|
39
|
+
* Constructor.
|
40
|
+
*
|
41
|
+
* <P>
|
42
|
+
* This <code>IModel</code> implementation is a Singleton,
|
43
|
+
* so you should not call the constructor
|
44
|
+
* directly, but instead call the static Singleton
|
45
|
+
* Factory method <code>Model.getInstance()</code>
|
46
|
+
*
|
47
|
+
* @throws Error Error if Singleton instance has already been constructed
|
48
|
+
*
|
49
|
+
*/
|
50
|
+
public function Model( )
|
51
|
+
{
|
52
|
+
if (instance != null) throw Error(SINGLETON_MSG);
|
53
|
+
instance = this;
|
54
|
+
proxyMap = new Array();
|
55
|
+
initializeModel();
|
56
|
+
}
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Initialize the Singleton <code>Model</code> instance.
|
60
|
+
*
|
61
|
+
* <P>
|
62
|
+
* Called automatically by the constructor, this
|
63
|
+
* is your opportunity to initialize the Singleton
|
64
|
+
* instance in your subclass without overriding the
|
65
|
+
* constructor.</P>
|
66
|
+
*
|
67
|
+
* @return void
|
68
|
+
*/
|
69
|
+
protected function initializeModel( ) : void
|
70
|
+
{
|
71
|
+
}
|
72
|
+
|
73
|
+
/**
|
74
|
+
* <code>Model</code> Singleton Factory method.
|
75
|
+
*
|
76
|
+
* @return the Singleton instance
|
77
|
+
*/
|
78
|
+
public static function getInstance() : IModel
|
79
|
+
{
|
80
|
+
if (instance == null) instance = new Model( );
|
81
|
+
return instance;
|
82
|
+
}
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Register an <code>IProxy</code> with the <code>Model</code>.
|
86
|
+
*
|
87
|
+
* @param proxy an <code>IProxy</code> to be held by the <code>Model</code>.
|
88
|
+
*/
|
89
|
+
public function registerProxy( proxy:IProxy ) : void
|
90
|
+
{
|
91
|
+
proxyMap[ proxy.getProxyName() ] = proxy;
|
92
|
+
proxy.onRegister();
|
93
|
+
}
|
94
|
+
|
95
|
+
/**
|
96
|
+
* Retrieve an <code>IProxy</code> from the <code>Model</code>.
|
97
|
+
*
|
98
|
+
* @param proxyName
|
99
|
+
* @return the <code>IProxy</code> instance previously registered with the given <code>proxyName</code>.
|
100
|
+
*/
|
101
|
+
public function retrieveProxy( proxyName:String ) : IProxy
|
102
|
+
{
|
103
|
+
return proxyMap[ proxyName ];
|
104
|
+
}
|
105
|
+
|
106
|
+
/**
|
107
|
+
* Check if a Proxy is registered
|
108
|
+
*
|
109
|
+
* @param proxyName
|
110
|
+
* @return whether a Proxy is currently registered with the given <code>proxyName</code>.
|
111
|
+
*/
|
112
|
+
public function hasProxy( proxyName:String ) : Boolean
|
113
|
+
{
|
114
|
+
return proxyMap[ proxyName ] != null;
|
115
|
+
}
|
116
|
+
|
117
|
+
/**
|
118
|
+
* Remove an <code>IProxy</code> from the <code>Model</code>.
|
119
|
+
*
|
120
|
+
* @param proxyName name of the <code>IProxy</code> instance to be removed.
|
121
|
+
* @return the <code>IProxy</code> that was removed from the <code>Model</code>
|
122
|
+
*/
|
123
|
+
public function removeProxy( proxyName:String ) : IProxy
|
124
|
+
{
|
125
|
+
var proxy:IProxy = proxyMap [ proxyName ] as IProxy;
|
126
|
+
if ( proxy )
|
127
|
+
{
|
128
|
+
proxyMap[ proxyName ] = null;
|
129
|
+
proxy.onRemove();
|
130
|
+
}
|
131
|
+
return proxy;
|
132
|
+
}
|
133
|
+
|
134
|
+
// Mapping of proxyNames to IProxy instances
|
135
|
+
protected var proxyMap : Array;
|
136
|
+
|
137
|
+
// Singleton instance
|
138
|
+
protected static var instance : IModel;
|
139
|
+
|
140
|
+
// Message Constants
|
141
|
+
protected const SINGLETON_MSG : String = "Model Singleton already constructed!";
|
142
|
+
|
143
|
+
}
|
144
|
+
}
|
@@ -0,0 +1,271 @@
|
|
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.core
|
6
|
+
{
|
7
|
+
|
8
|
+
import org.puremvc.as3.interfaces.*;
|
9
|
+
import org.puremvc.as3.patterns.observer.Observer;
|
10
|
+
|
11
|
+
/**
|
12
|
+
* A Singleton <code>IView</code> implementation.
|
13
|
+
*
|
14
|
+
* <P>
|
15
|
+
* In PureMVC, the <code>View</code> class assumes these responsibilities:
|
16
|
+
* <UL>
|
17
|
+
* <LI>Maintain a cache of <code>IMediator</code> instances.</LI>
|
18
|
+
* <LI>Provide methods for registering, retrieving, and removing <code>IMediators</code>.</LI>
|
19
|
+
* <LI>Notifiying <code>IMediators</code> when they are registered or removed.</LI>
|
20
|
+
* <LI>Managing the observer lists for each <code>INotification</code> in the application.</LI>
|
21
|
+
* <LI>Providing a method for attaching <code>IObservers</code> to an <code>INotification</code>'s observer list.</LI>
|
22
|
+
* <LI>Providing a method for broadcasting an <code>INotification</code>.</LI>
|
23
|
+
* <LI>Notifying the <code>IObservers</code> of a given <code>INotification</code> when it broadcast.</LI>
|
24
|
+
* </UL>
|
25
|
+
*
|
26
|
+
* @see org.puremvc.as3.patterns.mediator.Mediator Mediator
|
27
|
+
* @see org.puremvc.as3.patterns.observer.Observer Observer
|
28
|
+
* @see org.puremvc.as3.patterns.observer.Notification Notification
|
29
|
+
*/
|
30
|
+
public class View implements IView
|
31
|
+
{
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Constructor.
|
35
|
+
*
|
36
|
+
* <P>
|
37
|
+
* This <code>IView</code> implementation is a Singleton,
|
38
|
+
* so you should not call the constructor
|
39
|
+
* directly, but instead call the static Singleton
|
40
|
+
* Factory method <code>View.getInstance()</code>
|
41
|
+
*
|
42
|
+
* @throws Error Error if Singleton instance has already been constructed
|
43
|
+
*
|
44
|
+
*/
|
45
|
+
public function View( )
|
46
|
+
{
|
47
|
+
if (instance != null) throw Error(SINGLETON_MSG);
|
48
|
+
instance = this;
|
49
|
+
mediatorMap = new Array();
|
50
|
+
observerMap = new Array();
|
51
|
+
initializeView();
|
52
|
+
}
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Initialize the Singleton View instance.
|
56
|
+
*
|
57
|
+
* <P>
|
58
|
+
* Called automatically by the constructor, this
|
59
|
+
* is your opportunity to initialize the Singleton
|
60
|
+
* instance in your subclass without overriding the
|
61
|
+
* constructor.</P>
|
62
|
+
*
|
63
|
+
* @return void
|
64
|
+
*/
|
65
|
+
protected function initializeView( ) : void
|
66
|
+
{
|
67
|
+
}
|
68
|
+
|
69
|
+
/**
|
70
|
+
* View Singleton Factory method.
|
71
|
+
*
|
72
|
+
* @return the Singleton instance of <code>View</code>
|
73
|
+
*/
|
74
|
+
public static function getInstance() : IView
|
75
|
+
{
|
76
|
+
if ( instance == null ) instance = new View( );
|
77
|
+
return instance;
|
78
|
+
}
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Register an <code>IObserver</code> to be notified
|
82
|
+
* of <code>INotifications</code> with a given name.
|
83
|
+
*
|
84
|
+
* @param notificationName the name of the <code>INotifications</code> to notify this <code>IObserver</code> of
|
85
|
+
* @param observer the <code>IObserver</code> to register
|
86
|
+
*/
|
87
|
+
public function registerObserver ( notificationName:String, observer:IObserver ) : void
|
88
|
+
{
|
89
|
+
var observers:Array = observerMap[ notificationName ];
|
90
|
+
if( observers ) {
|
91
|
+
observers.push( observer );
|
92
|
+
} else {
|
93
|
+
observerMap[ notificationName ] = [ observer ];
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Notify the <code>IObservers</code> for a particular <code>INotification</code>.
|
99
|
+
*
|
100
|
+
* <P>
|
101
|
+
* All previously attached <code>IObservers</code> for this <code>INotification</code>'s
|
102
|
+
* list are notified and are passed a reference to the <code>INotification</code> in
|
103
|
+
* the order in which they were registered.</P>
|
104
|
+
*
|
105
|
+
* @param notification the <code>INotification</code> to notify <code>IObservers</code> of.
|
106
|
+
*/
|
107
|
+
public function notifyObservers( notification:INotification ) : void
|
108
|
+
{
|
109
|
+
if( observerMap[ notification.getName() ] != null ) {
|
110
|
+
|
111
|
+
// Get a reference to the observers list for this notification name
|
112
|
+
var observers_ref:Array = observerMap[ notification.getName() ] as Array;
|
113
|
+
|
114
|
+
// Copy observers from reference array to working array,
|
115
|
+
// since the reference array may change during the notification loop
|
116
|
+
var observers:Array = new Array();
|
117
|
+
var observer:IObserver;
|
118
|
+
for (var i:Number = 0; i < observers_ref.length; i++) {
|
119
|
+
observer = observers_ref[ i ] as IObserver;
|
120
|
+
observers.push( observer );
|
121
|
+
}
|
122
|
+
|
123
|
+
// Notify Observers from the working array
|
124
|
+
for (i = 0; i < observers.length; i++) {
|
125
|
+
observer = observers[ i ] as IObserver;
|
126
|
+
observer.notifyObserver( notification );
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
130
|
+
|
131
|
+
/**
|
132
|
+
* Remove the observer for a given notifyContext from an observer list for a given Notification name.
|
133
|
+
* <P>
|
134
|
+
* @param notificationName which observer list to remove from
|
135
|
+
* @param notifyContext remove the observer with this object as its notifyContext
|
136
|
+
*/
|
137
|
+
public function removeObserver( notificationName:String, notifyContext:Object ):void
|
138
|
+
{
|
139
|
+
// the observer list for the notification under inspection
|
140
|
+
var observers:Array = observerMap[ notificationName ] as Array;
|
141
|
+
|
142
|
+
// find the observer for the notifyContext
|
143
|
+
for ( var i:int=0; i<observers.length; i++ )
|
144
|
+
{
|
145
|
+
if ( Observer(observers[i]).compareNotifyContext( notifyContext ) == true ) {
|
146
|
+
// there can only be one Observer for a given notifyContext
|
147
|
+
// in any given Observer list, so remove it and break
|
148
|
+
observers.splice(i,1);
|
149
|
+
break;
|
150
|
+
}
|
151
|
+
}
|
152
|
+
|
153
|
+
// Also, when a Notification's Observer list length falls to
|
154
|
+
// zero, delete the notification key from the observer map
|
155
|
+
if ( observers.length == 0 ) {
|
156
|
+
delete observerMap[ notificationName ];
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
/**
|
161
|
+
* Register an <code>IMediator</code> instance with the <code>View</code>.
|
162
|
+
*
|
163
|
+
* <P>
|
164
|
+
* Registers the <code>IMediator</code> so that it can be retrieved by name,
|
165
|
+
* and further interrogates the <code>IMediator</code> for its
|
166
|
+
* <code>INotification</code> interests.</P>
|
167
|
+
* <P>
|
168
|
+
* If the <code>IMediator</code> returns any <code>INotification</code>
|
169
|
+
* names to be notified about, an <code>Observer</code> is created encapsulating
|
170
|
+
* the <code>IMediator</code> instance's <code>handleNotification</code> method
|
171
|
+
* and registering it as an <code>Observer</code> for all <code>INotifications</code> the
|
172
|
+
* <code>IMediator</code> is interested in.</p>
|
173
|
+
*
|
174
|
+
* @param mediatorName the name to associate with this <code>IMediator</code> instance
|
175
|
+
* @param mediator a reference to the <code>IMediator</code> instance
|
176
|
+
*/
|
177
|
+
public function registerMediator( mediator:IMediator ) : void
|
178
|
+
{
|
179
|
+
// do not allow re-registration (you must to removeMediator fist)
|
180
|
+
if ( mediatorMap[ mediator.getMediatorName() ] != null ) return;
|
181
|
+
|
182
|
+
// Register the Mediator for retrieval by name
|
183
|
+
mediatorMap[ mediator.getMediatorName() ] = mediator;
|
184
|
+
|
185
|
+
// Get Notification interests, if any.
|
186
|
+
var interests:Array = mediator.listNotificationInterests();
|
187
|
+
|
188
|
+
// Register Mediator as an observer for each of its notification interests
|
189
|
+
if ( interests.length > 0 )
|
190
|
+
{
|
191
|
+
// Create Observer referencing this mediator's handlNotification method
|
192
|
+
var observer:Observer = new Observer( mediator.handleNotification, mediator );
|
193
|
+
|
194
|
+
// Register Mediator as Observer for its list of Notification interests
|
195
|
+
for ( var i:Number=0; i<interests.length; i++ ) {
|
196
|
+
registerObserver( interests[i], observer );
|
197
|
+
}
|
198
|
+
}
|
199
|
+
|
200
|
+
// alert the mediator that it has been registered
|
201
|
+
mediator.onRegister();
|
202
|
+
|
203
|
+
}
|
204
|
+
|
205
|
+
/**
|
206
|
+
* Retrieve an <code>IMediator</code> from the <code>View</code>.
|
207
|
+
*
|
208
|
+
* @param mediatorName the name of the <code>IMediator</code> instance to retrieve.
|
209
|
+
* @return the <code>IMediator</code> instance previously registered with the given <code>mediatorName</code>.
|
210
|
+
*/
|
211
|
+
public function retrieveMediator( mediatorName:String ) : IMediator
|
212
|
+
{
|
213
|
+
return mediatorMap[ mediatorName ];
|
214
|
+
}
|
215
|
+
|
216
|
+
/**
|
217
|
+
* Remove an <code>IMediator</code> from the <code>View</code>.
|
218
|
+
*
|
219
|
+
* @param mediatorName name of the <code>IMediator</code> instance to be removed.
|
220
|
+
* @return the <code>IMediator</code> that was removed from the <code>View</code>
|
221
|
+
*/
|
222
|
+
public function removeMediator( mediatorName:String ) : IMediator
|
223
|
+
{
|
224
|
+
// Retrieve the named mediator
|
225
|
+
var mediator:IMediator = mediatorMap[ mediatorName ] as IMediator;
|
226
|
+
|
227
|
+
if ( mediator )
|
228
|
+
{
|
229
|
+
// for every notification this mediator is interested in...
|
230
|
+
var interests:Array = mediator.listNotificationInterests();
|
231
|
+
for ( var i:Number=0; i<interests.length; i++ )
|
232
|
+
{
|
233
|
+
// remove the observer linking the mediator
|
234
|
+
// to the notification interest
|
235
|
+
removeObserver( interests[i], mediator );
|
236
|
+
}
|
237
|
+
|
238
|
+
// remove the mediator from the map
|
239
|
+
delete mediatorMap[ mediatorName ];
|
240
|
+
|
241
|
+
// alert the mediator that it has been removed
|
242
|
+
mediator.onRemove();
|
243
|
+
}
|
244
|
+
|
245
|
+
return mediator;
|
246
|
+
}
|
247
|
+
|
248
|
+
/**
|
249
|
+
* Check if a Mediator is registered or not
|
250
|
+
*
|
251
|
+
* @param mediatorName
|
252
|
+
* @return whether a Mediator is registered with the given <code>mediatorName</code>.
|
253
|
+
*/
|
254
|
+
public function hasMediator( mediatorName:String ) : Boolean
|
255
|
+
{
|
256
|
+
return mediatorMap[ mediatorName ] != null;
|
257
|
+
}
|
258
|
+
|
259
|
+
// Mapping of Mediator names to Mediator instances
|
260
|
+
protected var mediatorMap : Array;
|
261
|
+
|
262
|
+
// Mapping of Notification names to Observer lists
|
263
|
+
protected var observerMap : Array;
|
264
|
+
|
265
|
+
// Singleton instance
|
266
|
+
protected static var instance : IView;
|
267
|
+
|
268
|
+
// Message Constants
|
269
|
+
protected const SINGLETON_MSG : String = "View Singleton already constructed!";
|
270
|
+
}
|
271
|
+
}
|