├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── VERSION ├── bin └── PureMVC.jar ├── docs ├── allclasses-frame.html ├── allclasses-index.html ├── allclasses-noframe.html ├── allpackages-index.html ├── constant-values.html ├── deprecated-list.html ├── element-list ├── help-doc.html ├── index-files │ ├── index-1.html │ ├── index-10.html │ ├── index-11.html │ ├── index-12.html │ ├── index-13.html │ ├── index-14.html │ ├── index-15.html │ ├── index-16.html │ ├── index-17.html │ ├── index-2.html │ ├── index-3.html │ ├── index-4.html │ ├── index-5.html │ ├── index-6.html │ ├── index-7.html │ ├── index-8.html │ └── index-9.html ├── index.html ├── jquery │ ├── external │ │ └── jquery │ │ │ └── jquery.js │ ├── images │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ ├── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ ├── ui-icons_222222_256x240.png │ │ ├── ui-icons_2e83ff_256x240.png │ │ ├── ui-icons_454545_256x240.png │ │ ├── ui-icons_888888_256x240.png │ │ └── ui-icons_cd0a0a_256x240.png │ ├── jquery-1.10.2.js │ ├── jquery-ui.css │ ├── jquery-ui.js │ ├── jquery-ui.min.css │ ├── jquery-ui.min.js │ ├── jquery-ui.structure.css │ ├── jquery-ui.structure.min.css │ ├── jszip-utils │ │ └── dist │ │ │ ├── jszip-utils-ie.js │ │ │ ├── jszip-utils-ie.min.js │ │ │ ├── jszip-utils.js │ │ │ └── jszip-utils.min.js │ └── jszip │ │ └── dist │ │ ├── jszip.js │ │ └── jszip.min.js ├── member-search-index.js ├── member-search-index.zip ├── org │ └── puremvc │ │ └── java │ │ └── multicore │ │ ├── core │ │ ├── Controller.html │ │ ├── Model.html │ │ ├── View.html │ │ ├── package-frame.html │ │ ├── package-summary.html │ │ └── package-tree.html │ │ ├── interfaces │ │ ├── ICommand.html │ │ ├── IController.html │ │ ├── IFacade.html │ │ ├── IMediator.html │ │ ├── IModel.html │ │ ├── INotification.html │ │ ├── INotifier.html │ │ ├── IObserver.html │ │ ├── IProxy.html │ │ ├── IView.html │ │ ├── package-frame.html │ │ ├── package-summary.html │ │ └── package-tree.html │ │ └── patterns │ │ ├── command │ │ ├── MacroCommand.html │ │ ├── SimpleCommand.html │ │ ├── package-frame.html │ │ ├── package-summary.html │ │ └── package-tree.html │ │ ├── facade │ │ ├── Facade.html │ │ ├── package-frame.html │ │ ├── package-summary.html │ │ └── package-tree.html │ │ ├── mediator │ │ ├── Mediator.html │ │ ├── package-frame.html │ │ ├── package-summary.html │ │ └── package-tree.html │ │ ├── observer │ │ ├── Notification.html │ │ ├── Notifier.html │ │ ├── Observer.html │ │ ├── package-frame.html │ │ ├── package-summary.html │ │ └── package-tree.html │ │ └── proxy │ │ ├── Proxy.html │ │ ├── package-frame.html │ │ ├── package-summary.html │ │ └── package-tree.html ├── overview-frame.html ├── overview-summary.html ├── overview-tree.html ├── package-search-index.js ├── package-search-index.zip ├── resources │ ├── glass.png │ └── x.png ├── script-dir │ ├── external │ │ └── jquery │ │ │ └── jquery.js │ ├── images │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ ├── ui-bg_glass_65_dadada_1x400.png │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ ├── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ ├── ui-icons_222222_256x240.png │ │ ├── ui-icons_2e83ff_256x240.png │ │ ├── ui-icons_454545_256x240.png │ │ ├── ui-icons_888888_256x240.png │ │ └── ui-icons_cd0a0a_256x240.png │ ├── jquery-3.4.1.js │ ├── jquery-ui.css │ ├── jquery-ui.js │ ├── jquery-ui.min.css │ ├── jquery-ui.min.js │ ├── jquery-ui.structure.css │ ├── jquery-ui.structure.min.css │ ├── jszip-utils │ │ └── dist │ │ │ ├── jszip-utils-ie.js │ │ │ ├── jszip-utils-ie.min.js │ │ │ ├── jszip-utils.js │ │ │ └── jszip-utils.min.js │ └── jszip │ │ └── dist │ │ ├── jszip.js │ │ └── jszip.min.js ├── script.js ├── search.js ├── stylesheet.css ├── type-search-index.js └── type-search-index.zip ├── pom.xml └── src ├── main └── java │ └── org │ └── puremvc │ └── java │ └── multicore │ ├── core │ ├── Controller.java │ ├── Model.java │ └── View.java │ ├── interfaces │ ├── ICommand.java │ ├── IController.java │ ├── IFacade.java │ ├── IMediator.java │ ├── IModel.java │ ├── INotification.java │ ├── INotifier.java │ ├── IObserver.java │ ├── IProxy.java │ └── IView.java │ └── patterns │ ├── command │ ├── MacroCommand.java │ └── SimpleCommand.java │ ├── facade │ └── Facade.java │ ├── mediator │ └── Mediator.java │ ├── observer │ ├── Notification.java │ ├── Notifier.java │ └── Observer.java │ └── proxy │ └── Proxy.java └── test └── java └── org └── puremvc └── java └── multicore ├── core ├── ControllerTest.java ├── ControllerTestCommand.java ├── ControllerTestCommand2.java ├── ControllerTestVO.java ├── ModelTest.java ├── ModelTestProxy.java ├── ViewTest.java ├── ViewTestMediator.java ├── ViewTestMediator2.java ├── ViewTestMediator3.java ├── ViewTestMediator4.java ├── ViewTestMediator5.java ├── ViewTestMediator6.java └── ViewTestNote.java └── patterns ├── command ├── MacroCommandTest.java ├── MacroCommandTestCommand.java ├── MacroCommandTestSub1Command.java ├── MacroCommandTestSub2Command.java ├── MacroCommandTestVO.java ├── SimpleCommandTest.java ├── SimpleCommandTestCommand.java └── SimpleCommandTestVO.java ├── facade ├── FacadeTest.java ├── FacadeTestCommand.java └── FacadeTestVO.java ├── mediator └── MediatorTest.java ├── observer ├── NotificationTest.java └── ObserverTest.java └── proxy └── ProxyTest.java /.gitattributes: -------------------------------------------------------------------------------- 1 | # Handle line endings automatically for files detected as text 2 | # and leave all files detected as binary untouched. 3 | * text=auto 4 | 5 | # 6 | # The above will handle all files NOT found below 7 | # 8 | # These files are text and should be normalized (Convert crlf => lf) 9 | *.css text 10 | *.df text 11 | *.htm text 12 | *.html text 13 | *.java text 14 | *.js text 15 | *.json text 16 | *.jsp text 17 | *.jspf text 18 | *.jspx text 19 | *.properties text 20 | *.sh text 21 | *.tld text 22 | *.txt text 23 | *.tag text 24 | *.tagx text 25 | *.xml text 26 | *.yml text 27 | 28 | # These files are binary and should be left untouched 29 | # (binary is a macro for -text -diff) 30 | *.class binary 31 | *.dll binary 32 | *.ear binary 33 | *.gif binary 34 | *.ico binary 35 | *.jar binary 36 | *.jpg binary 37 | *.jpeg binary 38 | *.png binary 39 | *.so binary 40 | *.war binary 41 | 42 | #linguist-documentation 43 | docs/* linguist-documentation -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | .DS_Store 4 | target -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | * PureMVC MultiCore Framework for Java - Copyright © 2019 [Saad Shams](https://www.linkedin.com/in/muizz) 2 | * PureMVC - Copyright © 2019 [Futurescale, Inc](http://futurescale.com). 3 | * All rights reserved. 4 | 5 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 9 | * Neither the name of Futurescale, Inc., PureMVC.org, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## [PureMVC](http://puremvc.github.com/) Java MultiCore Framework 2 | 3 | PureMVC is a lightweight framework for creating applications based upon the classic [Model-View-Controller](http://en.wikipedia.org/wiki/Model-view-controller) design meta-pattern. It supports [modular programming](http://en.wikipedia.org/wiki/Modular_programming) through the use of [Multiton](http://en.wikipedia.org/wiki/Multiton) Core actors instead of the [Singletons](http://en.wikipedia.org/wiki/Singleton_pattern) used in the [Standard](https://github.com/PureMVC/puremvc-java-standard-framework/wiki) Version. 4 | 5 | * [API Docs](http://puremvc.org/pages/docs/Java/multicore) 6 | * [Unit Tests](http://puremvc.github.io/pages/images/screenshots/PureMVC-Shot-Java-Multicore-UnitTests.png) 7 | * [Discussion](http://forums.puremvc.org/index.php/board,60.0.html) 8 | * [Legacy Implementation](https://github.com/PureMVC/puremvc-java-multicore-framework/tree/1.0.9) 9 | 10 | ## Maven Installation 11 | ```xml 12 | 13 | 14 | org.puremvc 15 | puremvc-multicore 16 | 2.2 17 | 18 | 19 | ``` 20 | 21 | ## Demos 22 | * [Employee Admin Microservice](https://github.com/PureMVC/puremvc-java-demo-microservice-employeeadmin/wiki) 23 | * [Employee Admin Android App](https://github.com/PureMVC/purmevc-java-demo-android-employeeadmin/wiki) 24 | 25 | ## Utilities 26 | * [Pipes](https://github.com/PureMVC/puremvc-java-util-pipes/wiki) 27 | 28 | ## Platforms / Technologies 29 | * [Java](https://en.wikipedia.org/wiki/Java_(programming_language)) 30 | * [Android](https://en.wikipedia.org/wiki/Android_(operating_system)) 31 | 32 | ## Status 33 | Production - [Version 2.2](https://github.com/PureMVC/puremvc-java-multicore-framework/blob/master/VERSION) 34 | 35 | ## License 36 | * PureMVC MultiCore Framework for Java - Copyright © 2019 [Saad Shams](https://www.linkedin.com/in/muizz) 37 | * PureMVC - Copyright © 2019 [Futurescale, Inc.](http://futurescale.com/) 38 | * All rights reserved. 39 | 40 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 41 | 42 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 43 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 44 | * Neither the name of Futurescale, Inc., PureMVC.org, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 45 | 46 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 47 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | PureMVC MultiCore Framework for Java 2 | -------------------------------------------------------------------------- 3 | Release Date: 03/16/20 4 | Platform: Java 5 | Version: 2 6 | Revision: 2 7 | Minor: 0 8 | Author: Saad Shams 9 | -------------------------------------------------------------------------- 10 | 2.2 - Fixes, Refactor 11 | 12 | 2.1 - Maven Integration 13 | 14 | 2.0 - Brand new implementation of ported code, equivalent to AS3 MultiCore Version 1.0.5. -------------------------------------------------------------------------------- /bin/PureMVC.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/bin/PureMVC.jar -------------------------------------------------------------------------------- /docs/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 |

All Classes

22 |
23 | 46 |
47 | 48 | 49 | -------------------------------------------------------------------------------- /docs/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | All Classes 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 |

All Classes

22 |
23 | 46 |
47 | 48 | 49 | -------------------------------------------------------------------------------- /docs/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Deprecated List 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 25 | 28 |
29 | 66 |
67 |
68 |
69 |

Deprecated API

70 |

Contents

71 |
72 |
73 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /docs/element-list: -------------------------------------------------------------------------------- 1 | org.puremvc.java.multicore.core 2 | org.puremvc.java.multicore.interfaces 3 | org.puremvc.java.multicore.patterns.command 4 | org.puremvc.java.multicore.patterns.facade 5 | org.puremvc.java.multicore.patterns.mediator 6 | org.puremvc.java.multicore.patterns.observer 7 | org.puremvc.java.multicore.patterns.proxy 8 | -------------------------------------------------------------------------------- /docs/jquery/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/jquery/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/jquery/images/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/jquery/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/jquery/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/jquery/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/jquery/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/jquery/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/jquery/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/jquery/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /docs/jquery/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/jquery/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /docs/jquery/jquery-ui.structure.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI CSS Framework 1.11.4 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/category/theming/ 10 | */ 11 | 12 | /* Layout helpers 13 | ----------------------------------*/ 14 | .ui-helper-hidden { 15 | display: none; 16 | } 17 | .ui-helper-hidden-accessible { 18 | border: 0; 19 | clip: rect(0 0 0 0); 20 | height: 1px; 21 | margin: -1px; 22 | overflow: hidden; 23 | padding: 0; 24 | position: absolute; 25 | width: 1px; 26 | } 27 | .ui-helper-reset { 28 | margin: 0; 29 | padding: 0; 30 | border: 0; 31 | outline: 0; 32 | line-height: 1.3; 33 | text-decoration: none; 34 | font-size: 100%; 35 | list-style: none; 36 | } 37 | .ui-helper-clearfix:before, 38 | .ui-helper-clearfix:after { 39 | content: ""; 40 | display: table; 41 | border-collapse: collapse; 42 | } 43 | .ui-helper-clearfix:after { 44 | clear: both; 45 | } 46 | .ui-helper-clearfix { 47 | min-height: 0; /* support: IE7 */ 48 | } 49 | .ui-helper-zfix { 50 | width: 100%; 51 | height: 100%; 52 | top: 0; 53 | left: 0; 54 | position: absolute; 55 | opacity: 0; 56 | filter:Alpha(Opacity=0); /* support: IE8 */ 57 | } 58 | 59 | .ui-front { 60 | z-index: 100; 61 | } 62 | 63 | 64 | /* Interaction Cues 65 | ----------------------------------*/ 66 | .ui-state-disabled { 67 | cursor: default !important; 68 | } 69 | 70 | 71 | /* Icons 72 | ----------------------------------*/ 73 | 74 | /* states and images */ 75 | .ui-icon { 76 | display: block; 77 | text-indent: -99999px; 78 | overflow: hidden; 79 | background-repeat: no-repeat; 80 | } 81 | 82 | 83 | /* Misc visuals 84 | ----------------------------------*/ 85 | 86 | /* Overlays */ 87 | .ui-widget-overlay { 88 | position: fixed; 89 | top: 0; 90 | left: 0; 91 | width: 100%; 92 | height: 100%; 93 | } 94 | .ui-autocomplete { 95 | position: absolute; 96 | top: 0; 97 | left: 0; 98 | cursor: default; 99 | } 100 | .ui-menu { 101 | list-style: none; 102 | padding: 0; 103 | margin: 0; 104 | display: block; 105 | outline: none; 106 | } 107 | .ui-menu .ui-menu { 108 | position: absolute; 109 | } 110 | .ui-menu .ui-menu-item { 111 | position: relative; 112 | margin: 0; 113 | padding: 3px 1em 3px .4em; 114 | cursor: pointer; 115 | min-height: 0; /* support: IE7 */ 116 | /* support: IE10, see #8844 */ 117 | list-style-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"); 118 | } 119 | .ui-menu .ui-menu-divider { 120 | margin: 5px 0; 121 | height: 0; 122 | font-size: 0; 123 | line-height: 0; 124 | border-width: 1px 0 0 0; 125 | } 126 | .ui-menu .ui-state-focus, 127 | .ui-menu .ui-state-active { 128 | margin: -1px; 129 | } 130 | 131 | /* icon support */ 132 | .ui-menu-icons { 133 | position: relative; 134 | } 135 | .ui-menu-icons .ui-menu-item { 136 | padding-left: 2em; 137 | } 138 | 139 | /* left-aligned */ 140 | .ui-menu .ui-icon { 141 | position: absolute; 142 | top: 0; 143 | bottom: 0; 144 | left: .2em; 145 | margin: auto 0; 146 | } 147 | 148 | /* right-aligned */ 149 | .ui-menu .ui-menu-icon { 150 | left: auto; 151 | right: 0; 152 | } 153 | -------------------------------------------------------------------------------- /docs/jquery/jquery-ui.structure.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.11.4 - 2015-05-20 2 | * http://jqueryui.com 3 | * Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */ 4 | 5 | .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:none}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{position:relative;margin:0;padding:3px 1em 3px .4em;cursor:pointer;min-height:0;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0} 6 | -------------------------------------------------------------------------------- /docs/jquery/jszip-utils/dist/jszip-utils-ie.js: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | JSZipUtils - A collection of cross-browser utilities to go along with JSZip. 4 | 5 | 6 | (c) 2014 Stuart Knightley, David Duponchel 7 | Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. 8 | 9 | */ 10 | ;(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o\r\n"+ 18 | "\r\n"; 32 | 33 | // inject VBScript 34 | document.write(IEBinaryToArray_ByteStr_Script); 35 | 36 | global.JSZipUtils._getBinaryFromXHR = function (xhr) { 37 | var binary = xhr.responseBody; 38 | var byteMapping = {}; 39 | for ( var i = 0; i < 256; i++ ) { 40 | for ( var j = 0; j < 256; j++ ) { 41 | byteMapping[ String.fromCharCode( i + (j << 8) ) ] = 42 | String.fromCharCode(i) + String.fromCharCode(j); 43 | } 44 | } 45 | var rawBytes = IEBinaryToArray_ByteStr(binary); 46 | var lastChr = IEBinaryToArray_ByteStr_Last(binary); 47 | return rawBytes.replace(/[\s\S]/g, function( match ) { 48 | return byteMapping[match]; 49 | }) + lastChr; 50 | }; 51 | 52 | // enforcing Stuk's coding style 53 | // vim: set shiftwidth=4 softtabstop=4: 54 | 55 | },{}]},{},[1]) 56 | ; 57 | -------------------------------------------------------------------------------- /docs/jquery/jszip-utils/dist/jszip-utils-ie.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | JSZipUtils - A collection of cross-browser utilities to go along with JSZip. 4 | 5 | 6 | (c) 2014 Stuart Knightley, David Duponchel 7 | Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. 8 | 9 | */ 10 | !function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g\r\n";document.write(b),a.JSZipUtils._getBinaryFromXHR=function(a){for(var b=a.responseBody,c={},d=0;256>d;d++)for(var e=0;256>e;e++)c[String.fromCharCode(d+(e<<8))]=String.fromCharCode(d)+String.fromCharCode(e);var f=IEBinaryToArray_ByteStr(b),g=IEBinaryToArray_ByteStr_Last(b);return f.replace(/[\s\S]/g,function(a){return c[a]})+g}},{}]},{},[1]); 11 | -------------------------------------------------------------------------------- /docs/jquery/jszip-utils/dist/jszip-utils.js: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | JSZipUtils - A collection of cross-browser utilities to go along with JSZip. 4 | 5 | 6 | (c) 2014 Stuart Knightley, David Duponchel 7 | Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. 8 | 9 | */ 10 | !function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.JSZipUtils=e():"undefined"!=typeof global?global.JSZipUtils=e():"undefined"!=typeof self&&(self.JSZipUtils=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 5 | 6 | (c) 2014 Stuart Knightley, David Duponchel 7 | Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. 8 | 9 | */ 10 | !function(a){"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define(a):"undefined"!=typeof window?window.JSZipUtils=a():"undefined"!=typeof global?global.JSZipUtils=a():"undefined"!=typeof self&&(self.JSZipUtils=a())}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g 2 | 3 | 4 | 5 | 6 | org.puremvc.java.multicore.core 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 |
22 |

org.puremvc.java.multicore.core

23 |
24 |
25 |

Classes

26 | 31 |
32 |
33 |
34 | 35 | 36 | -------------------------------------------------------------------------------- /docs/org/puremvc/java/multicore/core/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.puremvc.java.multicore.core 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 25 | 28 |
29 | 66 |
67 |
68 |
69 |

Package org.puremvc.java.multicore.core

70 |
71 |
72 |
73 |
    74 |
  • 75 |
    76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 90 | 91 | 92 | 93 | 96 | 97 | 98 | 99 | 102 | 103 | 104 |
    Class Summary 
    ClassDescription
    Controller 88 |
    A Multiton IController implementation.
    89 |
    Model 94 |
    A Multiton IModel implementation.
    95 |
    View 100 |
    A Multiton IView implementation.
    101 |
    105 |
    106 |
  • 107 |
108 |
109 |
110 |
111 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /docs/org/puremvc/java/multicore/interfaces/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.puremvc.java.multicore.interfaces 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 |
22 |

org.puremvc.java.multicore.interfaces

23 |
24 |
25 |

Interfaces

26 | 38 |
39 |
40 |
41 | 42 | 43 | -------------------------------------------------------------------------------- /docs/org/puremvc/java/multicore/patterns/command/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.puremvc.java.multicore.patterns.command 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 |
22 |

org.puremvc.java.multicore.patterns.command

23 |
24 |
25 |

Classes

26 | 30 |
31 |
32 |
33 | 34 | 35 | -------------------------------------------------------------------------------- /docs/org/puremvc/java/multicore/patterns/command/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.puremvc.java.multicore.patterns.command 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 25 | 28 |
29 | 66 |
67 |
68 |
69 |

Package org.puremvc.java.multicore.patterns.command

70 |
71 |
72 |
73 |
    74 |
  • 75 |
    76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 90 | 91 | 92 | 93 | 96 | 97 | 98 |
    Class Summary 
    ClassDescription
    MacroCommand 88 |
    A base ICommand implementation that executes other ICommands.
    89 |
    SimpleCommand 94 |
    A base ICommand implementation.
    95 |
    99 |
    100 |
  • 101 |
102 |
103 |
104 |
105 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /docs/org/puremvc/java/multicore/patterns/facade/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.puremvc.java.multicore.patterns.facade 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 |
22 |

org.puremvc.java.multicore.patterns.facade

23 |
24 |
25 |

Classes

26 | 29 |
30 |
31 |
32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/org/puremvc/java/multicore/patterns/facade/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.puremvc.java.multicore.patterns.facade 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 25 | 28 |
29 | 66 |
67 |
68 |
69 |

Package org.puremvc.java.multicore.patterns.facade

70 |
71 |
72 |
73 |
    74 |
  • 75 |
    76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 90 | 91 | 92 |
    Class Summary 
    ClassDescription
    Facade 88 |
    A base Multiton IFacade implementation.
    89 |
    93 |
    94 |
  • 95 |
96 |
97 |
98 |
99 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /docs/org/puremvc/java/multicore/patterns/facade/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.puremvc.java.multicore.patterns.facade Class Hierarchy 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 25 | 28 |
29 | 66 |
67 |
68 |
69 |

Hierarchy For Package org.puremvc.java.multicore.patterns.facade

70 | Package Hierarchies: 71 | 74 |
75 |
76 |
77 |

Class Hierarchy

78 |
    79 |
  • java.lang.Object 80 |
      81 |
    • org.puremvc.java.multicore.patterns.facade.Facade (implements org.puremvc.java.multicore.interfaces.IFacade)
    • 82 |
    83 |
  • 84 |
85 |
86 |
87 |
88 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /docs/org/puremvc/java/multicore/patterns/mediator/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.puremvc.java.multicore.patterns.mediator 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 |
22 |

org.puremvc.java.multicore.patterns.mediator

23 |
24 |
25 |

Classes

26 | 29 |
30 |
31 |
32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/org/puremvc/java/multicore/patterns/mediator/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.puremvc.java.multicore.patterns.mediator 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 25 | 28 |
29 | 66 |
67 |
68 |
69 |

Package org.puremvc.java.multicore.patterns.mediator

70 |
71 |
72 |
73 |
    74 |
  • 75 |
    76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 90 | 91 | 92 |
    Class Summary 
    ClassDescription
    Mediator 88 |
    A base IMediator implementation.
    89 |
    93 |
    94 |
  • 95 |
96 |
97 |
98 |
99 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /docs/org/puremvc/java/multicore/patterns/mediator/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.puremvc.java.multicore.patterns.mediator Class Hierarchy 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 25 | 28 |
29 | 66 |
67 |
68 |
69 |

Hierarchy For Package org.puremvc.java.multicore.patterns.mediator

70 | Package Hierarchies: 71 | 74 |
75 |
76 |
77 |

Class Hierarchy

78 |
    79 |
  • java.lang.Object 80 |
      81 |
    • org.puremvc.java.multicore.patterns.observer.Notifier (implements org.puremvc.java.multicore.interfaces.INotifier) 82 |
        83 |
      • org.puremvc.java.multicore.patterns.mediator.Mediator (implements org.puremvc.java.multicore.interfaces.IMediator)
      • 84 |
      85 |
    • 86 |
    87 |
  • 88 |
89 |
90 |
91 |
92 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /docs/org/puremvc/java/multicore/patterns/observer/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.puremvc.java.multicore.patterns.observer 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 |
22 |

org.puremvc.java.multicore.patterns.observer

23 |
24 |
25 |

Classes

26 | 31 |
32 |
33 |
34 | 35 | 36 | -------------------------------------------------------------------------------- /docs/org/puremvc/java/multicore/patterns/proxy/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.puremvc.java.multicore.patterns.proxy 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 |
22 |

org.puremvc.java.multicore.patterns.proxy

23 |
24 |
25 |

Classes

26 | 29 |
30 |
31 |
32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/org/puremvc/java/multicore/patterns/proxy/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.puremvc.java.multicore.patterns.proxy 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 25 | 28 |
29 | 66 |
67 |
68 |
69 |

Package org.puremvc.java.multicore.patterns.proxy

70 |
71 |
72 |
73 |
    74 |
  • 75 |
    76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 90 | 91 | 92 |
    Class Summary 
    ClassDescription
    Proxy 88 |
    A base IProxy implementation.
    89 |
    93 |
    94 |
  • 95 |
96 |
97 |
98 |
99 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /docs/org/puremvc/java/multicore/patterns/proxy/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.puremvc.java.multicore.patterns.proxy Class Hierarchy 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 25 | 28 |
29 | 66 |
67 |
68 |
69 |

Hierarchy For Package org.puremvc.java.multicore.patterns.proxy

70 | Package Hierarchies: 71 | 74 |
75 |
76 |
77 |

Class Hierarchy

78 |
    79 |
  • java.lang.Object 80 |
      81 |
    • org.puremvc.java.multicore.patterns.observer.Notifier (implements org.puremvc.java.multicore.interfaces.INotifier) 82 |
        83 |
      • org.puremvc.java.multicore.patterns.proxy.Proxy (implements org.puremvc.java.multicore.interfaces.IProxy)
      • 84 |
      85 |
    • 86 |
    87 |
  • 88 |
89 |
90 |
91 |
92 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /docs/overview-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Overview List 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 | 21 | 26 |
27 |

Packages

28 | 37 |
38 |

 

39 | 40 | 41 | -------------------------------------------------------------------------------- /docs/overview-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Generated Documentation (Untitled) 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 |
20 | 23 |

index.html

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/package-search-index.js: -------------------------------------------------------------------------------- 1 | packageSearchIndex = [{"l":"All Packages","url":"allpackages-index.html"},{"l":"org.puremvc.java.multicore.core"},{"l":"org.puremvc.java.multicore.interfaces"},{"l":"org.puremvc.java.multicore.patterns.command"},{"l":"org.puremvc.java.multicore.patterns.facade"},{"l":"org.puremvc.java.multicore.patterns.mediator"},{"l":"org.puremvc.java.multicore.patterns.observer"},{"l":"org.puremvc.java.multicore.patterns.proxy"}] -------------------------------------------------------------------------------- /docs/package-search-index.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/package-search-index.zip -------------------------------------------------------------------------------- /docs/resources/glass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/resources/glass.png -------------------------------------------------------------------------------- /docs/resources/x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/resources/x.png -------------------------------------------------------------------------------- /docs/script-dir/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/script-dir/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /docs/script-dir/images/ui-bg_glass_65_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/script-dir/images/ui-bg_glass_65_dadada_1x400.png -------------------------------------------------------------------------------- /docs/script-dir/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/script-dir/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /docs/script-dir/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/script-dir/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /docs/script-dir/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/script-dir/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /docs/script-dir/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/script-dir/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /docs/script-dir/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/script-dir/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /docs/script-dir/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/script-dir/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /docs/script-dir/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/script-dir/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /docs/script-dir/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/script-dir/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /docs/script-dir/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PureMVC/puremvc-java-multicore-framework/ace79b31b0408215b7bb9cd3a4b424afd7906f31/docs/script-dir/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /docs/script-dir/jquery-ui.structure.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery UI CSS Framework 1.12.1 3 | * http://jqueryui.com 4 | * 5 | * Copyright jQuery Foundation and other contributors 6 | * Released under the MIT license. 7 | * http://jquery.org/license 8 | * 9 | * http://api.jqueryui.com/category/theming/ 10 | */ 11 | /* Layout helpers 12 | ----------------------------------*/ 13 | .ui-helper-hidden { 14 | display: none; 15 | } 16 | .ui-helper-hidden-accessible { 17 | border: 0; 18 | clip: rect(0 0 0 0); 19 | height: 1px; 20 | margin: -1px; 21 | overflow: hidden; 22 | padding: 0; 23 | position: absolute; 24 | width: 1px; 25 | } 26 | .ui-helper-reset { 27 | margin: 0; 28 | padding: 0; 29 | border: 0; 30 | outline: 0; 31 | line-height: 1.3; 32 | text-decoration: none; 33 | font-size: 100%; 34 | list-style: none; 35 | } 36 | .ui-helper-clearfix:before, 37 | .ui-helper-clearfix:after { 38 | content: ""; 39 | display: table; 40 | border-collapse: collapse; 41 | } 42 | .ui-helper-clearfix:after { 43 | clear: both; 44 | } 45 | .ui-helper-zfix { 46 | width: 100%; 47 | height: 100%; 48 | top: 0; 49 | left: 0; 50 | position: absolute; 51 | opacity: 0; 52 | filter:Alpha(Opacity=0); /* support: IE8 */ 53 | } 54 | 55 | .ui-front { 56 | z-index: 100; 57 | } 58 | 59 | 60 | /* Interaction Cues 61 | ----------------------------------*/ 62 | .ui-state-disabled { 63 | cursor: default !important; 64 | pointer-events: none; 65 | } 66 | 67 | 68 | /* Icons 69 | ----------------------------------*/ 70 | .ui-icon { 71 | display: inline-block; 72 | vertical-align: middle; 73 | margin-top: -.25em; 74 | position: relative; 75 | text-indent: -99999px; 76 | overflow: hidden; 77 | background-repeat: no-repeat; 78 | } 79 | 80 | .ui-widget-icon-block { 81 | left: 50%; 82 | margin-left: -8px; 83 | display: block; 84 | } 85 | 86 | /* Misc visuals 87 | ----------------------------------*/ 88 | 89 | /* Overlays */ 90 | .ui-widget-overlay { 91 | position: fixed; 92 | top: 0; 93 | left: 0; 94 | width: 100%; 95 | height: 100%; 96 | } 97 | .ui-autocomplete { 98 | position: absolute; 99 | top: 0; 100 | left: 0; 101 | cursor: default; 102 | } 103 | .ui-menu { 104 | list-style: none; 105 | padding: 0; 106 | margin: 0; 107 | display: block; 108 | outline: 0; 109 | } 110 | .ui-menu .ui-menu { 111 | position: absolute; 112 | } 113 | .ui-menu .ui-menu-item { 114 | margin: 0; 115 | cursor: pointer; 116 | /* support: IE10, see #8844 */ 117 | list-style-image: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"); 118 | } 119 | .ui-menu .ui-menu-item-wrapper { 120 | position: relative; 121 | padding: 3px 1em 3px .4em; 122 | } 123 | .ui-menu .ui-menu-divider { 124 | margin: 5px 0; 125 | height: 0; 126 | font-size: 0; 127 | line-height: 0; 128 | border-width: 1px 0 0 0; 129 | } 130 | .ui-menu .ui-state-focus, 131 | .ui-menu .ui-state-active { 132 | margin: -1px; 133 | } 134 | 135 | /* icon support */ 136 | .ui-menu-icons { 137 | position: relative; 138 | } 139 | .ui-menu-icons .ui-menu-item-wrapper { 140 | padding-left: 2em; 141 | } 142 | 143 | /* left-aligned */ 144 | .ui-menu .ui-icon { 145 | position: absolute; 146 | top: 0; 147 | bottom: 0; 148 | left: .2em; 149 | margin: auto 0; 150 | } 151 | 152 | /* right-aligned */ 153 | .ui-menu .ui-menu-icon { 154 | left: auto; 155 | right: 0; 156 | } 157 | -------------------------------------------------------------------------------- /docs/script-dir/jquery-ui.structure.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.12.1 - 2018-12-06 2 | * http://jqueryui.com 3 | * Copyright jQuery Foundation and other contributors; Licensed MIT */ 4 | 5 | .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0} -------------------------------------------------------------------------------- /docs/script-dir/jszip-utils/dist/jszip-utils-ie.js: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | JSZipUtils - A collection of cross-browser utilities to go along with JSZip. 4 | 5 | 6 | (c) 2014 Stuart Knightley, David Duponchel 7 | Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. 8 | 9 | */ 10 | ;(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o\r\n"+ 18 | "\r\n"; 32 | 33 | // inject VBScript 34 | document.write(IEBinaryToArray_ByteStr_Script); 35 | 36 | global.JSZipUtils._getBinaryFromXHR = function (xhr) { 37 | var binary = xhr.responseBody; 38 | var byteMapping = {}; 39 | for ( var i = 0; i < 256; i++ ) { 40 | for ( var j = 0; j < 256; j++ ) { 41 | byteMapping[ String.fromCharCode( i + (j << 8) ) ] = 42 | String.fromCharCode(i) + String.fromCharCode(j); 43 | } 44 | } 45 | var rawBytes = IEBinaryToArray_ByteStr(binary); 46 | var lastChr = IEBinaryToArray_ByteStr_Last(binary); 47 | return rawBytes.replace(/[\s\S]/g, function( match ) { 48 | return byteMapping[match]; 49 | }) + lastChr; 50 | }; 51 | 52 | // enforcing Stuk's coding style 53 | // vim: set shiftwidth=4 softtabstop=4: 54 | 55 | },{}]},{},[1]) 56 | ; 57 | -------------------------------------------------------------------------------- /docs/script-dir/jszip-utils/dist/jszip-utils-ie.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | JSZipUtils - A collection of cross-browser utilities to go along with JSZip. 4 | 5 | 6 | (c) 2014 Stuart Knightley, David Duponchel 7 | Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. 8 | 9 | */ 10 | !function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g\r\n";document.write(b),a.JSZipUtils._getBinaryFromXHR=function(a){for(var b=a.responseBody,c={},d=0;256>d;d++)for(var e=0;256>e;e++)c[String.fromCharCode(d+(e<<8))]=String.fromCharCode(d)+String.fromCharCode(e);var f=IEBinaryToArray_ByteStr(b),g=IEBinaryToArray_ByteStr_Last(b);return f.replace(/[\s\S]/g,function(a){return c[a]})+g}},{}]},{},[1]); 11 | -------------------------------------------------------------------------------- /docs/script-dir/jszip-utils/dist/jszip-utils.js: -------------------------------------------------------------------------------- 1 | /*! 2 | 3 | JSZipUtils - A collection of cross-browser utilities to go along with JSZip. 4 | 5 | 6 | (c) 2014 Stuart Knightley, David Duponchel 7 | Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. 8 | 9 | */ 10 | !function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.JSZipUtils=e():"undefined"!=typeof global?global.JSZipUtils=e():"undefined"!=typeof self&&(self.JSZipUtils=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 5 | 6 | (c) 2014 Stuart Knightley, David Duponchel 7 | Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip-utils/master/LICENSE.markdown. 8 | 9 | */ 10 | !function(a){"object"==typeof exports?module.exports=a():"function"==typeof define&&define.amd?define(a):"undefined"!=typeof window?window.JSZipUtils=a():"undefined"!=typeof global?global.JSZipUtils=a():"undefined"!=typeof self&&(self.JSZipUtils=a())}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.interfaces; 9 | 10 | /** 11 | * The interface definition for a PureMVC Command. 12 | * 13 | * @see org.puremvc.java.multicore.interfaces INotification 14 | */ 15 | public interface ICommand extends INotifier { 16 | 17 | /** 18 | *

Execute the ICommand's logic to handle a given INotification.

19 | * 20 | * @param notification an INotification to handle. 21 | */ 22 | void execute(INotification notification); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/puremvc/java/multicore/interfaces/IController.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.interfaces; 9 | 10 | import java.util.function.Supplier; 11 | 12 | /** 13 | *

The interface definition for a PureMVC Controller.

14 | * 15 | *

In PureMVC, an IController implementor 16 | * follows the 'Command and Controller' strategy, and 17 | * assumes these responsibilities:

18 | * 19 | *
    20 | *
  • Remembering which ICommands 21 | * are intended to handle which INotifications.
  • 22 | *
  • Registering itself as an IObserver with 23 | * the View for each INotification 24 | * that it has an ICommand mapping for.
  • 25 | *
  • Creating a new instance of the proper ICommand 26 | * to handle a given INotification when notified by the View.
  • 27 | *
  • Calling the ICommand's execute 28 | * method, passing in the INotification.
  • 29 | *
30 | * 31 | * @see org.puremvc.java.multicore.interfaces INotification 32 | * @see org.puremvc.java.multicore.interfaces ICommand 33 | */ 34 | public interface IController { 35 | 36 | /** 37 | *

Register a particular ICommand class as the handler 38 | * for a particular INotification.

39 | * 40 | * @param notificationName the name of the INotification 41 | * @param commandSupplier a reference to ICommand supplier 42 | */ 43 | void registerCommand(String notificationName, Supplier commandSupplier); 44 | 45 | /** 46 | *

Execute the ICommand previously registered as the 47 | * handler for INotifications with the given notification name.

48 | * 49 | * @param notification the INotification to execute the associated ICommand for 50 | */ 51 | void executeCommand(INotification notification); 52 | 53 | /** 54 | *

Remove a previously registered ICommand to INotification mapping.

55 | * 56 | * @param notificationName the name of the INotification to remove the ICommand mapping for 57 | */ 58 | void removeCommand(String notificationName); 59 | 60 | /** 61 | *

Check if a Command is registered for a given Notification

62 | * 63 | * @param notificationName notification name 64 | * @return whether a Command is currently registered for the given notificationName. 65 | */ 66 | boolean hasCommand(String notificationName); 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/org/puremvc/java/multicore/interfaces/IFacade.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.interfaces; 9 | 10 | import java.util.function.Supplier; 11 | 12 | /** 13 | *

The interface definition for a PureMVC Facade.

14 | * 15 | *

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

18 | * 19 | *

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

22 | * 23 | * @see IModel IModel 24 | * @see IView IView 25 | * @see org.puremvc.java.multicore.interfaces.IController IController 26 | * @see org.puremvc.java.multicore.interfaces.ICommand ICommand 27 | * @see org.puremvc.java.multicore.interfaces.INotification INotification 28 | */ 29 | public interface IFacade extends INotifier { 30 | 31 | /** 32 | *

Register an IProxy with the Model by name.

33 | * 34 | * @param proxy the IProxy to be registered with the Model. 35 | */ 36 | void registerProxy(IProxy proxy); 37 | 38 | /** 39 | *

Retrieve a IProxy from the Model by name.

40 | * 41 | * @param proxyName the name of the IProxy instance to be retrieved. 42 | * @return the IProxy previously regisetered by proxyName with the Model. 43 | */ 44 | IProxy retrieveProxy(String proxyName); 45 | 46 | /** 47 | *

Remove an IProxy instance from the Model by name.

48 | * 49 | * @param proxyName the IProxy to remove from the Model. 50 | * @return the IProxy that was removed from the Model 51 | */ 52 | IProxy removeProxy(String proxyName); 53 | 54 | /** 55 | *

Check if a Proxy is registered

56 | * 57 | * @param proxyName proxy name 58 | * @return whether a Proxy is currently registered with the given proxyName. 59 | */ 60 | boolean hasProxy(String proxyName); 61 | 62 | /** 63 | *

Register an ICommand with the Controller.

64 | * 65 | * @param notificationName the name of the INotification to associate the ICommand with. 66 | * @param commandSupplier a reference to ICommand supplier 67 | */ 68 | void registerCommand(String notificationName, Supplier commandSupplier); 69 | 70 | /** 71 | *

Remove a previously registered ICommand to INotification mapping from the Controller.

72 | * 73 | * @param notificationName the name of the INotification to remove the ICommand mapping for 74 | */ 75 | void removeCommand(String notificationName); 76 | 77 | /** 78 | *

Check if a Command is registered for a given Notification

79 | * 80 | * @param notificationName notification name 81 | * @return whether a Command is currently registered for the given notificationName. 82 | */ 83 | boolean hasCommand(String notificationName); 84 | 85 | /** 86 | *

Register an IMediator instance with the View.

87 | * 88 | * @param mediator a reference to the IMediator instance 89 | */ 90 | void registerMediator(IMediator mediator); 91 | 92 | /** 93 | *

Retrieve an IMediator instance from the View.

94 | * 95 | * @param mediatorName the name of the IMediator instance to retrievve 96 | * @return the IMediator previously registered with the given mediatorName. 97 | */ 98 | IMediator retrieveMediator(String mediatorName); 99 | 100 | /** 101 | *

Remove a IMediator instance from the View.

102 | * 103 | * @param mediatorName name of the IMediator instance to be removed. 104 | * @return the IMediator instance previously registered with the given mediatorName. 105 | */ 106 | IMediator removeMediator(String mediatorName); 107 | 108 | /** 109 | *

Check if a Mediator is registered or not

110 | * 111 | * @param mediatorName mediator name 112 | * @return whether a Mediator is registered with the given mediatorName. 113 | */ 114 | boolean hasMediator(String mediatorName); 115 | 116 | /** 117 | *

Notify Observers.

118 | * 119 | *

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

122 | * 123 | *

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

126 | * 127 | * @param notification the INotification to have the View notify Observers of. 128 | */ 129 | void notifyObservers(INotification notification); 130 | } 131 | -------------------------------------------------------------------------------- /src/main/java/org/puremvc/java/multicore/interfaces/IModel.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.interfaces; 9 | 10 | /** 11 | *

The interface definition for a PureMVC Model.

12 | * 13 | *

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

15 | * 16 | *

An IModel assumes these responsibilities:

17 | * 18 | *
    19 | *
  • Maintain a cache of IProxy instances
  • 20 | *
  • Provide methods for registering, retrieving, and removing IProxy instances
  • 21 | *
22 | */ 23 | public interface IModel { 24 | 25 | /** 26 | *

Register an IProxy instance with the Model.

27 | * 28 | * @param proxy an object reference to be held by the Model. 29 | */ 30 | void registerProxy(IProxy proxy); 31 | 32 | /** 33 | *

Retrieve an IProxy instance from the Model.

34 | * 35 | * @param proxyName proxy name 36 | * @return the IProxy instance previously registered with the given proxyName. 37 | */ 38 | IProxy retrieveProxy(String proxyName); 39 | 40 | /** 41 | *

Remove an IProxy instance from the Model.

42 | * 43 | * @param proxyName name of the IProxy instance to be removed. 44 | * @return the IProxy that was removed from the Model 45 | */ 46 | IProxy removeProxy(String proxyName); 47 | 48 | /** 49 | *

Check if a Proxy is registered

50 | * 51 | * @param proxyName proxy name 52 | * @return whether a Proxy is currently registered with the given proxyName. 53 | */ 54 | boolean hasProxy(String proxyName); 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/org/puremvc/java/multicore/interfaces/INotification.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.interfaces; 9 | 10 | /** 11 | *

The interface definition for a PureMVC Notification.

12 | * 13 | *

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

16 | * 17 | *

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

20 | * 21 | *

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

28 | * 29 | *

A key difference between Flash Events and PureMVC 30 | * Notifications is that Events follow the 31 | * 'Chain of Responsibility' pattern, 'bubbling' up the display hierarchy 32 | * until some parent component handles the Event, while 33 | * PureMVC Notifications follow a 'Publish/Subscribe' 34 | * pattern. PureMVC classes need not be related to each other in a 35 | * parent/child relationship in order to communicate with one another 36 | * using Notifications.

37 | * 38 | * @see IView IView 39 | * @see IObserver IObserver 40 | */ 41 | public interface INotification { 42 | 43 | /** 44 | *

Get the name of the INotification instance. 45 | * No setter, should be set by constructor only

46 | * 47 | * @return notification name 48 | */ 49 | String getName(); 50 | 51 | /** 52 | *

Set the body of the INotification instance

53 | * 54 | * @param body body 55 | */ 56 | void setBody(Object body); 57 | 58 | /** 59 | *

Get the body of the INotification instance

60 | * 61 | * @return body 62 | */ 63 | Object getBody(); 64 | 65 | /** 66 | *

Set the type of the INotification instance

67 | * 68 | * @param type notification type 69 | */ 70 | void setType(String type); 71 | 72 | /** 73 | *

Get the type of the INotification instance

74 | * 75 | * @return notification type 76 | */ 77 | String getType(); 78 | 79 | /** 80 | *

Get the string representation of the INotification instance

81 | */ 82 | String toString(); 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/main/java/org/puremvc/java/multicore/interfaces/INotifier.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.interfaces; 9 | 10 | /** 11 | *

The interface definition for a PureMVC Notifier.

12 | * 13 | *

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

15 | * 16 | *

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

19 | * 20 | *

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

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

Send a INotification.

34 | * 35 | *

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

37 | * 38 | * @param notificationName the name of the notification to send 39 | * @param body the body of the notification 40 | * @param type the type of the notification 41 | */ 42 | void sendNotification(String notificationName, Object body, String type); 43 | 44 | /** 45 | *

Send a INotification.

46 | * 47 | *

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

49 | * 50 | * @param notificationName the name of the notification to send 51 | * @param body the body of the notification 52 | */ 53 | void sendNotification(String notificationName, Object body); 54 | 55 | /** 56 | *

Send a INotification.

57 | * 58 | *

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

60 | * 61 | * @param notificationName the name of the notification to send 62 | */ 63 | void sendNotification(String notificationName); 64 | 65 | /** 66 | *

Initialize this INotifier instance.

67 | * 68 | *

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

72 | * 73 | * @param key the multitonKey for this INotifier to use 74 | */ 75 | void initializeNotifier(String key); 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/org/puremvc/java/multicore/interfaces/IObserver.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.interfaces; 9 | 10 | import java.util.function.Consumer; 11 | 12 | /** 13 | *

The interface definition for a PureMVC Observer.

14 | * 15 | *

In PureMVC, IObserver implementors assume these responsibilities:

16 | * 17 | *
    18 | *
  • Encapsulate the notification (callback) method of the interested object.
  • 19 | *
  • Encapsulate the notification context (this) of the interested object.
  • 20 | *
  • Provide methods for setting the interested object' notification method and context.
  • 21 | *
  • Provide a method for notifying the interested object.
  • 22 | *
23 | * 24 | *

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

28 | * 29 | *

The Observer Pattern as implemented within 30 | * PureMVC exists to support event driven communication 31 | * between the application and the actors of the 32 | * MVC triad.

33 | * 34 | *

An Observer is an object that encapsulates information 35 | * about an interested object with a notification method that 36 | * should be called when an INotification is broadcast. The Observer then 37 | * acts as a proxy for notifying the interested object.

38 | * 39 | *

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

43 | * 44 | * @see IView IView 45 | * @see org.puremvc.java.multicore.interfaces.INotification INotification 46 | */ 47 | public interface IObserver { 48 | 49 | /** 50 | *

Set the notification method.

51 | * 52 | *

The notification method should take one parameter of type INotification

53 | * 54 | * @param notifyMethod the notification consumer method of the interested object 55 | */ 56 | void setNotifyMethod(Consumer notifyMethod); 57 | 58 | /** 59 | *

Set the notification context.

60 | * 61 | * @param notifyContext the notification context (this) of the interested object 62 | */ 63 | void setNotifyContext(Object notifyContext); 64 | 65 | /** 66 | *

Notify the interested object.

67 | * 68 | * @param notification the INotification to pass to the interested object's notification method 69 | */ 70 | void notifyObserver(INotification notification); 71 | 72 | /** 73 | *

Compare the given object to the notificaiton context object.

74 | * 75 | * @param object the object to compare. 76 | * @return boolean indicating if the notification context and the object are the same. 77 | */ 78 | boolean compareNotifyContext(Object object); 79 | 80 | } 81 | 82 | -------------------------------------------------------------------------------- /src/main/java/org/puremvc/java/multicore/interfaces/IProxy.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.interfaces; 9 | 10 | /** 11 | *

The interface definition for a PureMVC Proxy.

12 | * 13 | *

In PureMVC, IProxy implementors assume these responsibilities:

14 | * 15 | *
    16 | *
  • Implement a common method which returns the name of the Proxy.
  • 17 | *
  • Provide methods for setting and getting the data object.
  • 18 | *
19 | * 20 | *

Additionally, IProxys typically:

21 | * 22 | *
    23 | *
  • Maintain references to one or more pieces of model data.
  • 24 | *
  • Provide methods for manipulating that data.
  • 25 | *
  • Generate INotifications when their model data changes.
  • 26 | *
  • Expose their name as a public static const called NAME, if they are not instantiated multiple times.
  • 27 | *
  • Encapsulate interaction with local or remote services used to fetch and persist model data.
  • 28 | *
29 | */ 30 | public interface IProxy extends INotifier { 31 | 32 | /** 33 | *

Get the Proxy name

34 | * 35 | * @return the Proxy instance name 36 | */ 37 | String getProxyName(); 38 | 39 | /** 40 | *

Set the data object

41 | * 42 | * @param data the data object 43 | */ 44 | void setData(Object data); 45 | 46 | /** 47 | *

Get the data object

48 | * 49 | * @return the data as type Object 50 | */ 51 | Object getData(); 52 | 53 | /** 54 | *

Called by the Model when the Proxy is registered

55 | */ 56 | void onRegister(); 57 | 58 | /** 59 | *

Called by the Model when the Proxy is removed

60 | */ 61 | void onRemove(); 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/org/puremvc/java/multicore/interfaces/IView.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.interfaces; 9 | 10 | /** 11 | *

The interface definition for a PureMVC View.

12 | * 13 | *

In PureMVC, IView implementors assume these responsibilities:

14 | * 15 | *

In PureMVC, the View class assumes these responsibilities:

16 | * 17 | *
    18 | *
  • Maintain a cache of IMediator instances.
  • 19 | *
  • Provide methods for registering, retrieving, and removing IMediators.
  • 20 | *
  • Managing the observer lists for each INotification in the application.
  • 21 | *
  • Providing a method for attaching IObservers to an INotification's observer list.
  • 22 | *
  • Providing a method for broadcasting an INotification.
  • 23 | *
  • Notifying the IObservers of a given INotification when it broadcast.
  • 24 | *
25 | * 26 | * @see org.puremvc.java.multicore.interfaces.IMediator IMediator 27 | * @see org.puremvc.java.multicore.interfaces.IObserver IObserver 28 | * @see org.puremvc.java.multicore.interfaces.INotification INotification 29 | */ 30 | public interface IView { 31 | 32 | /** 33 | *

Register an IObserver to be notified 34 | * of INotifications with a given name.

35 | * 36 | * @param notificationName the name of the INotifications to notify this IObserver of 37 | * @param observer the IObserver to register 38 | */ 39 | void registerObserver(String notificationName, IObserver observer); 40 | 41 | /** 42 | *

Remove a group of observers from the observer list for a given Notification name.

43 | * 44 | * @param notificationName which observer list to remove from 45 | * @param notifyContext removed the observers with this object as their notifyContext 46 | */ 47 | void removeObserver(String notificationName, Object notifyContext); 48 | 49 | /** 50 | *

Notify the IObservers for a particular INotification.

51 | * 52 | *

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

55 | * 56 | * @param notification the INotification to notify IObservers of. 57 | */ 58 | void notifyObservers(INotification notification); 59 | 60 | /** 61 | *

Register an IMediator instance with the View.

62 | * 63 | *

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

66 | * 67 | *

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

72 | * 73 | * @param mediator a reference to the IMediator instance 74 | */ 75 | void registerMediator(IMediator mediator); 76 | 77 | /** 78 | *

Retrieve an IMediator from the View.

79 | * 80 | * @param mediatorName the name of the IMediator instance to retrieve. 81 | * @return the IMediator instance previously registered with the given mediatorName. 82 | */ 83 | IMediator retrieveMediator(String mediatorName); 84 | 85 | /** 86 | *

Remove an IMediator from the View.

87 | * 88 | * @param mediatorName name of the IMediator instance to be removed. 89 | * @return the IMediator that was removed from the View 90 | */ 91 | IMediator removeMediator(String mediatorName); 92 | 93 | /** 94 | *

Check if a Mediator is registered or not

95 | * 96 | * @param mediatorName mediator name 97 | * @return whether a Mediator is registered with the given mediatorName. 98 | */ 99 | boolean hasMediator(String mediatorName); 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/org/puremvc/java/multicore/patterns/command/MacroCommand.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.command; 9 | 10 | import org.puremvc.java.multicore.interfaces.ICommand; 11 | import org.puremvc.java.multicore.interfaces.INotification; 12 | import org.puremvc.java.multicore.patterns.observer.Notifier; 13 | 14 | import java.util.Vector; 15 | import java.util.function.Supplier; 16 | 17 | /** 18 | *

A base ICommand implementation that executes other ICommands.

19 | * 20 | *

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

22 | * 23 | *

When execute is called, the MacroCommand 24 | * instantiates and calls execute on each of its SubCommands turn. 25 | * Each SubCommand will be passed a reference to the original 26 | * INotification that was passed to the MacroCommand's 27 | * execute method.

28 | * 29 | *

Unlike SimpleCommand, your subclass 30 | * should not override execute, but instead, should 31 | * override the initializeMacroCommand method, 32 | * calling addSubCommand once for each SubCommand 33 | * to be executed.

34 | * 35 | * @see org.puremvc.java.multicore.core.Controller Controller 36 | * @see org.puremvc.java.multicore.patterns.observer.Notification Notification 37 | * @see org.puremvc.java.multicore.patterns.command.SimpleCommand SimpleCommand 38 | */ 39 | public class MacroCommand extends Notifier implements ICommand { 40 | 41 | private Vector> subCommands; 42 | 43 | /** 44 | *

Constructor.

45 | * 46 | *

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

49 | * 50 | *

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

52 | */ 53 | public MacroCommand() { 54 | subCommands = new Vector>(); 55 | initializeMacroCommand(); 56 | } 57 | 58 | /** 59 | *

Initialize the MacroCommand.

60 | * 61 | *

In your subclass, override this method to 62 | * initialize the MacroCommand's SubCommand 63 | * list with ICommand class references like 64 | * this:

65 | * 66 | *
 67 |      * {@code // Initialize MyMacroCommand
 68 |      * protected void initializeMacroCommand( )
 69 |      * {
 70 |      *      addSubCommand( () -> new com.me.myapp.controller.FirstCommand() );
 71 |      *      addSubCommand( () -> new com.me.myapp.controller.SecondCommand() );
 72 |      *      addSubCommand( () -> new com.me.myapp.controller.ThirdCommand() );
 73 |      * }
 74 |      * }
 75 |      * 
76 | * 77 | *

Note that SubCommands may be any ICommand implementor, 78 | * MacroCommands or SimpleCommands are both acceptable.

79 | */ 80 | protected void initializeMacroCommand() { 81 | } 82 | 83 | /** 84 | *

Add a SubCommand.

85 | * 86 | *

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

88 | * 89 | * @param factory a reference to the factory of the ICommand. 90 | */ 91 | protected void addSubCommand(Supplier factory) { 92 | subCommands.add(factory); 93 | } 94 | 95 | /** 96 | *

Execute this MacroCommand's SubCommands.

97 | * 98 | *

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

100 | * 101 | * @param notification the INotification object to be passsed to each SubCommand. 102 | */ 103 | public void execute(INotification notification) { 104 | while(!subCommands.isEmpty()) { 105 | ICommand command = subCommands.remove(0).get(); 106 | command.initializeNotifier(multitonKey); 107 | command.execute(notification); 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /src/main/java/org/puremvc/java/multicore/patterns/command/SimpleCommand.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.command; 9 | 10 | import org.puremvc.java.multicore.interfaces.ICommand; 11 | import org.puremvc.java.multicore.interfaces.INotification; 12 | import org.puremvc.java.multicore.patterns.observer.Notifier; 13 | 14 | /** 15 | *

A base ICommand implementation.

16 | * 17 | *

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

19 | * 20 | * @see org.puremvc.java.multicore.core.Controller Controller 21 | * @see org.puremvc.java.multicore.patterns.observer.Notification Notification 22 | * @see MacroCommand MacroCommand 23 | */ 24 | public class SimpleCommand extends Notifier implements ICommand { 25 | 26 | /** 27 | *

Fulfill the use-case initiated by the given INotification.

28 | * 29 | *

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

33 | * 34 | * @param notification the INotification to handle. 35 | */ 36 | public void execute(INotification notification) { 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/puremvc/java/multicore/patterns/mediator/Mediator.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.mediator; 9 | 10 | import org.puremvc.java.multicore.interfaces.IMediator; 11 | import org.puremvc.java.multicore.interfaces.INotification; 12 | import org.puremvc.java.multicore.patterns.observer.Notifier; 13 | 14 | /** 15 | *

A base IMediator implementation.

16 | * 17 | * @see org.puremvc.java.multicore.core.View View 18 | */ 19 | public class Mediator extends Notifier implements IMediator { 20 | 21 | /** 22 | *

The name of the Mediator.

23 | * 24 | *

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

27 | */ 28 | public static final String NAME = "Mediator"; 29 | 30 | // the mediator name 31 | protected String mediatorName; 32 | 33 | // The view component 34 | protected Object viewComponent; 35 | 36 | /** 37 | *

Constructor.

38 | * 39 | * @param mediatorName mediator name 40 | * @param viewComponent view component 41 | */ 42 | public Mediator(String mediatorName, Object viewComponent) { 43 | this.mediatorName = mediatorName != null ? mediatorName : NAME; 44 | this.viewComponent = viewComponent; 45 | } 46 | 47 | /** 48 | *

Constructor.

49 | * 50 | * @param mediatorName mediator name 51 | */ 52 | public Mediator(String mediatorName) { 53 | this(mediatorName, null); 54 | } 55 | 56 | /** 57 | *

Constructor.

58 | */ 59 | public Mediator() { 60 | this(null, null); 61 | } 62 | 63 | /** 64 | *

List the INotification names this 65 | * Mediator is interested in being notified of.

66 | * 67 | * @return Array the list of INotification names 68 | */ 69 | public String[] listNotificationInterests() { 70 | return new String[0]; 71 | } 72 | 73 | /** 74 | *

Handle INotifications.

75 | * 76 | *

Typically this will be handled in a switch statement, 77 | * with one 'case' entry per INotification 78 | * the Mediator is interested in.

79 | */ 80 | public void handleNotification(INotification notification) { 81 | 82 | } 83 | 84 | /** 85 | *

Called by the View when the Mediator is registered

86 | */ 87 | public void onRegister() { 88 | 89 | } 90 | 91 | /** 92 | *

Called by the View when the Mediator is removed

93 | */ 94 | public void onRemove() { 95 | 96 | } 97 | 98 | /** 99 | *

Get the name of the Mediator.

100 | * 101 | * @return the Mediator name 102 | */ 103 | public String getMediatorName() { 104 | return mediatorName; 105 | } 106 | 107 | /** 108 | *

Get the Mediator's view component.

109 | * 110 | *

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

113 | * 114 | * {@code 115 | * public javax.swing.JComboBox getViewComponent() 116 | * { 117 | * return viewComponent; 118 | * } 119 | *} 120 | * 121 | * @return the view component 122 | */ 123 | public Object getViewComponent() { 124 | return viewComponent; 125 | } 126 | 127 | /** 128 | *

Set the IMediator's view component.

129 | * 130 | * @param viewComponent the view component 131 | */ 132 | public void setViewComponent(Object viewComponent) { 133 | this.viewComponent = viewComponent; 134 | } 135 | 136 | } 137 | -------------------------------------------------------------------------------- /src/main/java/org/puremvc/java/multicore/patterns/observer/Notification.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.observer; 9 | 10 | import org.puremvc.java.multicore.interfaces.INotification; 11 | 12 | /** 13 | *

A base INotification implementation.

14 | * 15 | *

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

18 | * 19 | *

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

22 | * 23 | *

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

30 | * 31 | *

A key difference between Flash Events and PureMVC 32 | * Notifications is that Events follow the 33 | * 'Chain of Responsibility' pattern, 'bubbling' up the display hierarchy 34 | * until some parent component handles the Event, while 35 | * PureMVC Notifications follow a 'Publish/Subscribe' 36 | * pattern. PureMVC classes need not be related to each other in a 37 | * parent/child relationship in order to communicate with one another 38 | * using Notifications.

39 | * 40 | * @see Observer Observer 41 | * 42 | */ 43 | public class Notification implements INotification { 44 | 45 | // the name of the notification instance 46 | private String name; 47 | 48 | // the type of the notification instance 49 | private String type; 50 | 51 | // the body of the notification instance 52 | private Object body; 53 | 54 | /** 55 | *

Constructor.

56 | * 57 | * @param name name of the Notification instance. (required) 58 | * @param body the Notification body. 59 | * @param type the type of the Notification 60 | */ 61 | public Notification(String name, Object body, String type) { 62 | this.name = name; 63 | this.body = body; 64 | this.type = type; 65 | } 66 | 67 | /** 68 | *

Constructor.

69 | * 70 | * @param name name of the Notification instance. (required) 71 | * @param body the Notification body. 72 | */ 73 | public Notification(String name, Object body) { 74 | this(name, body, null); 75 | } 76 | 77 | /** 78 | *

Constructor.

79 | * 80 | * @param name name of the Notification instance. (required) 81 | */ 82 | public Notification(String name) { 83 | this(name, null, null); 84 | } 85 | 86 | /** 87 | *

Get the name of the Notification instance.

88 | * 89 | * @return the name of the Notification instance. 90 | */ 91 | public String getName() { 92 | return name; 93 | } 94 | 95 | /** 96 | *

Set the body of the Notification instance.

97 | */ 98 | public void setBody(Object body) { 99 | this.body = body; 100 | } 101 | 102 | /** 103 | *

Get the body of the Notification instance.

104 | * 105 | * @return the body object. 106 | */ 107 | public Object getBody() { 108 | return body; 109 | } 110 | 111 | /** 112 | *

Set the type of the Notification instance.

113 | */ 114 | public void setType(String type) { 115 | this.type = type; 116 | } 117 | 118 | /** 119 | *

Get the type of the Notification instance.

120 | * 121 | * @return the type 122 | */ 123 | public String getType() { 124 | return type; 125 | } 126 | 127 | /** 128 | *

Get the string representation of the Notification instance.

129 | * 130 | * @return the string representation of the Notification instance. 131 | */ 132 | public String toString() { 133 | return new StringBuilder("Notification Name: " + getName()) 134 | .append("\nBody:" + ((body == null) ? "null" : body.toString())) 135 | .append("\nType:" + ((type == null) ? "null" : type)) 136 | .toString(); 137 | } 138 | 139 | } 140 | -------------------------------------------------------------------------------- /src/main/java/org/puremvc/java/multicore/patterns/observer/Notifier.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.observer; 9 | 10 | import org.puremvc.java.multicore.interfaces.IFacade; 11 | import org.puremvc.java.multicore.interfaces.INotifier; 12 | import org.puremvc.java.multicore.patterns.facade.Facade; 13 | 14 | /** 15 | *

A Base INotifier implementation.

16 | * 17 | *

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

19 | * 20 | *

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

23 | * 24 | *

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

30 | * 31 | *

NOTE: In the MultiCore version of the framework, there is one caveat to 32 | * notifiers, they cannot send notifications or reach the facade until they 33 | * have a valid multitonKey.

34 | * 35 | *

The multitonKey is set: 36 | * * on a Command when it is executed by the Controller 37 | * * on a Mediator is registered with the View 38 | * * on a Proxy is registered with the Model.

39 | * 40 | * @see org.puremvc.java.multicore.patterns.proxy.Proxy Proxy 41 | * @see Facade Facade 42 | * @see org.puremvc.java.multicore.patterns.mediator.Mediator Mediator 43 | * @see org.puremvc.java.multicore.patterns.command.MacroCommand MacroCommand 44 | * @see org.puremvc.java.multicore.patterns.command.SimpleCommand SimpleCommand 45 | */ 46 | public class Notifier implements INotifier { 47 | 48 | protected String multitonKey; 49 | 50 | protected final String MULTITON_MSG = "multitonKey for this Notifier not yet initialized!"; 51 | 52 | protected IFacade getFacade() { 53 | if(multitonKey == null) throw new RuntimeException(MULTITON_MSG); 54 | return Facade.getInstance(multitonKey, key -> new Facade(key)); 55 | } 56 | 57 | /** 58 | *

Create and send an INotification.

59 | * 60 | *

Keeps us from having to construct new INotification 61 | * instances in our implementation code.

62 | * 63 | * @param notificationName the name of the notiification to send 64 | * @param body the body of the notification 65 | * @param type the type of the notification 66 | */ 67 | public void sendNotification(String notificationName, Object body, String type) { 68 | getFacade().sendNotification(notificationName, body, type); 69 | } 70 | 71 | /** 72 | *

Create and send an INotification.

73 | * 74 | *

Keeps us from having to construct new INotification 75 | * instances in our implementation code.

76 | * 77 | * @param notificationName the name of the notiification to send 78 | * @param body the body of the notification 79 | */ 80 | public void sendNotification(String notificationName, Object body) { 81 | getFacade().sendNotification(notificationName, body); 82 | } 83 | 84 | /** 85 | *

Create and send an INotification.

86 | * 87 | *

Keeps us from having to construct new INotification 88 | * instances in our implementation code.

89 | * 90 | * @param notificationName the name of the notiification to send 91 | */ 92 | public void sendNotification(String notificationName) { 93 | getFacade().sendNotification(notificationName); 94 | } 95 | 96 | /** 97 | *

Initialize this INotifier instance.

98 | * 99 | *

This is how a Notifier gets its multitonKey. 100 | * Calls to sendNotification or to access the 101 | * facade will fail until after this method 102 | * has been called.

103 | * 104 | *

Mediators, Commands or Proxies may override 105 | * this method in order to send notifications 106 | * or access the Multiton Facade instance as 107 | * soon as possible. They CANNOT access the facade 108 | * in their constructors, since this method will not 109 | * yet have been called.

110 | * 111 | * @param key the multitonKey for this INotifier to use 112 | */ 113 | public void initializeNotifier(String key) { 114 | multitonKey = key; 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /src/main/java/org/puremvc/java/multicore/patterns/observer/Observer.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.observer; 9 | 10 | import org.puremvc.java.multicore.interfaces.INotification; 11 | import org.puremvc.java.multicore.interfaces.IObserver; 12 | 13 | import java.util.function.Consumer; 14 | 15 | /** 16 | *

A base IObserver implementation.

17 | * 18 | *

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

21 | * 22 | *

In PureMVC, the Observer class assumes these responsibilities:

23 | * 24 | *
    25 | *
  • Encapsulate the notification (callback) method of the interested object.
  • 26 | *
  • Encapsulate the notification context (this) of the interested object.
  • 27 | *
  • Provide methods for setting the notification method and context.
  • 28 | *
  • Provide a method for notifying the interested object.
  • 29 | *
30 | * 31 | * @see org.puremvc.java.multicore.core.View View 32 | * @see org.puremvc.java.multicore.patterns.observer.Notification Notification 33 | */ 34 | public class Observer implements IObserver { 35 | 36 | private Object context; 37 | private Consumer notify; 38 | 39 | /** 40 | *

Constructor.

41 | * 42 | *

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

44 | * 45 | * @param notifyMethod the notification method of the interested object 46 | * @param notifyContext the notification context of the interested object 47 | */ 48 | public Observer(Consumer notifyMethod, Object notifyContext) { 49 | setNotifyMethod(notifyMethod); 50 | setNotifyContext(notifyContext); 51 | } 52 | 53 | /** 54 | *

Compare an object to the notification context.

55 | * 56 | * @param object the object to compare 57 | * @return boolean indicating if the object and the notification context are the same 58 | */ 59 | public boolean compareNotifyContext(Object object) { 60 | return object == this.context; 61 | } 62 | 63 | /** 64 | *

Notify the interested object.

65 | * 66 | * @param notification the INotification to pass to the interested object's notification method. 67 | */ 68 | public void notifyObserver(INotification notification) { 69 | notify.accept(notification); 70 | } 71 | 72 | /** 73 | *

Get the notification context.

74 | * 75 | * @return the notification context (this) of the interested object. 76 | */ 77 | protected Object getNotifyContext() { 78 | return context; 79 | } 80 | 81 | /** 82 | *

Set the notification context.

83 | * 84 | * @param notifyContext the notification context (this) of the interested object. 85 | */ 86 | public void setNotifyContext(Object notifyContext) { 87 | this.context = notifyContext; 88 | } 89 | 90 | /** 91 | *

Get the notification method.

92 | * 93 | * @return the notification consumer of the interested object. 94 | */ 95 | protected Consumer getNotifyMethod() { 96 | return notify; 97 | } 98 | 99 | /** 100 | *

Set the notification method.

101 | * 102 | *

The notification method should take one parameter of type INotification.

103 | * 104 | * @param notify the notification (callback) method of the interested object. 105 | */ 106 | public void setNotifyMethod(Consumer notify) { 107 | this.notify = notify; 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /src/main/java/org/puremvc/java/multicore/patterns/proxy/Proxy.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.proxy; 9 | 10 | import org.puremvc.java.multicore.interfaces.IProxy; 11 | import org.puremvc.java.multicore.patterns.observer.Notifier; 12 | 13 | /** 14 | *

A base IProxy implementation.

15 | * 16 | *

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

18 | * 19 | *

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

22 | * 23 | *

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

28 | * 29 | * @see org.puremvc.java.multicore.core.Model Model 30 | */ 31 | public class Proxy extends Notifier implements IProxy { 32 | 33 | public static final String NAME = "Proxy"; 34 | 35 | protected String proxyName; 36 | 37 | protected Object data; 38 | 39 | /** 40 | *

Constructor.

41 | * 42 | * @param proxyName proxy name 43 | * @param data data 44 | */ 45 | public Proxy(String proxyName, Object data) { 46 | this.proxyName = (proxyName != null) ? proxyName : NAME; 47 | if(data != null) setData(data); 48 | } 49 | 50 | /** 51 | *

Constructor.

52 | * 53 | * @param proxyName proxy name 54 | */ 55 | public Proxy(String proxyName) { 56 | this(proxyName, null); 57 | } 58 | 59 | /** 60 | *

Constructor.

61 | */ 62 | public Proxy(){ 63 | this(null, null); 64 | } 65 | 66 | /** 67 | *

Called by the Model when the Proxy is registered

68 | */ 69 | public void onRegister() { 70 | 71 | } 72 | 73 | /** 74 | *

Called by the Model when the Proxy is removed

75 | */ 76 | public void onRemove() { 77 | 78 | } 79 | 80 | /** 81 | *

Get the proxy name

82 | */ 83 | public String getProxyName() { 84 | return proxyName; 85 | } 86 | 87 | /** 88 | *

Get the data object

89 | */ 90 | public Object getData() { 91 | return data; 92 | } 93 | 94 | /** 95 | *

Set the data object

96 | */ 97 | public void setData(Object data) { 98 | this.data = data; 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/core/ControllerTestCommand.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.core; 9 | 10 | import org.puremvc.java.multicore.interfaces.INotification; 11 | import org.puremvc.java.multicore.patterns.command.SimpleCommand; 12 | 13 | /** 14 | * A SimpleCommand subclass used by ControllerTest. 15 | * 16 | * @see ControllerTest ControllerTest 17 | * @see ControllerTestVO ControllerTestVO 18 | */ 19 | public class ControllerTestCommand extends SimpleCommand { 20 | 21 | /** 22 | * Fabricate a result by multiplying the input by 2 23 | * 24 | * @param notification the note carrying the ControllerTestVO 25 | */ 26 | public void execute(INotification notification) { 27 | ControllerTestVO vo = (ControllerTestVO)notification.getBody(); 28 | 29 | // Fabricate a result 30 | vo.result = 2 * vo.input; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/core/ControllerTestCommand2.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.core; 9 | 10 | import org.puremvc.java.multicore.interfaces.INotification; 11 | import org.puremvc.java.multicore.patterns.command.SimpleCommand; 12 | 13 | public class ControllerTestCommand2 extends SimpleCommand { 14 | 15 | /** 16 | * Fabricate a result by multiplying the input by 2 and adding to the existing result 17 | * 18 | *

This tests accumulation effect that would show if the command were executed more than once.

19 | * 20 | * @param notification the note carrying the ControllerTestVO 21 | */ 22 | public void execute(INotification notification) { 23 | ControllerTestVO vo = (ControllerTestVO)notification.getBody(); 24 | 25 | // Fabricate a result 26 | vo.result = vo.result + (2 * vo.input); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/core/ControllerTestVO.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.core; 9 | 10 | /** 11 | * A utility class used by ControllerTest. 12 | * 13 | * @see ControllerTest ControllerTest 14 | * @see org.puremvc.java.multicore.core.ControllerTestCommand ControllerTestCommand 15 | */ 16 | public class ControllerTestVO { 17 | 18 | int input = 0; 19 | int result = 0; 20 | 21 | ControllerTestVO(int input) { 22 | this.input = input; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/core/ModelTest.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.core; 9 | 10 | import org.junit.jupiter.api.Assertions; 11 | import org.junit.jupiter.api.Test; 12 | import org.puremvc.java.multicore.interfaces.IModel; 13 | import org.puremvc.java.multicore.interfaces.IProxy; 14 | import org.puremvc.java.multicore.patterns.proxy.Proxy; 15 | 16 | /** 17 | * Test the PureMVC Model class. 18 | */ 19 | public class ModelTest { 20 | 21 | /** 22 | * Tests the Model Multiton Factory Method 23 | */ 24 | public void testGetInstance() { 25 | // Test Factory Method 26 | IModel model = Model.getInstance("ModelTestKey1", key -> new Model(key)); 27 | 28 | // test assertions 29 | Assertions.assertNotNull(model, "Expecting instance not null"); 30 | Assertions.assertNotNull((IModel) model, "Expecting instance implements IModel"); 31 | } 32 | 33 | /** 34 | * Tests the proxy registration and retrieval methods. 35 | * 36 | *

Tests registerProxy and retrieveProxy in the same test. 37 | * These methods cannot currently be tested separately 38 | * in any meaningful way other than to show that the 39 | * methods do not throw exception when called.

40 | */ 41 | public void testRegisterAndRetrieveProxy() { 42 | // register a proxy and retrieve it. 43 | IModel model = Model.getInstance("ModelTestKey2", key -> new Model(key)); 44 | model.registerProxy(new Proxy("colors", new String[]{"red", "green", "blue"})); 45 | IProxy proxy = model.retrieveProxy("colors"); 46 | String[] data = (String[]) proxy.getData(); 47 | 48 | // test assertions 49 | Assertions.assertNotNull(data, "Expecting data not null"); 50 | Assertions.assertNotNull((String[])data, "Expecting data type is Array"); 51 | Assertions.assertTrue(data.length == 3, "Expecting data.length == 3"); 52 | Assertions.assertTrue(data[0] == "red", "Expecting data[0] == 'red'"); 53 | Assertions.assertTrue(data[1] == "green", "Expecting data[1] == 'green'"); 54 | Assertions.assertTrue(data[2] == "blue", "Expecting data[2] == 'blue'"); 55 | } 56 | 57 | /** 58 | * Tests the proxy removal method. 59 | */ 60 | @Test 61 | public void testRegisterAndRemoveProxy() { 62 | // register a proxy, remove it, then try to retrieve it 63 | IModel model = Model.getInstance("ModelTestKey4", key -> new Model(key)); 64 | IProxy proxy = new Proxy("sizes", new String[]{"7", "13", "21"}); 65 | model.registerProxy(proxy); 66 | 67 | // remove the proxy 68 | IProxy removedProxy = model.removeProxy("sizes"); 69 | 70 | // assert that we removed the appropriate proxy 71 | Assertions.assertTrue(removedProxy.getProxyName() == "sizes", "Expecting removedProxy.getProxyName() == 'sizes'"); 72 | 73 | // ensure that the proxy is no longer retrievable from the model 74 | proxy = model.retrieveProxy("sizes"); 75 | 76 | // test assertions 77 | Assertions.assertNull(proxy, "Expecting proxy is null"); 78 | } 79 | 80 | /** 81 | * Tests the hasProxy Method 82 | */ 83 | @Test 84 | public void testHasProxy() { 85 | // register a proxy 86 | IModel model = Model.getInstance("ModelTestKey4", key -> new Model(key)); 87 | IProxy proxy = new Proxy("aces", new String[]{"clubs", "spades", "hearts", "diamonds"}); 88 | model.registerProxy(proxy); 89 | 90 | // assert that the model.hasProxy method returns true 91 | // for that proxy name 92 | Assertions.assertTrue(model.hasProxy("aces") == true, "Expecting model.hasProxy('aces') == true"); 93 | 94 | // remove the proxy 95 | model.removeProxy("aces"); 96 | 97 | // assert that the model.hasProxy method returns false 98 | // for that proxy name 99 | Assertions.assertTrue(model.hasProxy("aces") == false, "Expecting model.hasProxy('aces') == false"); 100 | } 101 | 102 | /** 103 | * Tests that the Model calls the onRegister and onRemove methods 104 | */ 105 | @Test 106 | public void testOnRegisterAndOnRemove() { 107 | // Get a Multiton View instance 108 | IModel model = Model.getInstance("ModelTestKey4", key -> new Model(key)); 109 | 110 | // Create and register the test mediator 111 | IProxy proxy = new ModelTestProxy(); 112 | model.registerProxy(proxy); 113 | 114 | // assert that onRegsiter was called, and the proxy responded by setting its data accordingly 115 | Assertions.assertTrue(proxy.getData() == ModelTestProxy.ON_REGISTER_CALLED, "Expecting proxy.getData() == ModelTestProxy.ON_REGISTER_CALLED"); 116 | 117 | // Remove the component 118 | model.removeProxy(ModelTestProxy.NAME); 119 | 120 | // assert that onRemove was called, and the proxy responded by setting its data accordingly 121 | Assertions.assertTrue(proxy.getData() == ModelTestProxy.ON_REMOVE_CALLED, "Expecting proxy.getData() == ModelTestProxy.ON_REMOVE_CALLED"); 122 | } 123 | 124 | } 125 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/core/ModelTestProxy.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.core; 9 | 10 | import org.puremvc.java.multicore.patterns.proxy.Proxy; 11 | 12 | public class ModelTestProxy extends Proxy { 13 | 14 | public static final String NAME = "ModelTestProxy"; 15 | public static final String ON_REGISTER_CALLED = "onRegister Called"; 16 | public static final String ON_REMOVE_CALLED = "onRemove Called"; 17 | 18 | public ModelTestProxy() { 19 | super(NAME, ""); 20 | } 21 | 22 | @Override 23 | public void onRegister() { 24 | setData(ON_REGISTER_CALLED); 25 | } 26 | 27 | public void onRemove() { 28 | setData(ON_REMOVE_CALLED); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/core/ViewTestMediator.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.core; 9 | 10 | import org.puremvc.java.multicore.interfaces.IMediator; 11 | import org.puremvc.java.multicore.patterns.mediator.Mediator; 12 | 13 | /** 14 | * A Mediator class used by ViewTest. 15 | * 16 | * @see ViewTest ViewTest 17 | */ 18 | public class ViewTestMediator extends Mediator implements IMediator { 19 | 20 | /** 21 | * The Mediator name 22 | */ 23 | public static final String NAME = "ViewTestMediator"; 24 | 25 | /** 26 | * Constructor 27 | */ 28 | public ViewTestMediator(Object view) { 29 | super (NAME, view); 30 | } 31 | 32 | public String[] listNotificationInterests() { 33 | // be sure that the mediator has some Observers created 34 | // in order to test removeMediator 35 | return new String[] { "ABC", "DEF", "GHI"}; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/core/ViewTestMediator2.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.core; 9 | 10 | import org.puremvc.java.multicore.interfaces.IMediator; 11 | import org.puremvc.java.multicore.interfaces.INotification; 12 | import org.puremvc.java.multicore.patterns.mediator.Mediator; 13 | 14 | /** 15 | * A Mediator class used by ViewTest. 16 | * 17 | * @see ViewTest ViewTest 18 | */ 19 | public class ViewTestMediator2 extends Mediator implements IMediator { 20 | 21 | /** 22 | * The Mediator name 23 | */ 24 | public static final String NAME = "ViewTestMediator2"; 25 | 26 | /** 27 | * Constructor 28 | */ 29 | public ViewTestMediator2(Object view) { 30 | super(NAME, view); 31 | } 32 | 33 | public String[] listNotificationInterests() { 34 | // be sure that the mediator has some Observers created 35 | // in order to test removeMediator 36 | return new String[] {ViewTest.NOTE1, ViewTest.NOTE2}; 37 | } 38 | 39 | public void handleNotification(INotification notification) { 40 | getViewTest().lastNotification = notification.getName(); 41 | } 42 | 43 | public ViewTest getViewTest() { 44 | return (ViewTest) viewComponent; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/core/ViewTestMediator3.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.core; 9 | 10 | import org.puremvc.java.multicore.interfaces.IMediator; 11 | import org.puremvc.java.multicore.interfaces.INotification; 12 | import org.puremvc.java.multicore.patterns.mediator.Mediator; 13 | 14 | /** 15 | * A Mediator class used by ViewTest. 16 | * 17 | * @see ViewTest ViewTest 18 | */ 19 | public class ViewTestMediator3 extends Mediator implements IMediator { 20 | 21 | /** 22 | * The Mediator name 23 | */ 24 | public static final String NAME = "ViewTestMediator3"; 25 | 26 | /** 27 | * Constructor 28 | */ 29 | public ViewTestMediator3(Object view) { 30 | super(NAME, view); 31 | } 32 | 33 | @Override 34 | public String[] listNotificationInterests() { 35 | // be sure that the mediator has some Observers created 36 | // in order to test removeMediator 37 | return new String[] {ViewTest.NOTE3}; 38 | } 39 | 40 | @Override 41 | public void handleNotification(INotification notification) { 42 | getViewTest().lastNotification = notification.getName(); 43 | } 44 | 45 | public ViewTest getViewTest() { 46 | return (ViewTest) viewComponent; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/core/ViewTestMediator4.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.core; 9 | 10 | import org.puremvc.java.multicore.interfaces.IMediator; 11 | import org.puremvc.java.multicore.patterns.mediator.Mediator; 12 | 13 | /** 14 | * A Mediator class used by ViewTest. 15 | * 16 | * @see ViewTest ViewTest 17 | */ 18 | public class ViewTestMediator4 extends Mediator implements IMediator { 19 | 20 | /** 21 | * The Mediator name 22 | */ 23 | public static final String NAME = "ViewTestMediator4"; 24 | 25 | /** 26 | * Constructor 27 | */ 28 | public ViewTestMediator4(Object view) { 29 | super(NAME, view); 30 | } 31 | 32 | public ViewTest getViewTest() { 33 | return (ViewTest) viewComponent; 34 | } 35 | 36 | @Override 37 | public void onRegister() { 38 | getViewTest().onRegisterCalled = true; 39 | } 40 | 41 | @Override 42 | public void onRemove() { 43 | getViewTest().onRemoveCalled = true; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/core/ViewTestMediator5.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.core; 9 | 10 | import org.puremvc.java.multicore.interfaces.IMediator; 11 | import org.puremvc.java.multicore.interfaces.INotification; 12 | import org.puremvc.java.multicore.patterns.mediator.Mediator; 13 | 14 | /** 15 | * A Mediator class used by ViewTest. 16 | * 17 | * @see ViewTest ViewTest 18 | */ 19 | public class ViewTestMediator5 extends Mediator implements IMediator { 20 | 21 | /** 22 | * The Mediator name 23 | */ 24 | public static final String NAME = "ViewTestMediator5"; 25 | 26 | /** 27 | * Constructor 28 | */ 29 | public ViewTestMediator5(Object view) { 30 | super(NAME, view); 31 | } 32 | 33 | public String[] listNotificationInterests() { 34 | return new String[] {ViewTest.NOTE5}; 35 | } 36 | 37 | public void handleNotification(INotification notification) { 38 | getViewTest().counter++; 39 | } 40 | 41 | public ViewTest getViewTest() { 42 | return (ViewTest) viewComponent; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/core/ViewTestMediator6.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.core; 9 | 10 | import org.puremvc.java.multicore.interfaces.INotification; 11 | import org.puremvc.java.multicore.patterns.mediator.Mediator; 12 | 13 | /** 14 | * A Mediator class used by ViewTest. 15 | * 16 | * @see ViewTest ViewTest 17 | */ 18 | public class ViewTestMediator6 extends Mediator { 19 | 20 | /** 21 | * The Mediator base name 22 | */ 23 | public static final String NAME = "ViewTestMediator6"; 24 | 25 | /** 26 | * Constructor 27 | */ 28 | public ViewTestMediator6(String name, Object view) { 29 | super(name, view); 30 | } 31 | 32 | @Override 33 | public String[] listNotificationInterests() { 34 | return new String[]{ViewTest.NOTE6}; 35 | } 36 | 37 | @Override 38 | public void handleNotification(INotification notification) { 39 | getFacade().removeMediator(getMediatorName()); 40 | } 41 | 42 | @Override 43 | public void onRemove() { 44 | viewTest().counter++; 45 | } 46 | 47 | public ViewTest viewTest() { 48 | return (ViewTest)viewComponent; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/core/ViewTestNote.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.core; 9 | 10 | import org.puremvc.java.multicore.interfaces.INotification; 11 | import org.puremvc.java.multicore.patterns.observer.Notification; 12 | 13 | /** 14 | * A Notification class used by ViewTest. 15 | * 16 | * @see ViewTest ViewTest 17 | */ 18 | public class ViewTestNote extends Notification implements INotification { 19 | 20 | /** 21 | * The name of this Notification. 22 | */ 23 | public static final String NAME = "ViewTestNote"; 24 | 25 | /** 26 | * Constructor. 27 | * 28 | * @param name Ignored and forced to NAME. 29 | * @param body the body of the Notification to be constructed. 30 | */ 31 | public ViewTestNote(String name, Object body) { 32 | super(name, body); 33 | } 34 | 35 | /** 36 | * Factory method. 37 | * 38 | *

This method creates new instances of the ViewTestNote class, 39 | * automatically setting the note name so you don't have to. Use 40 | * this as an alternative to the constructor.

41 | * 42 | * @param body the body of the Notification to be constructed. 43 | */ 44 | public static INotification create(Object body) { 45 | return new ViewTestNote(NAME, body); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/patterns/command/MacroCommandTest.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.command; 9 | 10 | import org.junit.jupiter.api.Assertions; 11 | import org.junit.jupiter.api.Test; 12 | import org.puremvc.java.multicore.interfaces.INotification; 13 | import org.puremvc.java.multicore.patterns.observer.Notification; 14 | 15 | /** 16 | * Test the PureMVC SimpleCommand class. 17 | * 18 | * @see org.puremvc.java.multicore.patterns.command.MacroCommandTestVO MacroCommandTestVO 19 | * @see org.puremvc.java.multicore.patterns.command.MacroCommandTestCommand MacroCommandTestCommand 20 | */ 21 | public class MacroCommandTest { 22 | 23 | /** 24 | * Tests operation of a MacroCommand. 25 | * 26 | *

This test creates a new Notification, adding a 27 | * MacroCommandTestVO as the body. 28 | * It then creates a MacroCommandTestCommand and invokes 29 | * its execute method, passing in the 30 | * Notification.

31 | * 32 | *

The MacroCommandTestCommand has defined an 33 | * initializeMacroCommand method, which is 34 | * called automatically by its constructor. In this method 35 | * the MacroCommandTestCommand adds 2 SubCommands 36 | * to itself, MacroCommandTestSub1Command and 37 | * MacroCommandTestSub2Command. 38 | * 39 | *

The MacroCommandTestVO has 2 result properties, 40 | * one is set by MacroCommandTestSub1Command by 41 | * multiplying the input property by 2, and the other is set 42 | * by MacroCommandTestSub2Command by multiplying 43 | * the input property by itself. 44 | * 45 | *

Success is determined by evaluating the 2 result properties 46 | * on the MacroCommandTestVO that was passed to 47 | * the MacroCommandTestCommand on the Notification 48 | * body.

49 | */ 50 | @Test 51 | public void testMacroCommandExecute() { 52 | 53 | // Create the VO 54 | MacroCommandTestVO vo = new MacroCommandTestVO(5); 55 | 56 | // Create the Notification (note) 57 | INotification note = new Notification("MacroCommandTest", vo, null); 58 | 59 | // Create the SimpleCommand 60 | MacroCommandTestCommand command = new MacroCommandTestCommand(); 61 | command.initializeNotifier("test"); 62 | 63 | // Execute the SimpleCommand 64 | command.execute(note); 65 | 66 | // test assertions 67 | Assertions.assertTrue(vo.result1 == 10, "Expecting vo.result1 == 10 " + vo.result1); 68 | Assertions.assertTrue(vo.result2 == 25, "Expecing vo.result2 == 25"); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/patterns/command/MacroCommandTestCommand.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.command; 9 | 10 | /** 11 | * A MacroCommand subclass used by MacroCommandTest. 12 | * 13 | * @see MacroCommandTest MacroCommandTest 14 | * @see org.puremvc.java.multicore.patterns.command.MacroCommandTestSub1Command MacroCommandTestSub1Command 15 | * @see org.puremvc.java.multicore.patterns.command.MacroCommandTestSub2Command MacroCommandTestSub2Command 16 | * @see MacroCommandTestVO MacroCommandTestVO 17 | */ 18 | public class MacroCommandTestCommand extends MacroCommand { 19 | 20 | /** 21 | * Initialize the MacroCommandTestCommand by adding 22 | * its 2 SubCommands. 23 | */ 24 | protected void initializeMacroCommand() { 25 | addSubCommand(() -> new MacroCommandTestSub1Command()); 26 | addSubCommand(() -> new MacroCommandTestSub2Command()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/patterns/command/MacroCommandTestSub1Command.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.command; 9 | 10 | import org.puremvc.java.multicore.interfaces.INotification; 11 | 12 | /** 13 | * A SimpleCommand subclass used by MacroCommandTestCommand. 14 | * 15 | * @see MacroCommandTest MacroCommandTest 16 | * @see MacroCommandTestCommand MacroCommandTestCommand 17 | * @see MacroCommandTestVO MacroCommandTestVO 18 | */ 19 | public class MacroCommandTestSub1Command extends SimpleCommand { 20 | 21 | /** 22 | * Fabricate a result by multiplying the input by 2 23 | * 24 | * @param notification the IEvent carrying the MacroCommandTestVO 25 | */ 26 | public void execute(INotification notification) { 27 | MacroCommandTestVO vo = (MacroCommandTestVO)notification.getBody(); 28 | 29 | // Fabricate a result 30 | vo.result1 = 2 * vo.input; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/patterns/command/MacroCommandTestSub2Command.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.command; 9 | 10 | import org.puremvc.java.multicore.interfaces.INotification; 11 | 12 | /** 13 | * A SimpleCommand subclass used by MacroCommandTestCommand. 14 | * 15 | * @see MacroCommandTest MacroCommandTest 16 | * @see MacroCommandTestCommand MacroCommandTestCommand 17 | * @see MacroCommandTestVO MacroCommandTestVO 18 | */ 19 | public class MacroCommandTestSub2Command extends SimpleCommand { 20 | 21 | /** 22 | * Fabricate a result by multiplying the input by itself 23 | * 24 | * @param notification the IEvent carrying the MacroCommandTestVO 25 | */ 26 | public void execute(INotification notification) { 27 | MacroCommandTestVO vo = (MacroCommandTestVO)notification.getBody(); 28 | 29 | // Fabricate a result 30 | vo.result2 = vo.input * vo.input; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/patterns/command/MacroCommandTestVO.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.command; 9 | 10 | /** 11 | * A utility class used by MacroCommandTest. 12 | * 13 | * @see MacroCommandTest MacroCommandTest 14 | * @see org.puremvc.java.multicore.patterns.command.MacroCommandTestCommand MacroCommandTestCommand 15 | * @see org.puremvc.java.multicore.patterns.command.MacroCommandTestSub1Command MacroCommandTestSub1Command 16 | * @see org.puremvc.java.multicore.patterns.command.MacroCommandTestSub2Command MacroCommandTestSub2Command 17 | */ 18 | public class MacroCommandTestVO { 19 | 20 | public int input; 21 | public int result1; 22 | public int result2; 23 | 24 | /** 25 | * Constructor. 26 | * 27 | * @param input the number to be fed to the MacroCommandTestCommand 28 | */ 29 | public MacroCommandTestVO(int input) { 30 | this.input = input; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/patterns/command/SimpleCommandTest.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.command; 9 | 10 | import org.junit.jupiter.api.Assertions; 11 | import org.junit.jupiter.api.Test; 12 | import org.puremvc.java.multicore.patterns.observer.Notification; 13 | 14 | /** 15 | * Test the PureMVC SimpleCommand class. 16 | * 17 | * @see org.puremvc.java.multicore.patterns.command.SimpleCommandTestVO SimpleCommandTestVO 18 | * @see org.puremvc.java.multicore.patterns.command.SimpleCommandTestCommand SimpleCommandTestCommand 19 | */ 20 | public class SimpleCommandTest { 21 | 22 | /** 23 | * Tests the execute method of a SimpleCommand. 24 | * 25 | *

This test creates a new Notification, adding a 26 | * SimpleCommandTestVO as the body. 27 | * It then creates a SimpleCommandTestCommand and invokes 28 | * its execute method, passing in the note.

29 | * 30 | *

Success is determined by evaluating a property on the 31 | * object that was passed on the Notification body, which will 32 | * be modified by the SimpleCommand

. 33 | * 34 | */ 35 | @Test 36 | public void testSimpleCommandExecute() { 37 | // Create the VO 38 | SimpleCommandTestVO vo = new SimpleCommandTestVO(5); 39 | 40 | // Create the Notification (note) 41 | Notification note = new Notification("SimpleCommandTestNote", vo); 42 | 43 | // Create the SimpleCommand 44 | SimpleCommandTestCommand command = new SimpleCommandTestCommand(); 45 | 46 | // Execute the SimpleCommand 47 | command.execute(note); 48 | 49 | // test assertions 50 | Assertions.assertTrue(vo.result == 10, "Expecting vo.result == 10"); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/patterns/command/SimpleCommandTestCommand.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.command; 9 | 10 | import org.puremvc.java.multicore.interfaces.INotification; 11 | 12 | /** 13 | * A SimpleCommand subclass used by SimpleCommandTest. 14 | * 15 | * @see SimpleCommandTest SimpleCommandTest 16 | * @see SimpleCommandTestVO SimpleCommandTestVO 17 | */ 18 | public class SimpleCommandTestCommand extends SimpleCommand { 19 | 20 | /** 21 | * Fabricate a result by multiplying the input by 2 22 | * 23 | * @param notification the INotification carrying the SimpleCommandTestVO 24 | */ 25 | public void execute(INotification notification) { 26 | SimpleCommandTestVO vo = (SimpleCommandTestVO) notification.getBody(); 27 | 28 | // Fabricate a result 29 | vo.result = 2 * vo.input; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/patterns/command/SimpleCommandTestVO.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.command; 9 | 10 | /** 11 | * A utility class used by SimpleCommandTest. 12 | * 13 | * @see SimpleCommandTest SimpleCommandTest 14 | * @see org.puremvc.java.multicore.patterns.command.SimpleCommandTestCommand SimpleCommandTestCommand 15 | */ 16 | public class SimpleCommandTestVO { 17 | 18 | public int input; 19 | public int result; 20 | 21 | /** 22 | * Constructor. 23 | * 24 | * @param input the number to be fed to the SimpleCommandTestCommand 25 | */ 26 | public SimpleCommandTestVO(int input) { 27 | this.input = input; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/patterns/facade/FacadeTestCommand.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.facade; 9 | 10 | import org.puremvc.java.multicore.interfaces.INotification; 11 | import org.puremvc.java.multicore.patterns.command.SimpleCommand; 12 | 13 | /** 14 | * A SimpleCommand subclass used by FacadeTest. 15 | * 16 | * @see FacadeTest FacadeTest 17 | * @see FacadeTestVO FacadeTestVO 18 | */ 19 | public class FacadeTestCommand extends SimpleCommand { 20 | 21 | /** 22 | * Fabricate a result by multiplying the input by 2 23 | * 24 | * @param notification the Notification carrying the FacadeTestVO 25 | */ 26 | public void execute(INotification notification) { 27 | FacadeTestVO vo = (FacadeTestVO)notification.getBody(); 28 | 29 | // Fabricate a result 30 | vo.result = 2 * vo.input; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/patterns/facade/FacadeTestVO.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.facade; 9 | 10 | /** 11 | * A utility class used by FacadeTest. 12 | * 13 | * @see FacadeTest FacadeTest 14 | * @see org.puremvc.java.multicore.patterns.facade.FacadeTestCommand FacadeTestCommand 15 | */ 16 | public class FacadeTestVO { 17 | 18 | public int input; 19 | public int result; 20 | 21 | /** 22 | * Constructor. 23 | * 24 | * @param input the number to be fed to the FacadeTestCommand 25 | */ 26 | public FacadeTestVO(int input) { 27 | this.input = input; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/patterns/mediator/MediatorTest.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.mediator; 9 | 10 | import org.junit.jupiter.api.Assertions; 11 | import org.junit.jupiter.api.Test; 12 | 13 | /** 14 | * Test the PureMVC Mediator class. 15 | * 16 | * @see org.puremvc.java.multicore.interfaces.IMediator IMediator 17 | * @see Mediator Mediator 18 | */ 19 | public class MediatorTest { 20 | 21 | /** 22 | * Tests getting the name using Mediator class accessor method. 23 | */ 24 | @Test 25 | public void testNameAccessor() { 26 | // Create a new Mediator and use accessors to set the mediator name 27 | Mediator mediator = new Mediator(); 28 | 29 | // test assertions 30 | Assertions.assertTrue(mediator.getMediatorName() == Mediator.NAME, "Expecting mediator.getMediatorName() == Mediator.NAME"); 31 | } 32 | 33 | /** 34 | * Tests getting the name using Mediator class accessor method. 35 | */ 36 | @Test 37 | public void testViewAccessor() { 38 | // Create a view object 39 | Object view = new Object(); 40 | 41 | // Create a new Proxy and use accessors to set the proxy name 42 | Mediator mediator = new Mediator(Mediator.NAME, view); 43 | 44 | // test assertions 45 | Assertions.assertNotNull(mediator.getViewComponent(), "Expecting mediator.getViewComponent() not null"); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/patterns/observer/NotificationTest.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.observer; 9 | 10 | import org.junit.jupiter.api.Assertions; 11 | import org.junit.jupiter.api.Test; 12 | import org.puremvc.java.multicore.interfaces.INotification; 13 | 14 | /** 15 | * Test the PureMVC Notification class. 16 | * 17 | * @see Notification Notification 18 | */ 19 | public class NotificationTest { 20 | 21 | /** 22 | * Tests setting and getting the name using Notification class accessor methods. 23 | */ 24 | @Test 25 | public void testNameAccessors() { 26 | // Create a new Notification and use accessors to set the note name 27 | INotification note = new Notification("TestNote"); 28 | 29 | // test assertions 30 | Assertions.assertTrue(note.getName() == "TestNote", "Expecting note.getName() == 'TestNote'"); 31 | } 32 | 33 | /** 34 | * Tests setting and getting the body using Notification class accessor methods. 35 | */ 36 | @Test 37 | public void testBodyAccessors() { 38 | // Create a new Notification and use accessors to set the body 39 | INotification note = new Notification(null); 40 | note.setBody(5); 41 | 42 | // test assertions 43 | Assertions.assertTrue((int)note.getBody() == 5, "Expecting note.getBody() == 5"); 44 | } 45 | 46 | /** 47 | * Tests setting the name and body using the Notification class Constructor. 48 | */ 49 | @Test 50 | public void testConstructor() { 51 | // Create a new Notification using the Constructor to set the note name and body 52 | INotification note = new Notification("TestNote", 5, "TestNoteType"); 53 | 54 | // test assertions 55 | Assertions.assertTrue(note.getName() == "TestNote", "Expecting note.getName() == 'TestNote'"); 56 | Assertions.assertTrue((int)note.getBody() == 5, "Expecting note.getBody() == 5"); 57 | Assertions.assertTrue(note.getType() == "TestNoteType", "Expecting note.getType() == 'TestNoteType'"); 58 | } 59 | 60 | /** 61 | * Tests the toString method of the notification 62 | */ 63 | @Test 64 | public void testToString() { 65 | // Create a new Notification and use accessors to set the note name 66 | INotification note = new Notification("TestNote", "1,3,5", "TestType"); 67 | String ts = "Notification Name: TestNote\nBody:1,3,5\nType:TestType"; 68 | 69 | // test assertions 70 | Assertions.assertTrue(note.toString().equals(ts), "Expecting note.toString() == '" + ts + "'"); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/patterns/observer/ObserverTest.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.observer; 9 | 10 | import org.junit.jupiter.api.Assertions; 11 | import org.junit.jupiter.api.Test; 12 | import org.puremvc.java.multicore.interfaces.INotification; 13 | 14 | /** 15 | * Tests PureMVC Observer class. 16 | * 17 | *

Since the Observer encapsulates the interested object's 18 | * callback information, there are no getters, only setters. 19 | * It is, in effect write-only memory.

20 | * 21 | *

Therefore, the only way to test it is to set the 22 | * notification method and context and call the notifyObserver 23 | * method.

24 | * 25 | */ 26 | public class ObserverTest { 27 | 28 | /** 29 | * A test variable that proves the notify method was 30 | * executed with 'this' as its exectution context 31 | */ 32 | private int observerTestVar; 33 | 34 | /** 35 | * Tests observer class when initialized by accessor methods. 36 | */ 37 | @Test 38 | public void testObserverAccessors() { 39 | // Create observer with null args, then 40 | // use accessors to set notification method and context 41 | Observer observer = new Observer(null, null); 42 | observer.setNotifyContext(this); 43 | observer.setNotifyMethod(this::handleNotification); 44 | 45 | // create a test event, setting a payload value and notify 46 | // the observer with it. since the observer is this class 47 | // and the notification method is observerTestMethod, 48 | // successful notification will result in our local 49 | // observerTestVar being set to the value we pass in 50 | // on the note body. 51 | Notification note = new Notification("ObserverTestNote", 10); 52 | observer.notifyObserver(note); 53 | 54 | // test assertions 55 | Assertions.assertTrue(observerTestVar == 10, "Expecting observerTestVar = 10"); 56 | } 57 | 58 | /** 59 | * Tests observer class when initialized by constructor. 60 | */ 61 | @Test 62 | public void testObserverConstructor() { 63 | // Create observer passing in notification method and context 64 | Observer observer = new Observer(this::handleNotification, this); 65 | 66 | // create a test note, setting a body value and notify 67 | // the observer with it. since the observer is this class 68 | // and the notification method is observerTestMethod, 69 | // successful notification will result in our local 70 | // observerTestVar being set to the value we pass in 71 | // on the note body. 72 | Notification note = new Notification("ObserverTestNote", 5); 73 | observer.notifyObserver(note); 74 | 75 | // test assertions 76 | Assertions.assertTrue(observerTestVar == 5, "Expecting observerTestVar = 5"); 77 | } 78 | 79 | /** 80 | * Tests the compareNotifyContext method of the Observer class 81 | */ 82 | @Test 83 | public void testCompareNotifyContext() { 84 | // Create observer passing in notification method and context 85 | Observer observer = new Observer(this::handleNotification, this); 86 | 87 | Object negTestObj = new Object(); 88 | 89 | // test assertions 90 | Assertions.assertFalse(observer.compareNotifyContext(negTestObj), "Expecting observer.compareNotifyContext(negTestObj) == false"); 91 | Assertions.assertTrue(observer.compareNotifyContext(this), "Expecting observer.compareNotifyContext(this) == true"); 92 | } 93 | 94 | /** 95 | * A function that is used as the observer notification 96 | * method. It multiplies the input number by the 97 | * observerTestVar value 98 | */ 99 | public void handleNotification(INotification notification) { 100 | observerTestVar = (int)notification.getBody(); 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /src/test/java/org/puremvc/java/multicore/patterns/proxy/ProxyTest.java: -------------------------------------------------------------------------------- 1 | // 2 | // PureMVC Java Multicore 3 | // 4 | // Copyright(c) 2019 Saad Shams 5 | // Your reuse is governed by the Creative Commons Attribution 3.0 License 6 | // 7 | 8 | package org.puremvc.java.multicore.patterns.proxy; 9 | 10 | import org.junit.jupiter.api.Assertions; 11 | import org.junit.jupiter.api.Test; 12 | 13 | /** 14 | * Test the PureMVC Proxy class. 15 | * 16 | * @see org.puremvc.java.multicore.interfaces.IProxy IProxy 17 | * @see Proxy Proxy 18 | */ 19 | public class ProxyTest { 20 | 21 | /** 22 | * Tests getting the name using Proxy class accessor method. Setting can only be done in constructor. 23 | */ 24 | @Test 25 | public void testNameAccessory() { 26 | Proxy proxy = new Proxy("TestProxy"); 27 | 28 | // test assertions 29 | Assertions.assertTrue(proxy.getProxyName() == "TestProxy", "Expecting proxy.getProxyName == 'TestProxy'"); 30 | } 31 | 32 | /** 33 | * Tests setting and getting the data using Proxy class accessor methods. 34 | */ 35 | @Test 36 | public void testDataAccessors() { 37 | // Create a new Proxy and use accessors to set the data 38 | Proxy proxy = new Proxy("colors"); 39 | proxy.setData(new String[]{"red", "green", "blue"}); 40 | 41 | String[] data = (String[]) proxy.getData(); 42 | 43 | // test assertions 44 | Assertions.assertTrue(data.length == 3, "Expecting data.length == 3"); 45 | Assertions.assertTrue(data[0] == "red", "Expecting data[0] == 'red'"); 46 | Assertions.assertTrue(data[1] == "green", "Expecting data[1] == 'green'"); 47 | Assertions.assertTrue(data[2] == "blue", "Expecting data[2] == 'blue'"); 48 | } 49 | 50 | /** 51 | * Tests setting the name and body using the Notification class Constructor. 52 | */ 53 | @Test 54 | public void testConstructor() { 55 | // Create a new Proxy using the Constructor to set the name and data 56 | Proxy proxy = new Proxy("colors", new String[] {"red", "green", "blue"}); 57 | String[] data = (String[]) proxy.getData(); 58 | 59 | // test assertions 60 | Assertions.assertNotNull(proxy, "Expecting proxy not null"); 61 | Assertions.assertTrue(proxy.getProxyName() == "colors", "Expecting proxy.getProxyName() == 'color'"); 62 | Assertions.assertTrue(data.length == 3, "Expecting data.length == 3"); 63 | Assertions.assertTrue(data[0] == "red", "Expecting data[0] == 'red'"); 64 | Assertions.assertTrue(data[1] == "green", "Expecting data[1] == 'green'"); 65 | Assertions.assertTrue(data[2] == "blue", "Expecting data[2] == 'blue'"); 66 | } 67 | 68 | } 69 | --------------------------------------------------------------------------------