diff --git a/assets/plugins/plugin-9patch-0.0.1.jar b/assets/plugins/plugin-9patch-0.0.1.jar index 32b73458..a0eef4a8 100644 Binary files a/assets/plugins/plugin-9patch-0.0.1.jar and b/assets/plugins/plugin-9patch-0.0.1.jar differ diff --git a/assets/plugins/plugin-performance-0.0.1.jar b/assets/plugins/plugin-performance-0.0.1.jar index e40cb346..726e98b0 100644 Binary files a/assets/plugins/plugin-performance-0.0.1.jar and b/assets/plugins/plugin-performance-0.0.1.jar differ diff --git a/assets/plugins/plugin-skin-composer-0.0.1.jar b/assets/plugins/plugin-skin-composer-0.0.1.jar index 4d8d839d..3d4e8840 100644 Binary files a/assets/plugins/plugin-skin-composer-0.0.1.jar and b/assets/plugins/plugin-skin-composer-0.0.1.jar differ diff --git a/assets/plugins/plugin-tiled-0.0.1.jar b/assets/plugins/plugin-tiled-0.0.1.jar index 73e95bdb..c4452bcb 100644 Binary files a/assets/plugins/plugin-tiled-0.0.1.jar and b/assets/plugins/plugin-tiled-0.0.1.jar differ diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/core/Controller.java b/hyperlap2d-common-api/src/main/java/com/puremvc/core/Controller.java deleted file mode 100644 index 8a68216f..00000000 --- a/hyperlap2d-common-api/src/main/java/com/puremvc/core/Controller.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * ****************************************************************************** - * * Copyright 2015 See AUTHORS file. - * * - * * Licensed under the Apache License, Version 2.0 (the "License"); - * * you may not use this file except in compliance with the License. - * * You may obtain a copy of the License at - * * - * * http://www.apache.org/licenses/LICENSE-2.0 - * * - * * Unless required by applicable law or agreed to in writing, software - * * distributed under the License is distributed on an "AS IS" BASIS, - * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * * See the License for the specific language governing permissions and - * * limitations under the License. - * ***************************************************************************** - */ -package com.puremvc.core; - -import com.puremvc.patterns.command.Command; -import com.puremvc.patterns.observer.Notification; - -/** - * The interface definition for a PureMVC Controller. - *
- *
- * In PureMVC, an IController implementor follows the 'Command
- * and Controller' strategy, and assumes these responsibilities:
- *
ICommands are intended to handle which
- * INotifications.IObserver with the
- * View for each INotification that it has an
- * ICommand mapping for.ICommand to handle
- * a given INotification when notified by the View.ICommand's execute method,
- * passing in the INotification.ICommand class as the handler for a
- * particular INotification.
- *
- * @param notificationName the name of the INotification
- * @param command the Class of the ICommand
- */
- void registerCommand(String notificationName, Class extends Command> command);
-
- /**
- * Execute the ICommand previously registered as the handler
- * for INotifications with the given notification name.
- *
- * @param notification the INotification to execute the associated
- * ICommand for
- */
- void executeCommand(Notification notification);
-
- /**
- * Remove a previously registered ICommand to
- * INotification mapping.
- *
- * @param notificationName the name of the INotification to remove the
- * ICommand mapping for
- */
- void removeCommand(String notificationName);
-
- /**
- * Check if a Command is registered for a given Notification
- *
- * @param notificationName
- * @return whether a Command is currently registered for the given notificationName.
- */
- boolean hasCommand(String notificationName);
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/core/CoreController.java b/hyperlap2d-common-api/src/main/java/com/puremvc/core/CoreController.java
deleted file mode 100644
index c263a5cc..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/core/CoreController.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.core;
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.puremvc.patterns.command.Command;
-import com.puremvc.patterns.observer.BaseObserver;
-import com.puremvc.patterns.observer.Notification;
-
-/**
- * A Singleton Controller implementation.
- * - *
- * In PureMVC, the Controller class follows the
- * 'Command and Controller' strategy, and assumes these
- * responsibilities:
- *
ICommands
- * are intended to handle which INotifications.IObserver with
- * the View for each INotification
- * that it has an ICommand mapping for.ICommand
- * to handle a given INotification when notified by the View.ICommand's execute
- * method, passing in the INotification.- *
- * Your application must register ICommands with the
- * Controller.
- *
- * The simplest way is to subclass Facade,
- * and use its
- *
- * This
- * Called automatically by the constructor.
- * Note that if you are using a subclass of
- *
- *
- * If an
- * The Observer for the new ICommand is only created if this the
- * first time an ICommand has been regisered for this Notification name.
- *
- * @param notificationName the name of the
- *
- * In PureMVC, the
- *
- * The
- *
- *
- * Your application must register
- *
- * This
- *
- * Called automatically by the constructor, this is your opportunity to
- * initialize the Singleton instance in your subclass without overriding the
- * constructor.
- *
- *
- * In PureMVC, the
- *
- * This
- *
- * Called automatically by the constructor, this is your opportunity to
- * initialize the Singleton instance in your subclass without overriding
- * the constructor.
- *
- *
- * All previously attached
- *
- * Registers the
- * If the
- *
- * In PureMVC,
- *
- * An
- *
- *
- * In PureMVC,
- *
- * In PureMVC, the
- *
- * All previously attached
- *
- * Registers the
- * If the
- *
- * A
- *
- * When
- *
- * Unlike
- *
- *
- * @see com.puremvc.core.Controller Controller
- * @see com.puremvc.patterns.observer.Notification Notification
- * @see com.puremvc.patterns.command.SimpleCommand SimpleCommand
- */
-public class MacroCommand extends BaseNotifier implements Command {
-
- private Collection
- *
- * You should not need to define a constructor, instead, override the
- *
- *
- * If your subclass does define a constructor, be sure to call
- *
- *
- * In your subclass, override this method to initialize the
- *
- *
- *
- * Note that SubCommands may be any
- *
- * The SubCommands will be called in First In/First Out (FIFO)
- * order.
- *
- *
- * The SubCommands will be called in First In/First Out (FIFO)
- * order.
- *
- * @param notification the
- *
- * Your subclass should override the
- *
- * In the Command Pattern, an application use-case typically begins with
- * some user action, which results in an
- *
- * The Facade Pattern suggests providing a single class to act as a central
- * point of communication for a subsystem.
- *
- *
- * In PureMVC, the Facade acts as an interface between the core MVC actors
- * (Model, View, Controller) and the rest of your application.
- *
- *
- * This
- *
- * Called automatically by the constructor. Override in your
- * subclass to do any subclass specific initializations. Be
- * sure to call
- *
- * Called by the
- *
- * Called by the
- * Note: This method is rarely overridden; in practice you are more
- * likely to use a
- *
- * Called by the
- * Note: This method is rarely overridden; in practice you are more
- * likely to use a
- *
- * Keeps us from having to construct new notification
- * instances in our implementation code.
- *
- * @param notificationName the name of the notification to send
- * @param body the body of the notification (optional)
- * @param type the type of the notification (optional)
- */
- public void sendNotification(String notificationName, Object body, String type) {
- notifyObservers(new BaseNotification(notificationName, body, type));
- }
-
- /**
- * Create and send an
- *
- * Keeps us from having to construct new notification
- * instances in our implementation code.
- *
- * @param notificationName the name of the notification to send
- * @param body the body of the notification (optional)
- */
- public void sendNotification(String notificationName, Object body) {
- sendNotification(notificationName, body, null);
- }
-
- /**
- * Create and send an
- *
- * Keeps us from having to construct new notification
- * instances in our implementation code.
- *
- * @param notificationName the name of the notification to send
- */
- public void sendNotification(String notificationName) {
- sendNotification(notificationName, null, null);
- }
-
- /**
- * Notify
- *
- * In PureMVC,
- * Additionally, initializeController method to add your
- * registrations.
- *
- * @see CoreView View
- * @see BaseObserver Observer
- * @see com.puremvc.patterns.observer.Notification Notification
- * @see com.puremvc.patterns.command.SimpleCommand SimpleCommand
- * @see com.puremvc.patterns.command.MacroCommand MacroCommand
- */
-public class CoreController implements Controller {
-
- /**
- * Reference to the singleton instance
- */
- protected static CoreController instance;
- /**
- * Mapping of Notification names to Command Class references
- */
- protected MapIController implementation is a Singleton, so you
- * should not call the constructor directly, but instead call the static
- * Singleton Factory method Controller.getInstance()
- */
- protected CoreController() {
- instance = this;
- commandMap = new HashMap<>();
- initializeController();
- }
-
- /**
- * Controller Singleton Factory method.
- *
- * @return the Singleton instance of Controller
- */
- public synchronized static CoreController getInstance() {
- if (instance == null) {
- instance = new CoreController();
- }
-
- return instance;
- }
-
- /**
- * Initialize the Singleton Controller instance.
- * View
- * in your application, you should also subclass Controller
- * and override the initializeController method in the
- * following way:ICommand has previously been registered to handle a
- * the given INotification, then it is executed.
- *
- * @param note The notification to send associated with the command to call.
- */
- public void executeCommand(Notification note) {
- //No reflexion in GWT
- Class extends Command> commandClass = commandMap.get(note.getName());
- if (commandClass != null) {
- Command command;
- try {
- command = commandClass.newInstance();
- command.execute(note);
- } catch (InstantiationException | IllegalAccessException e) {
- e.printStackTrace();
- }
-
- }
- }
-
- /**
- * Register a particular ICommand class as the handler for a
- * particular INotification.
- * ICommand has already been registered to handle
- * INotifications with this name, it is no longer used, the
- * new ICommand is used instead.
- * Notification
- * @param command an instance of Command
- */
- public void registerCommand(String notificationName, Class extends Command> command) {
- if (null != commandMap.put(notificationName, command)) {
- return;
- }
-
- view.registerObserver
- (
- notificationName,
- new BaseObserver(this::executeCommand, this)
- );
- }
-
- /**
- * Remove a previously registered ICommand to
- * INotification mapping.
- *
- * @param notificationName the name of the INotification to remove the
- * ICommand mapping for
- */
- public void removeCommand(String notificationName) {
- // if the Command is registered...
- if (hasCommand(notificationName)) {
- // remove the observer
- view.removeObserver(notificationName, this);
- commandMap.remove(notificationName);
- }
- }
-
- /**
- * Check if a Command is registered for a given Notification
- *
- * @param notificationName The name of the command to check for existance.
- * @return whether a Command is currently registered for the given notificationName.
- */
- public boolean hasCommand(String notificationName) {
- return commandMap.containsKey(notificationName);
- }
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/core/CoreModel.java b/hyperlap2d-common-api/src/main/java/com/puremvc/core/CoreModel.java
deleted file mode 100644
index 2b1ec43c..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/core/CoreModel.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.core;
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.puremvc.patterns.proxy.Proxy;
-
-/**
- * A Singleton IModel implementation.
- * Model class provides
- * access to model objects (Proxies) by named lookup.
- * Model assumes these responsibilities:
- *
- * IProxy instances.IProxy instances.IProxy instances
- * with the Model. Typically, you use an
- * ICommand to create and register IProxy
- * instances once the Facade has initialized the Core
- * actors.IModel implementation is a Multiton,
- * so you should not call the constructor
- * directly, but instead call the static Multiton
- * Factory method Model.getInstance( multitonKey )
- *
- * @throws Error Error if instance for this Multiton key instance has already been constructed
- */
- protected CoreModel() {
- instance = this;
- proxyMap = new HashMap<>();
- initializeModel();
- }
-
- /**
- * Model Multiton Factory method.
- *
- * @return the instance for this Multiton key
- */
- public synchronized static CoreModel getInstance() {
- if (instance == null) {
- instance = new CoreModel();
- }
-
- return instance;
- }
-
- /**
- * Initialize the Singleton Model instance.
- * Proxy with the Model.
- *
- * @param proxy an Proxy to be held by the Model.
- */
- public void registerProxy(Proxy proxy) {
- proxyMap.put(proxy.getProxyName(), proxy);
- proxy.onRegister();
- }
-
- /**
- * Remove an Proxy from the Model.
- *
- * @param proxyName Name of the Proxy instance to be removed.
- * @return The IProxy that was removed from the Model
- */
- public Proxy removeProxy(String proxyName) {
- Proxy proxy = proxyMap.get(proxyName);
-
- if (proxy != null) {
- proxyMap.remove(proxyName);
- proxy.onRemove();
- }
-
- return proxy;
- }
-
- /**
- * Retrieve an Proxy from the Model.
- *
- * @param proxy
- * @return the Proxy instance previously registered with the
- * given proxyName.
- */
- public Proxy object to check for existance.
- * @return Whether a Proxy is currently registered with the given proxyName.
- */
- public boolean hasProxy(String proxyName) {
- return proxyMap.containsKey(proxyName);
- }
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/core/CoreView.java b/hyperlap2d-common-api/src/main/java/com/puremvc/core/CoreView.java
deleted file mode 100644
index 623d112d..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/core/CoreView.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.core;
-
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import com.puremvc.patterns.mediator.Mediator;
-import com.puremvc.patterns.observer.BaseObserver;
-import com.puremvc.patterns.observer.Notification;
-import com.puremvc.patterns.observer.Observer;
-
-/**
- * A Singleton IView implementation.
- * View class assumes these responsibilities:
- *
- *
- *
- * @see com.puremvc.patterns.mediator.Mediator Mediator
- * @see com.puremvc.patterns.observer.Observer Observer
- * @see com.puremvc.patterns.observer.Notification Notification
- */
-public class CoreView implements View {
-
- // Singleton instance
- private static CoreView instance;
- // Mapping of Mediator names to Mediator instances
- // Mapping of Notification names to Observer lists
- private HashMapIMediator instances.IMediators.INotification in the
- * application.IObservers to an
- * INotification's observer list.INotification.IObservers of a given
- * INotification when it broadcast.IView implementation is a Singleton, so you should
- * not call the constructor directly, but instead call the static Singleton
- * Factory method View.getInstance()
- *
- * @throws Error Error if Singleton instance has already been constructed
- */
- protected CoreView() {
- instance = this;
-
- this.mediatorMap = new HashMap<>();
- this.observerMap = new HashMap<>();
- initializeView();
- }
-
- /**
- * View Singleton Factory method.
- *
- * @return The Singleton instance of View
- */
- public synchronized static CoreView getInstance() {
- if (instance == null)
- instance = new CoreView();
-
- return instance;
- }
-
- /**
- * Initialize the Singleton View instance.
- * Observers for a particular
- * Notification.
- * Observers for this
- * Notification's list are notified and are passed a
- * reference to the Notification in the order in which they
- * were registered.
- * Notification to notify
- * Observers of.
- */
- public void notifyObservers(Notification note) {
- ListMediator instance with the View.
- * Mediator so that it can be retrieved by
- * name, and further interrogates the Mediator for its
- * Notification interests.
- * Mediator returns any Notification
- * names to be notified about, an Observer is created
- * encapsulating the Mediator instance's
- * handleNotification method and registering it as an
- * Observer for all Notifications the
- * Mediator is interested in.
- * IMediator
- * instance
- */
- public void registerMediator(final Mediator mediator) {
- if (mediatorMap.containsKey(mediator.getMediatorName())) {
- return;
- }
-
- // Register the Mediator for retrieval by name
- mediatorMap.put(mediator.getMediatorName(), mediator);
-
- // Get Notification interests, if any.
- String[] noteInterests = mediator.listNotificationInterests();
- if (noteInterests.length != 0) {
- // Create Observer
- BaseObserver observer = new BaseObserver(mediator::handleNotification, mediator);
-
- // Register Mediator as Observer for its list of Notification
- // interests
- for (String noteInterest : noteInterests) {
- registerObserver(noteInterest, observer);
- }
- }
-
- // alert the mediator that it has been registered
- mediator.onRegister();
- }
-
- /**
- * Register an Observer to be notified of
- * INotifications with a given name.
- *
- * @param notificationName the name of the Notifications to notify this
- * Observer of
- * @param observer the Observer to register
- */
- public void registerObserver(String notificationName, Observer observer) {
- if (observerMap.get(notificationName) == null) {
- observerMap.put(notificationName, new ArrayList<>());
- }
-
- ListMediator from the View.
- *
- * @param mediatorName name of the Mediator instance to be removed.
- */
- public Mediator removeMediator(String mediatorName) {
- // Retrieve the named mediator
- Mediator mediator = mediatorMap.get(mediatorName);
-
- if (mediator != null) {
- // for every notification this mediator is interested in...
- String[] interests = mediator.listNotificationInterests();
- for (String interest : interests) {
- // remove the observer linking the mediator
- // to the notification interest
- removeObserver(interest, mediator);
- }
-
- // remove the mediator from the map
- mediatorMap.remove(mediatorName);
-
- // alert the mediator that it has been removed
- mediator.onRemove();
- }
-
- return mediator;
- }
-
- /**
- * Retrieve an Mediator from the View.
- *
- * @param mediatorName the name of the Mediator instance to
- * retrieve.
- * @return the Mediator instance previously registered with
- * the given mediatorName.
- */
- public mediatorName.
- */
- public boolean hasMediator(String mediatorName) {
- return mediatorMap.containsKey(mediatorName);
- }
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/core/Model.java b/hyperlap2d-common-api/src/main/java/com/puremvc/core/Model.java
deleted file mode 100644
index cc1847f5..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/core/Model.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.core;
-
-import com.puremvc.patterns.proxy.Proxy;
-
-/**
- * The interface definition for a PureMVC Model.
- * Model implementors provide access to
- * Proxy objects by named lookup.
- * Model assumes these responsibilities:
- *
- *
- */
-public interface Model {
-
- /**
- * Register an Proxy instancesProxy instancesProxy instance with the Model.
- *
- * @param proxy an object reference to be held by the Model.
- */
- void registerProxy(Proxy proxy);
-
- /**
- * Retrieve an Proxy instance from the Model.
- *
- * @param proxy
- * @return the Proxy instance previously registered with the
- * given proxyName.
- */
- Proxy instance from the Model.
- *
- * @param proxy name of the Proxy instance to be removed.
- */
- Proxy removeProxy(String proxy);
-
- /**
- * Check if a Proxy is registered
- *
- * @param proxyName
- * @return whether a Proxy is currently registered with the given proxyName.
- */
- boolean hasProxy(String proxyName);
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/core/View.java b/hyperlap2d-common-api/src/main/java/com/puremvc/core/View.java
deleted file mode 100644
index 2d8fa336..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/core/View.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.core;
-
-import com.puremvc.patterns.mediator.Mediator;
-import com.puremvc.patterns.observer.Notification;
-import com.puremvc.patterns.observer.Observer;
-
-/**
- * The interface definition for a PureMVC View.
- * View implementors assume these responsibilities:
- * CoreView class assumes these responsibilities:
- *
- *
- *
- * @see com.puremvc.patterns.mediator.Mediator Mediator
- * @see com.puremvc.patterns.observer.Observer Observer
- * @see com.puremvc.patterns.observer.Notification Notification
- */
-public interface View {
-
- /**
- * Register an Mediator instances.Mediators.Notification in the
- * application.Observers to an
- * Notification's observer list.Notification.Observers of a given
- * Notification when it broadcast.IObserver to be notified of
- * INotifications with a given name.
- *
- * @param noteName the name of the INotifications to notify this
- * IObserver of
- * @param observer the IObserver to register
- */
- void registerObserver(String noteName, Observer observer);
-
- /**
- * Notify the IObservers for a particular
- * INotification.
- * IObservers for this
- * INotification's list are notified and are passed a
- * reference to the INotification in the order in which they
- * were registered.
- * INotification to notify
- * IObservers of.
- */
- void notifyObservers(Notification note);
-
- /**
- * Register an IMediator instance with the View.
- * IMediator so that it can be retrieved by
- * name, and further interrogates the IMediator for its
- * INotification interests.
- * IMediator returns any INotification
- * names to be notified about, an Observer is created
- * encapsulating the IMediator instance's
- * handleNotification method and registering it as an
- * Observer for all INotifications the
- * IMediator is interested in.
- * IMediator instance
- */
- void registerMediator(Mediator mediator);
-
- /**
- * Retrieve an IMediator from the View.
- *
- * @param mediatorName the name of the IMediator instance to retrieve.
- * @return the IMediator instance previously registered with
- * the given mediatorName.
- */
- IMediator from the View.
- *
- * @param mediatorName name of the IMediator instance to be removed.
- */
- Mediator removeMediator(String mediatorName);
-
- /**
- * Check if a Mediator is registered or not
- *
- * @param mediatorName
- * @return whether a Mediator is registered with the given mediatorName.
- */
- boolean hasMediator(String mediatorName);
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/command/Command.java b/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/command/Command.java
deleted file mode 100644
index 44b1ae93..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/command/Command.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.patterns.command;
-
-import com.puremvc.patterns.observer.Notification;
-import com.puremvc.patterns.observer.Notifier;
-
-/**
- * The interface definition for a PureMVC Command.
- *
- * @see com.puremvc.patterns.observer Notification
- */
-public interface Command extends Notifier {
-
- /**
- * Execute the Command's logic to handle a given
- * Notification.
- *
- * @param notification an Notification to handle.
- */
- void execute(Notification notification);
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/command/MacroCommand.java b/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/command/MacroCommand.java
deleted file mode 100644
index adf281db..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/command/MacroCommand.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.patterns.command;
-
-
-import java.util.Collection;
-import java.util.Vector;
-
-import com.puremvc.patterns.observer.BaseNotifier;
-import com.puremvc.patterns.observer.Notification;
-
-
-/**
- * A base ICommand implementation that executes other
- * ICommands.
- * MacroCommand maintains an list of ICommand
- * Class references called SubCommands.
- * execute is called, the MacroCommand
- * instantiates and calls execute on each of its SubCommands
- * turn. Each SubCommand will be passed a reference to the original
- * INotification that was passed to the MacroCommand's
- * execute method.
- * SimpleCommand, your subclass should not override
- * execute, but instead, should override the
- * initializeMacroCommand method, calling
- * addSubCommand once for each SubCommand to be executed.
- * initializeMacroCommand method.
- * super().
- * MacroCommand.
- * MacroCommand's SubCommand list with
- * ICommand class references like this:
- * ICommand
- * implementor, MacroCommands or SimpleCommands
- * are both acceptable.
- */
- protected void initializeMacroCommand() {
- }
-
- /**
- * Add a SubCommand.
- * Class of the
- * ICommand.
- */
- protected void addSubCommand(Class extends Command> commandClassRef) {
- subCommands.add(commandClassRef);
- }
-
- /**
- * Execute this MacroCommand's SubCommands.
- * INotification object to be passsed to each
- * SubCommand.
- */
- public void execute(Notification notification) {
- for (Class extends Command> commandClass : subCommands) {
- try {
- Command command = commandClass.newInstance();
- command.execute(notification);
- } catch (InstantiationException | IllegalAccessException e) {
- e.printStackTrace();
- }
- }
- }
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/command/SimpleCommand.java b/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/command/SimpleCommand.java
deleted file mode 100644
index 9cdcf32e..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/command/SimpleCommand.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.patterns.command;
-
-
-import com.puremvc.patterns.observer.BaseNotifier;
-import com.puremvc.patterns.observer.Notification;
-
-/**
- * A base ICommand implementation.
- * execute method where your
- * business logic will handle the INotification.
- * INotification.
- * INotification being
- * broadcast, which is handled by business logic in the execute
- * method of an ICommand.
- * INotification to handle.
- */
- public void execute(Notification notification) {
- }
-
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/facade/Facade.java b/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/facade/Facade.java
deleted file mode 100644
index 3150ad38..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/facade/Facade.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.patterns.facade;
-
-import com.puremvc.patterns.command.Command;
-import com.puremvc.patterns.mediator.Mediator;
-import com.puremvc.patterns.observer.Notification;
-import com.puremvc.patterns.observer.Notifier;
-import com.puremvc.patterns.proxy.Proxy;
-
-/**
- * The interface definition for a PureMVC Facade.
- * Observers of an INotification.
- *
- * @param note the INotification to have the View
- * notify observers of.
- */
- void notifyObservers(Notification note);
-
- /**
- * Register an IProxy with the Model by name.
- *
- * @param proxy the IProxy to be registered with the
- * Model.
- */
- void registerProxy(Proxy proxy);
-
- /**
- * Retrieve a IProxy from the Model by name.
- *
- * @param proxyName the name of the IProxy instance to be
- * retrieved.
- * @return the IProxy previously regisetered by
- * proxyName with the Model.
- */
- IProxy instance from the Model by
- * name.
- *
- * @param proxyName the IProxy to remove from the
- * Model.
- */
- proxyName.
- */
- boolean hasProxy(String proxyName);
-
- /**
- * Register an ICommand with the Controller.
- *
- * @param noteName the name of the INotification to associate the
- * ICommand with.
- * @param commandClassRef a reference to the Class of the
- * ICommand.
- */
- void registerCommand(String noteName, Class extends Command> commandClassRef);
-
- /**
- * Remove a previously registered ICommand to INotification mapping from the Controller.
- *
- * @param notificationName the name of the INotification to remove the ICommand mapping for
- */
- void removeCommand(String notificationName);
-
- /**
- * Check if a Command is registered for a given Notification
- *
- * @param notificationName
- * @return whether a Command is currently registered for the given notificationName.
- */
- boolean hasCommand(String notificationName);
-
- /**
- * Register an IMediator instance with the View.
- *
- * @param mediator a reference to the IMediator instance
- */
- void registerMediator(Mediator mediator);
-
- /**
- * Retrieve an IMediator instance from the View.
- *
- * @param mediatorName the name of the IMediator instance to retrievve
- * @return the IMediator previously registered with the given
- * mediatorName.
- */
- mediatorName.
- */
- boolean hasMediator(String mediatorName);
-
- /**
- * Remove a IMediator instance from the View.
- *
- * @param mediatorName name of the IMediator instance to be removed.
- */
- Mediator removeMediator(String mediatorName);
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/facade/SimpleFacade.java b/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/facade/SimpleFacade.java
deleted file mode 100644
index 282f8cc1..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/facade/SimpleFacade.java
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.patterns.facade;
-
-
-import com.puremvc.core.CoreController;
-import com.puremvc.core.CoreModel;
-import com.puremvc.core.CoreView;
-import com.puremvc.patterns.command.Command;
-import com.puremvc.patterns.mediator.Mediator;
-import com.puremvc.patterns.observer.BaseNotification;
-import com.puremvc.patterns.observer.Notification;
-import com.puremvc.patterns.proxy.Proxy;
-
-/**
- * A base Singleton Facade implementation.
- *
- * @see CoreModel Model
- * @see CoreView View
- * @see CoreController Controller
- */
-public class SimpleFacade implements Facade {
- /**
- * The Singleton instance of the Facade
- */
- protected static SimpleFacade instance = null;
-
- /**
- * Reference to the Controller
- */
- protected CoreController controller = null;
-
- /**
- * Reference to the Model
- */
- protected CoreModel model = null;
-
- /**
- * Reference to the View
- */
- protected CoreView view = null;
-
- /**
- * Constructor.
- * IFacade implementation is a Singleton, so you should
- * not call the constructor directly, but instead call the static Singleton
- * Factory method Facade.getInstance()
- */
- protected SimpleFacade() {
- initializeFacade();
- }
-
- /**
- * Facade Singleton Factory method
- *
- * @return The Singleton instance of the Facade
- */
- public synchronized static SimpleFacade getInstance() {
- if (instance == null) {
- instance = new SimpleFacade();
- }
-
- return instance;
- }
-
- /**
- * Initialize the Multiton Facade instance.
- * super.initializeFacade(), though.Controller.
- * initializeFacade method. Override this
- * method in your subclass of Facade if one or both of the
- * following are true:
- *
- *
- * If you don't want to initialize a different IController.Commands to register with the
- * Controller at startup.. IController,
- * call super.initializeController() at the beginning of your
- * method, then register Commands.
- * Model.
- * initializeFacade method. Override this
- * method in your subclass of Facade if one or both of the
- * following are true:
- *
- *
- * If you don't want to initialize a different IModel.Proxys to register with the Model that do
- * not retrieve a reference to the Facade at construction time.IModel, call
- * super.initializeModel() at the beginning of your method,
- * then register Proxys.
- * Command to create and register Proxys
- * with the Model, since Proxys with mutable
- * tools will likely need to send INotifications and thus
- * will likely want to fetch a reference to the Facade during
- * their construction.
- * View.
- * initializeFacade method. Override this
- * method in your subclass of Facade if one or both of the
- * following are true:
- *
- *
- * If you don't want to initialize a different IView.Observers to register with the
- * ViewIView, call
- * super.initializeView() at the beginning of your method,
- * then register IMediator instances.
- * Command to create and register
- * Mediators with the View, since
- * IMediator instances will need to send
- * INotifications and thus will likely want to fetch a
- * reference to the Facade during their construction.
- * ICommand with the Controller by
- * Notification name.
- *
- * @param noteName the name of the INotification to associate the
- * ICommand with
- * @param command an instance of the ICommand
- */
- public void registerCommand(String noteName, Class extends Command> command) {
- controller.registerCommand(noteName, command);
- }
-
- /**
- * Remove a previously registered ICommand to INotification mapping from the Controller.
- *
- * @param notificationName the name of the INotification to remove the ICommand mapping for
- */
- public void removeCommand(String notificationName) {
- controller.removeCommand(notificationName);
- }
-
- /**
- * Check if a Command is registered for a given Notification
- *
- * @param notificationName
- * @return whether a Command is currently registered for the given notificationName.
- */
- public boolean hasCommand(String notificationName) {
- return controller.hasCommand(notificationName);
- }
-
- /**
- * Register a IMediator with the View.
- *
- * @param mediator the name to associate with this IMediator
- */
- public void registerMediator(Mediator mediator) {
- if (view != null) {
- view.registerMediator(mediator);
- }
- }
-
- /**
- * Register an IProxy with the Model by name.
- *
- * @param proxy the name of the IProxy instance to be
- * registered with the Model.
- */
- public void registerProxy(Proxy proxy) {
- model.registerProxy(proxy);
- }
-
-
-
- /**
- * Remove an IMediator from the View.
- *
- * @param mediatorName name of the IMediator to be removed.
- * @return the IMediator that was removed from the View
- */
- public Mediator removeMediator(String mediatorName) {
- if (this.view != null) {
- return this.view.removeMediator(mediatorName);
- }
- return null;
- }
-
- /**
- * Remove an IProxy from the Model by name.
- *
- * @param proxyName the IProxy to remove from the
- * Model.
- * @return the IProxy that was removed from the Model
- */
- public Proxy removeProxy(String proxyName) {
- if (model != null) {
- return model.removeProxy(proxyName);
- }
- return null;
- }
-
- /**
- * Check if a Proxy is registered
- *
- * @param proxyName
- * @return whether a Proxy is currently registered with the given proxyName.
- */
- public boolean hasProxy(String proxyName) {
- return model.hasProxy(proxyName);
- }
-
-
- /**
- * Check if a Mediator is registered or not
- *
- * @param mediatorName
- * @return whether a Mediator is registered with the given mediatorName.
- */
- public boolean hasMediator(String mediatorName) {
- return view.hasMediator(mediatorName);
- }
-
- /**
- * Retrieve an IMediator from the View.
- *
- * @param mediatorName
- * @return the IMediator previously registered with the given
- * mediatorName.
- */
- public IProxy from the Model by name.
- *
- * @param proxyName the name of the proxy to be retrieved.
- * @return the IProxy instance previously registered with the
- * given proxyName.
- */
-
- @Override
- public INotification.
- * INotification.
- * INotification.
- * Observers of an INotification.
- *
- * @param note the INotification to have the View
- * notify observers of.
- */
- public void notifyObservers(Notification note) {
- if (view != null) {
- view.notifyObservers(note);
- }
- }
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/mediator/Mediator.java b/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/mediator/Mediator.java
deleted file mode 100644
index 3475ee8a..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/mediator/Mediator.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.patterns.mediator;
-
-import com.puremvc.patterns.observer.Notification;
-import com.puremvc.patterns.observer.Notifier;
-
-/**
- * The interface definition for a PureMVC Mediator.
- * IMediator implementors assume these
- * responsibilities:
- *
- *
- * INotifications the IMediator has interest in.IMediators typically:
- *
- *
- * INotifications, interacting with
- * of the rest of the PureMVC app.
- *
- * When an IMediator is registered with the IView,
- * the IView will call the IMediator's
- * listNotificationInterests method. The IMediator
- * will return an Array of INotification names
- * which it wishes to be notified about.
- *
- *
- * The IView will then create an Observer object
- * encapsulating that IMediator's (handleNotification)
- * method and register it as an Observer for each INotification
- * name returned by listNotificationInterests.
- *
- *
- * A concrete IMediator implementor usually looks something like this: - *
- *- *
- * import com.me.myapp.model.~~; import com.me.myapp.view.~~; import - * com.me.myapp.controller.~~; - *
- * import mx.controls.ComboBox; import mx.events.ListEvent; - *
- * public class MyMediator extends Mediator implements IMediator { - *
- * public function MyComboMediator( viewComponent:Object ) { super( - * viewComponent ); combo.addEventListener( Event.CHANGE, onChange ); } - *
- * public function listNotificationInterests():Array { return [ - * MyFacade.SET_SELECTION, MyFacade.SET_DATAPROVIDER ]; } - *
- * public function handleNotification( notification:INotification ):void { - * switch ( notification.getName() ) { case MyFacade.SET_SELECTION: - * setSelection(notification); break; case MyFacade.SET_DATAPROVIDER: - * setDataProvider(notification); break; } } // Set the tools provider of the - * combo box private function setDataProvider( notification:INotification ):void { - * combo.dataProvider = notification.getBody() as Array; } // Invoked when the - * combo box dispatches a change event, we send a // notification with the - * private function onChange(event:ListEvent):void { sendNotification( - * MyFacade.MYCOMBO_CHANGED, this ); } // A private getter for accessing the - * view object by class private function get combo():ComboBox { return view as - * ComboBox; } }
IMediator instance name
- *
- * @return the IMediator instance name
- */
- String getMediatorName();
-
- /**
- * Get the IMediator's view component.
- *
- * @return Object the view component
- */
- V getViewComponent();
-
- /**
- * Set the IMediator's view component.
- *
- * @param viewComponent The view component
- */
- void setViewComponent(V viewComponent);
-
- /**
- * List INotification interests.
- *
- * @return an Array of the INotification names
- * this IMediator has an interest in.
- */
- String[] listNotificationInterests();
-
- /**
- * Handle an INotification.
- *
- * @param notification the INotification to be handled
- */
- void handleNotification(Notification notification);
-
- /**
- * Called by the View when the Mediator is registered
- */
- void onRegister();
-
- /**
- * Called by the View when the Mediator is removed
- */
- void onRemove();
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/mediator/SimpleMediator.java b/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/mediator/SimpleMediator.java
deleted file mode 100644
index b904d8f1..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/mediator/SimpleMediator.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.patterns.mediator;
-
-
-import com.puremvc.patterns.observer.BaseNotifier;
-import com.puremvc.patterns.observer.Notification;
-import com.puremvc.patterns.observer.Notifier;
-
-/**
- * A base Mediator implementation.
- *
- * @see com.puremvc.core.View View
- */
-public class SimpleMediatorSimpleMediator.
- */
- public static final String NAME = "SimpleMediator";
-
- /**
- * The name of the Mediator.
- */
- protected String mediatorName = null;
-
- /**
- * The view component
- */
- protected V viewComponent = null;
-
- /**
- * Constructor.
- *
- * @param mediatorName
- * @param viewComponent
- */
- public SimpleMediator(String mediatorName, V viewComponent) {
- this.mediatorName = (mediatorName != null) ? mediatorName : NAME;
- this.viewComponent = viewComponent;
- }
-
- /**
- * Get the name of the Mediator.
- *
- * @return the name
- */
- public final String getMediatorName() {
- return mediatorName;
- }
-
- /**
- * Get the Mediator's view component.
- * - *
- * Additionally, an implicit getter will usually be defined in the subclass - * that casts the view object to a type, like this: - *
- *- *
IMediator's view component.
- *
- * @param viewComponent The view component
- */
- public void setViewComponent(V viewComponent) {
- this.viewComponent = viewComponent;
- }
-
- /**
- * Handle INotifications.
- * - *
- * Typically this will be handled in a switch statement, with one 'case'
- * entry per INotification the Mediator is
- * interested in.
- *
- * @param notification
- */
- public void handleNotification(Notification notification) {
- }
-
- /**
- * List the INotification names this Mediator
- * is interested in being notified of.
- *
- * @return String[] the list of INotification names
- */
- public String[] listNotificationInterests() {
- return new String[]{};
- }
-
- /**
- * Called by the View when the Mediator is registered
- */
- public void onRegister() {
- }
-
- /**
- * Called by the View when the Mediator is removed
- */
- public void onRemove() {
- }
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/observer/BaseNotification.java b/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/observer/BaseNotification.java
deleted file mode 100644
index 6671342e..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/observer/BaseNotification.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.patterns.observer;
-
-
-/**
- * A base Notification implementation.
- *
- *
- * PureMVC does not rely upon underlying event models such as the one provided - * with Flash, and ActionScript 3 does not have an inherent event model. - *
- *- *
- * The Observer Pattern as implemented within PureMVC exists to support - * event-driven communication between the application and the actors of the MVC - * triad. - *
- *- *
- * Notifications are not meant to be a replacement for Events in
- * Flex/Flash/Apollo. Generally, IMediator implementors place
- * event listeners on their view components, which they then handle in the usual
- * way. This may lead to the broadcast of Notifications to
- * trigger ICommands or to communicate with other
- * IMediators. IProxy and ICommand
- * instances communicate with each other and IMediators by
- * broadcasting INotifications.
- *
- *
- * A key difference between Flash
- *
- *
- *
- * The
- *
- * The
- *
- * Keeps us from having to construct new notification instances in our
- * implementation code.
- *
- * @param notificationName the name of the notiification to send
- * @param body the body of the notification (optional)
- * @param type the type of the notification (optional)
- */
-
- public void sendNotification(String notificationName, Object body, String type) {
- facade.sendNotification(notificationName, body, type);
- }
-
- /**
- * Send an
- *
- * Keeps us from having to construct new notification instances in our
- * implementation code.
- *
- * @param notificationName the name of the notiification to send
- * @param body the body of the notification (optional)
- */
-
- public void sendNotification(String notificationName, Object body) {
- facade.sendNotification(notificationName, body);
- }
-
- /**
- * Send an
- *
- * Keeps us from having to construct new notification instances in our
- * implementation code.
- *
- * @param notificationName the name of the notiification to send
- */
-
- public void sendNotification(String notificationName) {
- facade.sendNotification(notificationName);
- }
-
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/observer/BaseObserver.java b/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/observer/BaseObserver.java
deleted file mode 100644
index e4dc821a..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/observer/BaseObserver.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.patterns.observer;
-
-
-/**
- * A base
- *
- * An
- *
- * In PureMVC, the
- *
- * The notification method on the interested object should take one
- * parameter of type
- *
- * The notification method should take one parameter of type
- *
- *
- * PureMVC does not rely upon underlying event models such as the one provided
- * with Flash, and ActionScript 3 does not have an inherent event model.
- *
- *
- * The Observer Pattern as implemented within PureMVC exists to support
- * event-driven communication between the application and the actors of the MVC
- * triad.
- *
- *
- * Notifications are not meant to be a replacement for Events in
- * Flex/Flash/Apollo. Generally,
- *
- * A key difference between Flash
- *
- *
- *
- * The
- *
- * The
- *
- * Convenience method to prevent having to construct new notification
- * instances in our implementation code.
- *
- *
- * Convenience method to prevent having to construct new notification
- * instances in our implementation code.
- *
- *
- * Convenience method to prevent having to construct new notification
- * instances in our implementation code.
- *
- *
- * In PureMVC,
- *
- * PureMVC does not rely upon underlying event models such as the one provided
- * with Flash, and ActionScript 3 does not have an inherent event model.
- *
- *
- * The Observer Pattern as implemented within PureMVC exists to support event
- * driven communication between the application and the actors of the MVC triad.
- *
- *
- * An Observer is an object that encapsulates information about an interested
- * object with a notification method that should be called when an INotification
- * is broadcast. The Observer then acts as a proxy for notifying the interested
- * object.
- *
- *
- * Observers can receive
- *
- * The notification method should take one parameter of type
- *
- *
- * In PureMVC,
- *
- * A
- *
- *
- *
- * In PureMVC,
- * Additionally, In PureMVC, the Your application must register The simplest way is to subclass This Initialize the Singleton Called automatically by the constructor. Note that if you are using a subclass of If an Register a particular If an The Observer for the new ICommand is only created if this the
+ * first time an ICommand has been regisered for this Notification name. Remove a previously registered Check if a Command is registered for a given Notification A Singleton In PureMVC, the The Your application must register Constructor. This Initialize the Singleton Called automatically by the constructor, this
+ * is your opportunity to initialize the Singleton
+ * instance in your subclass without overriding the
+ * constructor. Register an Retrieve an Check if a Proxy is registered Remove an A Singleton In PureMVC, the Constructor. This View Singleton Factory method. Initialize the Singleton View instance. Called automatically by the constructor, this
+ * is your opportunity to initialize the Singleton
+ * instance in your subclass without overriding the
+ * constructor. Register an Notify the All previously attached Remove the observer for a given notifyContext from an observer list for a given Notification name. Registers the If the Events and PureMVC
- * Notifications is that Events follow the
- * 'Chain of Responsibility' pattern, 'bubbling' up the display hierarchy until
- * some parent component handles the Event, while PureMVC
- * Notifications follow a 'Publish/Subscribe' pattern. PureMVC
- * classes need not be related to each other in a parent/child relationship in
- * order to communicate with one another using Notifications.
- *
- * @see com.puremvc.patterns.observer Observer
- */
-public class BaseNotification implements Notification {
-
- // the name of the notification instance
- // the type of the notification instance
- protected String name = null;
- protected String type = null;
-
- // the body of the notification instance
- protected Object body = null;
-
- /**
- * Constructor.
- *
- * @param name name of the Notification instance. (required)
- * @param body the Notification body. (optional)
- * @param type the type of the Notification (optional)
- */
- public BaseNotification(String name, Object body, String type) {
- this.name = name;
- this.body = body;
- this.type = type;
- }
-
- /**
- * Constructor.
- *
- * @param name name of the Notification instance. (required)
- */
- public BaseNotification(String name) {
- this.name = name;
- body = null;
- type = null;
- }
-
- /**
- * Constructor.
- *
- * @param name name of the Notification instance. (required)
- * @param body the Notification body. (optional)
- */
- public BaseNotification(String name, Object body) {
- this.name = name;
- this.body = body;
- type = null;
- }
-
- /**
- * Get the body of the Notification instance.
- *
- * @return the body object.
- */
- public Notification instance.
- *
- * @param body
- */
- public Notification instance.
- *
- * @return the name of the Notification instance.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Get the type of the Notification instance.
- *
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * Set the type of the Notification instance.
- *
- * @param type
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * Get the string representation of the Notification
- * instance.
- *
- * @return the string representation of the Notification
- * instance.
- */
- public String toString() {
- String result = "Notification Name: " + getName() + " Body:";
- if (body != null)
- result += body.toString() + " Type:";
- else
- result += "null Type:";
-
- if (type != null)
- result += type;
- else
- result += "null ";
-
- return result;
- }
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/observer/BaseNotifier.java b/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/observer/BaseNotifier.java
deleted file mode 100644
index 4e77a52b..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/observer/BaseNotifier.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.patterns.observer;
-
-
-import com.puremvc.patterns.facade.SimpleFacade;
-
-/**
- * A Base Notifier implementation.
- * MacroCommand, Command, Mediator and Proxy all
- * have a need to send Notifications.
- * INotifier interface provides a common method called
- * sendNotification that relieves implementation code of the
- * necessity to actually construct Notifications.
- * Notifier class, which all of the above mentioned classes
- * extend, provides an initialized reference to the Facade
- * Singleton, which is required for the convienience method for sending
- * Notifications, but also eases implementation as these classes
- * have frequent Facade interactions and usually require access
- * to the facade anyway.
- * Notifications.
- * INotifications.
- * INotifications.
- * IObserver implementation.
- * Observer is an object that encapsulates information about
- * an interested object with a method that should be called when a particular
- * INotification is broadcast.
- * Observer class assumes these responsibilities:
- *
- *
- *
- * @see com.puremvc.core.View View
- * @see com.puremvc.patterns.observer.Notification Notification
- */
-public class BaseObserver implements Observer {
-
- private Object context;
-
- private Function notify;
-
- /**
- * Constructor.
- * INotification
- * INotification to pass to the interested
- * object's notification method.
- */
- public void notifyObserver(Notification notification) {
- getNotifyMethod().onNotification(notification);
- }
-
- /**
- * Get the notification method.
- *
- * @return the notification (callback) method of the interested object.
- */
- public Function getNotifyMethod() {
- return notify;
- }
-
- /**
- * Set the notification method.
- * INotification.
- * this) of the
- * interested object.
- */
- public Object getNotifyContext() {
- return context;
- }
-
- /**
- * Set the notification context.
- *
- * @param notifyContext the notification context (this) of the interested object.
- */
- public void setNotifyContext(Object notifyContext) {
- context = notifyContext;
- }
-
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/observer/Notification.java b/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/observer/Notification.java
deleted file mode 100644
index f7d7503b..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/observer/Notification.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.patterns.observer;
-
-/**
- * The interface definition for a PureMVC Notification.
- * IMediator implementors place
- * event listeners on their view components, which they then handle in the usual
- * way. This may lead to the broadcast of Notifications to
- * trigger ICommands or to communicate with other
- * IMediators. IProxy and ICommand
- * instances communicate with each other and IMediators by
- * broadcasting INotifications.
- * Events and PureMVC
- * Notifications is that Events follow the
- * 'Chain of Responsibility' pattern, 'bubbling' up the display hierarchy until
- * some parent component handles the Event, while PureMVC
- * Notifications follow a 'Publish/Subscribe' pattern. PureMVC
- * classes need not be related to each other in a parent/child relationship in
- * order to communicate with one another using Notifications.
- *
- * @see com.puremvc.core.View View
- * @see com.puremvc.patterns.observer.Observer Observer
- */
-public interface Notification {
-
- /**
- * Get the name of the INotification instance. No setter,
- * should be set by constructor only
- *
- * @return the name
- */
- String getName();
-
- /**
- * Get the body of the INotification instance
- *
- * @return the body
- */
- INotification instance
- *
- * @param body
- */
- INotification instance
- *
- * @return the type
- */
- String getType();
-
- /**
- * Set the type of the Notification instance
- *
- * @param type the type
- */
- void setType(String type);
-
- /**
- * Get the string representation of the INotification
- * instance
- *
- * @return the string representation of the INotification
- * instance
- */
- String toString();
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/observer/Notifier.java b/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/observer/Notifier.java
deleted file mode 100644
index 1a0774d2..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/observer/Notifier.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.patterns.observer;
-
-/**
- * The interface definition for a PureMVC Notifier.
- * MacroCommand, Command, Mediator and Proxy all
- * have a need to send Notifications.
- * INotifier interface provides a common method called
- * sendNotification that relieves implementation code of the
- * necessity to actually construct Notifications.
- * Notifier class, which all of the above mentioned classes
- * extend, also provides an initialized reference to the Facade
- * Singleton, which is required for the convienience method for sending
- * Notifications, but also eases implementation as these classes
- * have frequent Facade interactions and usually require access
- * to the facade anyway.
- * INotification.
- * INotification.
- * INotification.
- * IObserver implementors assume these
- * responsibilities:
- *
- *
- * Notifications by having their notifyObserver
- * method invoked, passing in an object implementing the INotification
- * interface, such as a subclass of Notification.
- * INotification
- * INotification to pass to the interested
- * object's notification method
- */
- void notifyObserver(Notification notification);
-
- /**
- * Compare the given object to the notificaiton context object.
- *
- * @param object the object to compare.
- * @return boolean indicating if the notification context and the object are
- * the same.
- */
- boolean compareNotifyContext(Object object);
-
- /**
- * This interface must be implemented by all classes that want to be notified of
- * a notification.
- */
- interface Function {
-
- /**
- * @param notification
- */
- void onNotification(Notification notification);
- }
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/proxy/BaseProxy.java b/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/proxy/BaseProxy.java
deleted file mode 100644
index dc7c69ca..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/proxy/BaseProxy.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.patterns.proxy;
-
-
-import com.puremvc.patterns.observer.BaseNotifier;
-
-/**
- * A base IProxy implementation.
- * Proxy classes are used to manage parts of the
- * application's tools model.
- * Proxy might simply manage a reference to a local tools
- * object, in which case interacting with it might involve setting and getting
- * of its tools in synchronous fashion.
- * Proxy classes are also used to encapsulate the application's
- * interaction with remote services to save or retrieve tools, in which case, we
- * adopt an asyncronous idiom; setting tools (or calling a method) on the
- * Proxy and listening for a Notification to be
- * sent when the Proxy has retrieved the tools from the service.
- * Proxy
- */
- public BaseProxy(String proxyName) {
- if (proxyName != null) {
- this.proxyName = proxyName;
- }
-
- }
-
- /**
- * Get the proxy name
- *
- * @return the proxy name
- */
- public String getProxyName() {
- return proxyName;
- }
-
- /**
- * Get the tools object
- *
- * @return the tools object
- */
- public Object getData() {
- return data;
- }
-
- /**
- * Set the tools object
- *
- * @param data
- */
- public void setData(Object data) {
- this.data = data;
- }
-
- /**
- * Called by the Model when the Proxy is registered
- */
- public void onRegister() {
- }
-
- /**
- * Called by the Model when the Proxy is removed
- */
- public void onRemove() {
- }
-}
diff --git a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/proxy/Proxy.java b/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/proxy/Proxy.java
deleted file mode 100644
index 8dfb86b1..00000000
--- a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/proxy/Proxy.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * ******************************************************************************
- * * Copyright 2015 See AUTHORS file.
- * *
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *****************************************************************************
- */
-package com.puremvc.patterns.proxy;
-
-import com.puremvc.patterns.observer.Notifier;
-
-/**
- * The interface definition for a PureMVC Proxy.
- * Iroxy implementors assume these responsibilities:
- *
- *
- * IProxys typically:
- *
- *
- */
-public interface Proxy extends Notifier {
-
- /**
- * Get the Proxy name
- *
- * @return the Proxy instance name
- */
- String getProxyName();
-
- /**
- * Get the tools object
- *
- * @return the tools as type Object
- */
- Object getData();
-
- /**
- * Set the tools object
- *
- * @param data the tools object
- */
- void setData(Object data);
-
- /**
- * Called by the Model when the Proxy is registered
- */
- void onRegister();
-
- /**
- * Called by the Model when the Proxy is removed
- */
- void onRemove();
-
-}
diff --git a/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/plugins/H2DPluginAdapter.java b/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/plugins/H2DPluginAdapter.java
index 43e0fecf..f9bd1759 100644
--- a/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/plugins/H2DPluginAdapter.java
+++ b/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/plugins/H2DPluginAdapter.java
@@ -19,8 +19,8 @@
package games.rednblack.h2d.common.plugins;
import com.badlogic.ashley.core.Entity;
import com.badlogic.gdx.utils.Array;
-import com.puremvc.patterns.facade.Facade;
import net.mountainblade.modular.Module;
+import org.puremvc.java.interfaces.IFacade;
import java.util.HashMap;
import java.util.Map;
@@ -31,7 +31,7 @@ import java.util.Set;
*/
public abstract class H2DPluginAdapter implements H2DPlugin, Module {
- public Facade facade;
+ public IFacade facade;
protected PluginAPI pluginAPI;
protected String name;
diff --git a/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/plugins/PluginAPI.java b/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/plugins/PluginAPI.java
index 7f03195f..0e49bd75 100644
--- a/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/plugins/PluginAPI.java
+++ b/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/plugins/PluginAPI.java
@@ -27,10 +27,10 @@ import com.badlogic.gdx.scenes.scene2d.Stage;
import games.rednblack.h2d.common.IItemCommand;
import games.rednblack.h2d.common.view.tools.Tool;
import com.kotcrab.vis.ui.widget.VisImageButton;
-import com.puremvc.patterns.facade.Facade;
import games.rednblack.editor.renderer.SceneLoader;
import games.rednblack.h2d.common.vo.CursorData;
import games.rednblack.h2d.common.vo.EditorConfigVO;
+import org.puremvc.java.interfaces.IFacade;
import java.util.HashMap;
import java.util.HashSet;
@@ -50,7 +50,7 @@ public interface PluginAPI {
* Returns MVC facade, to send notifications or commands, and register mediators
* @return Facade
*/
- Facade getFacade();
+ IFacade getFacade();
/**
* Returns Ashley engine of main scene where all entities are located
diff --git a/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/proxy/CursorManager.java b/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/proxy/CursorManager.java
index e5c18097..0fe77c2e 100644
--- a/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/proxy/CursorManager.java
+++ b/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/proxy/CursorManager.java
@@ -23,14 +23,14 @@ import com.badlogic.gdx.graphics.Cursor;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
-import com.puremvc.patterns.proxy.BaseProxy;
import games.rednblack.h2d.common.view.ui.Cursors;
import games.rednblack.h2d.common.vo.CursorData;
+import org.puremvc.java.patterns.proxy.Proxy;
/**
* Created by azakhary on 5/15/2015.
*/
-public class CursorManager extends BaseProxy {
+public class CursorManager extends Proxy {
private static final String TAG = CursorManager.class.getCanonicalName();
public static final String NAME = TAG;
diff --git a/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/view/SettingsNodeValue.java b/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/view/SettingsNodeValue.java
index 6570c209..1fe48402 100644
--- a/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/view/SettingsNodeValue.java
+++ b/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/view/SettingsNodeValue.java
@@ -1,15 +1,15 @@
package games.rednblack.h2d.common.view;
import com.kotcrab.vis.ui.widget.VisTable;
-import com.puremvc.patterns.facade.Facade;
+import org.puremvc.java.interfaces.IFacade;
public abstract class SettingsNodeValueINotifications when their model tools changes.public static const called NAME, if they are not instantiated multiple times.IController implementation.
+ *
+ *
+ * Controller class follows the
+ * 'Command and Controller' strategy, and assumes these
+ * responsibilities:
+ *
+ *
+ *
+ * ICommands
+ * are intended to handle which INotifications.IObserver with
+ * the View for each INotification
+ * that it has an ICommand mapping for.ICommand
+ * to handle a given INotification when notified by the View.ICommand's execute
+ * method, passing in the INotification.ICommands with the
+ * Controller.Facade,
+ * and use its initializeController method to add your
+ * registrations.IController implementation is a Singleton,
+ * so you should not call the constructor
+ * directly, but instead call the static Singleton
+ * Factory method Controller.getInstance()Controller instance.View
+ * in your application, you should also subclass Controller
+ * and override the initializeController method in the
+ * following way:
+ * {@code // ensure that the Controller is talking to my IView implementation
+ * override public function initializeController( ) : void
+ * {
+ * view = MyView.getInstance(() -> new MyView());
+ * }
+ * }
+ *
+ */
+ public void initializeController() {
+ view = View.getInstance(() -> new View());
+ }
+
+ /**
+ * Controller Singleton Factory method.Controller
+ */
+ public synchronized static IController getInstance(SupplierICommand has previously been registered
+ * to handle a the given INotification, then it is executed.INotification
+ */
+ public void executeCommand(INotification notification) {
+ SupplierICommand class as the handler
+ * for a particular INotification.ICommand has already been registered to
+ * handle INotifications with this name, it is no longer
+ * used, the new ICommand is used instead.INotification
+ * @param commandSupplier the Class of the ICommand
+ */
+ public void registerCommand(String notificationName, SupplierICommand to INotification mapping.INotification to remove the ICommand mapping for
+ */
+ public void removeCommand(String notificationName) {
+ if(hasCommand(notificationName)) {
+ view.removeObserver(notificationName, this);
+ commandMap.remove(notificationName);
+ }
+ }
+
+ /**
+ * notificationName.
+ */
+ public boolean hasCommand(String notificationName) {
+ return commandMap.get(notificationName) != null;
+ }
+
+}
diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/core/Model.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/core/Model.java
new file mode 100644
index 00000000..a1b9b9f6
--- /dev/null
+++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/core/Model.java
@@ -0,0 +1,137 @@
+//
+// PureMVC Java Standard
+//
+// Copyright(c) 2019 Saad Shams IModel implementation.Model class provides
+ * access to model objects (Proxies) by named lookup.Model assumes these responsibilities:
+ *
+ *
+ * IProxy instances.IProxy instances.IProxy instances
+ * with the Model. Typically, you use an
+ * ICommand to create and register IProxy
+ * instances once the Facade has initialized the Core
+ * actors.IModel implementation is a Singleton,
+ * so you should not call the constructor
+ * directly, but instead call the static Singleton
+ * Factory method Model.getInstance()Model instance.Model Singleton Factory method.IProxy with the Model.IProxy to be held by the Model.
+ */
+ public void registerProxy(IProxy proxy) {
+ proxyMap.put(proxy.getProxyName(), proxy);
+ proxy.onRegister();
+ }
+
+ /**
+ * IProxy from the Model.IProxy instance previously registered with the given proxyName.
+ */
+ public IProxy retrieveProxy(String proxyName) {
+ return proxyMap.get(proxyName);
+ }
+
+ /**
+ * proxyName.
+ */
+ public boolean hasProxy(String proxyName) {
+ return proxyMap.containsKey(proxyName);
+ }
+
+ /**
+ * IProxy from the Model.IProxy instance to be removed.
+ * @return the IProxy that was removed from the Model
+ */
+ public IProxy removeProxy(String proxyName) {
+ IProxy proxy = proxyMap.get(proxyName);
+ if(proxy != null) {
+ proxyMap.remove(proxyName);
+ proxy.onRemove();
+ }
+ return proxy;
+ }
+
+}
diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/core/View.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/core/View.java
new file mode 100644
index 00000000..194a22af
--- /dev/null
+++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/core/View.java
@@ -0,0 +1,251 @@
+//
+// PureMVC Java Standard
+//
+// Copyright(c) 2019 Saad Shams IView implementation.View class assumes these responsibilities:
+ *
+ *
+ * @see org.puremvc.java.patterns.mediator.Mediator Mediator
+ * @see org.puremvc.java.patterns.observer.Observer Observer
+ * @see org.puremvc.java.patterns.observer.Notification Notification
+ */
+public class View implements IView {
+
+ // Mapping of Mediator names to Mediator instances
+ protected ConcurrentMapIMediator instances.IMediators.IMediators when they are registered or removed.INotification in the application.IObservers to an INotification's observer list.INotification.IObservers of a given INotification when it broadcast.IView implementation is a Singleton,
+ * so you should not call the constructor
+ * directly, but instead call the static Singleton
+ * Factory method View.getInstance()View
+ */
+ public synchronized static IView getInstance(SupplierIObserver to be notified
+ * of INotifications with a given name.INotifications to notify this IObserver of
+ * @param observer the IObserver to register
+ */
+ public void registerObserver(String notificationName, IObserver observer) {
+ if(observerMap.get(notificationName) != null) {
+ observerMap.get(notificationName).add(observer);
+ } else {
+ observerMap.put(notificationName, new ArrayList<>(Arrays.asList(observer)));
+ }
+ }
+
+ /**
+ * IObservers for a particular INotification.IObservers for this INotification's
+ * list are notified and are passed a reference to the INotification in
+ * the order in which they were registered.INotification to notify IObservers of.
+ */
+ public void notifyObservers(INotification notification) {
+ if(observerMap.get(notification.getName()) != null) {
+ // Get a reference to the observers list for this notification name
+ ListIMediator instance with the View.IMediator so that it can be retrieved by name,
+ * and further interrogates the IMediator for its
+ * INotification interests.IMediator returns any INotification
+ * names to be notified about, an Observer is created encapsulating
+ * the IMediator instance's handleNotification method
+ * and registering it as an Observer for all INotifications the
+ * IMediator is interested in.IMediator instance
+ */
+ public void registerMediator(IMediator mediator) {
+ // do not allow re-registration (you must to removeMediator fist)
+ if(mediatorMap.get(mediator.getMediatorName()) != null) return;
+
+ // Register the Mediator for retrieval by name
+ mediatorMap.put(mediator.getMediatorName(), mediator);
+
+ // Get Notification interests, if any.
+ String[] interests = mediator.listNotificationInterests();
+
+ // Register Mediator as an observer for each of its notification interests
+ if(interests.length > 0) {
+ // Create Observer referencing this mediator's handlNotification method
+ IObserver observer = new Observer(mediator::handleNotification, mediator);
+
+ // Register Mediator as Observer for its list of Notification interests
+ for(int i=0; iIMediator from the View.
IMediator instance to retrieve.
+ * @return the IMediator instance previously registered with the given mediatorName.
+ */
+ public IMediator retrieveMediator(String mediatorName) {
+ return mediatorMap.get(mediatorName);
+ }
+
+ /**
+ * Remove an IMediator from the View.
IMediator instance to be removed.
+ * @return the IMediator that was removed from the View
+ */
+ public IMediator removeMediator(String mediatorName) {
+ // Retrieve the named mediator
+ IMediator mediator = mediatorMap.get(mediatorName);
+
+ if(mediator != null) {
+ // for every notification this mediator is interested in...
+ String[] interests = mediator.listNotificationInterests();
+ for(int i=0; imediatorName.
+ */
+ public boolean hasMediator(String mediatorName) {
+ return mediatorMap.containsKey(mediatorName);
+ }
+
+}
diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/ICommand.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/ICommand.java
new file mode 100644
index 00000000..8a8c4d59
--- /dev/null
+++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/ICommand.java
@@ -0,0 +1,24 @@
+//
+// PureMVC Java Standard
+//
+// Copyright(c) 2019 Saad Shams Execute the ICommand's logic to handle a given INotification.
INotification to handle.
+ */
+ void execute(INotification notification);
+
+}
diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IController.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IController.java
new file mode 100644
index 00000000..f2eee121
--- /dev/null
+++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IController.java
@@ -0,0 +1,67 @@
+//
+// PureMVC Java Standard
+//
+// Copyright(c) 2019 Saad Shams The interface definition for a PureMVC Controller.
+ * + *In PureMVC, an IController implementor
+ * follows the 'Command and Controller' strategy, and
+ * assumes these responsibilities:
ICommands
+ * are intended to handle which INotifications.IObserver with
+ * the View for each INotification
+ * that it has an ICommand mapping for.ICommand
+ * to handle a given INotification when notified by the View.ICommand's execute
+ * method, passing in the INotification.Register a particular ICommand class as the handler
+ * for a particular INotification.
INotification
+ * @param commandSupplier the Supplier Function of the ICommand
+ */
+ void registerCommand(String notificationName, SupplierExecute the ICommand previously registered as the
+ * handler for INotifications with the given notification name.
INotification to execute the associated ICommand for
+ */
+ void executeCommand(INotification notification);
+
+ /**
+ * Remove a previously registered ICommand to INotification mapping.
INotification to remove the ICommand mapping for
+ */
+ void removeCommand(String notificationName);
+
+ /**
+ * Check if a Command is registered for a given Notification
+ * + * @param notificationName notification name + * @return whether a Command is currently registered for the givennotificationName.
+ */
+ boolean hasCommand(String notificationName);
+}
diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IFacade.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IFacade.java
new file mode 100644
index 00000000..a588081f
--- /dev/null
+++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IFacade.java
@@ -0,0 +1,130 @@
+//
+// PureMVC Java Standard
+//
+// Copyright(c) 2019 Saad Shams The interface definition for a PureMVC Facade.
+ * + *The Facade Pattern suggests providing a single + * class to act as a central point of communication + * for a subsystem.
+ * + *In PureMVC, the Facade acts as an interface between + * the core MVC actors (Model, View, Controller) and + * the rest of your application.
+ * + * @see IModel IModel + * @see IView IView + * @see org.puremvc.java.interfaces.IController IController + * @see org.puremvc.java.interfaces.ICommand ICommand + * @see org.puremvc.java.interfaces.INotification INotification + */ +public interface IFacade extends INotifier { + + /** + *Register an IProxy with the Model by name.
IProxy to be registered with the Model.
+ */
+ void registerProxy(IProxy proxy);
+
+ /**
+ * Retrieve a IProxy from the Model by name.
IProxy instance to be retrieved.
+ * @return the IProxy previously regisetered by proxyName with the Model.
+ */
+ Remove an IProxy instance from the Model by name.
IProxy to remove from the Model.
+ * @return the IProxy that was removed from the Model
+ */
+ Check if a Proxy is registered
+ * + * @param proxyName proxy name + * @return whether a Proxy is currently registered with the givenproxyName.
+ */
+ boolean hasProxy(String proxyName);
+
+ /**
+ * Register an ICommand with the Controller.
INotification to associate the ICommand with.
+ * @param commandSupplier a reference to the Command Supplier Function of the ICommand.
+ */
+ void registerCommand(String notificationName, SupplierRemove a previously registered ICommand to INotification mapping from the Controller.
INotification to remove the ICommand mapping for
+ */
+ void removeCommand(String notificationName);
+
+ /**
+ * Check if a Command is registered for a given Notification
+ * + * @param notificationName notification name + * @return whether a Command is currently registered for the givennotificationName.
+ */
+ boolean hasCommand(String notificationName);
+
+ /**
+ * Register an IMediator instance with the View.
IMediator instance
+ */
+ void registerMediator(IMediator mediator);
+
+ /**
+ * Retrieve an IMediator instance from the View.
IMediator instance to retrievve
+ * @return the IMediator previously registered with the given mediatorName.
+ */
+ Remove a IMediator instance from the View.
IMediator instance to be removed.
+ * @return the IMediator instance previously registered with the given mediatorName.
+ */
+ Check if a Mediator is registered or not
+ * + * @param mediatorName mediator name + * @return whether a Mediator is registered with the givenmediatorName.
+ */
+ boolean hasMediator(String mediatorName);
+
+ /**
+ * Notify the IObservers for a particular INotification.
All previously attached IObservers for this INotification's
+ * list are notified and are passed a reference to the INotification in
+ * the order in which they were registered.
NOTE: Use this method only if you are sending custom Notifications. Otherwise + * use the sendNotification method which does not require you to create the + * Notification instance.
+ * + * @param notification theINotification to notify IObservers of.
+ */
+ void notifyObservers(INotification notification);
+}
diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IMediator.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IMediator.java
new file mode 100644
index 00000000..92c9902d
--- /dev/null
+++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IMediator.java
@@ -0,0 +1,149 @@
+//
+// PureMVC Java Standard
+//
+// Copyright(c) 2019 Saad Shams The interface definition for a PureMVC Mediator.
+ * + *In PureMVC, IMediator implementors assume these responsibilities:
INotifications
+ * the IMediator has interest in.Additionally, IMediators typically:
INotifications, interacting with of
+ * the rest of the PureMVC app.When an IMediator is registered with the IView,
+ * the IView will call the IMediator's
+ * listNotificationInterests method. The IMediator will
+ * return an Array of INotification names which
+ * it wishes to be notified about.
The IView will then create an Observer object
+ * encapsulating that IMediator's (handleNotification) method
+ * and register it as an Observer for each INotification name returned by
+ * listNotificationInterests.
A concrete IMediator implementor usually looks something like this:
+ * + *
+ * {@code import org.puremvc.as3.multicore.patterns.mediator.*;
+ * import org.puremvc.as3.multicore.patterns.observer.*;
+ * import org.puremvc.as3.multicore.core.view.*;
+ *
+ * import com.me.myapp.model.*;
+ * import com.me.myapp.view.*;
+ * import com.me.myapp.controller.*;
+ *
+ * import javax.swing.JComboBox;
+ * import java.awt.event.ActionListener;
+ *
+ * public class MyMediator extends Mediator implements IMediator, ActionListener {
+ *
+ * public MyMediator( Object viewComponent ) {
+ * super( viewComponent );
+ * combo.addActionListener( this );
+ * }
+ *
+ * public String[] listNotificationInterests() {
+ * return [ MyFacade.SET_SELECTION,
+ * MyFacade.SET_DATAPROVIDER ];
+ * }
+ *
+ * public void handleNotification( INotification notification ) {
+ * switch ( notification.getName() ) {
+ * case MyFacade.SET_SELECTION:
+ * setSelection(notification);
+ * break;
+ * case MyFacade.SET_DATAPROVIDER:
+ * setDataProvider(notification);
+ * break;
+ * }
+ * }
+ *
+ * // Set the data provider of the combo box
+ * protected void setDataProvider( INotification notification ) {
+ * combo.setModel(ComboBoxModel(notification.getBody()));
+ * }
+ *
+ * // Invoked when the combo box dispatches a change event, we send a
+ * // notification with the
+ * public void actionPerformed(ActionEvent event) {
+ * sendNotification( MyFacade.MYCOMBO_CHANGED, this );
+ * }
+ *
+ * // A private getter for accessing the view object by class
+ * protected JComboBox getViewComponent() {
+ * return viewComponent;
+ * }
+ *
+ * }
+ * }
+ *
+ *
+ * @see org.puremvc.java.interfaces.INotification INotification
+ */
+public interface IMediatorGet the IMediator instance name
IMediator instance name
+ */
+ String getMediatorName();
+
+ /**
+ * Get the IMediator's view component.
Set the IMediator's view component.
List INotification interests.
Array of the INotification names this IMediator has an interest in.
+ */
+ String[] listNotificationInterests();
+
+ /**
+ * Handle an INotification.
INotification to be handled
+ */
+ void handleNotification(INotification notification);
+
+ /**
+ * Called by the View when the Mediator is registered
+ */ + void onRegister(); + + /** + *Called by the View when the Mediator is removed
+ */ + void onRemove(); +} diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IModel.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IModel.java new file mode 100644 index 00000000..e263b64c --- /dev/null +++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IModel.java @@ -0,0 +1,55 @@ +// +// PureMVC Java Standard +// +// Copyright(c) 2019 Saad ShamsThe interface definition for a PureMVC Model.
+ * + *In PureMVC, IModel implementors provide
+ * access to IProxy objects by named lookup.
An IModel assumes these responsibilities:
IProxy instancesIProxy instancesRegister an IProxy instance with the Model.
Model.
+ */
+ void registerProxy(IProxy proxy);
+
+ /**
+ * Retrieve an IProxy instance from the Model.
IProxy instance previously registered with the given proxyName.
+ */
+ Remove an IProxy instance from the Model.
IProxy instance to be removed.
+ * @return the IProxy that was removed from the Model
+ */
+ Check if a Proxy is registered
+ * + * @param proxyName proxy name + * @return whether a Proxy is currently registered with the givenproxyName.
+ */
+ boolean hasProxy(String proxyName);
+}
diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/INotification.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/INotification.java
new file mode 100644
index 00000000..eb4632e4
--- /dev/null
+++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/INotification.java
@@ -0,0 +1,86 @@
+//
+// PureMVC Java Standard
+//
+// Copyright(c) 2019 Saad Shams The interface definition for a PureMVC Notification.
+ * + *PureMVC does not rely upon underlying event models such + * as the one provided with Flash, and ActionScript 3 does + * not have an inherent event model.
+ * + *The Observer Pattern as implemented within PureMVC exists + * to support event-driven communication between the + * application and the actors of the MVC triad.
+ * + *Notifications are not meant to be a replacement for Events
+ * in Flex/Flash/AIR. Generally, IMediator implementors
+ * place event listeners on their view components, which they
+ * then handle in the usual way. This may lead to the broadcast of Notifications to
+ * trigger ICommands or to communicate with other IMediators. IProxy and ICommand
+ * instances communicate with each other and IMediators
+ * by broadcasting INotifications.
A key difference between Flash Events and PureMVC
+ * Notifications is that Events follow the
+ * 'Chain of Responsibility' pattern, 'bubbling' up the display hierarchy
+ * until some parent component handles the Event, while
+ * PureMVC Notifications follow a 'Publish/Subscribe'
+ * pattern. PureMVC classes need not be related to each other in a
+ * parent/child relationship in order to communicate with one another
+ * using Notifications.
Get the name of the INotification instance.
+ * No setter, should be set by constructor only
Set the body of the INotification instance
Get the body of the INotification instance
Set the type of the INotification instance
Get the type of the INotification instance
Get the string representation of the INotification instance
INotification
+ */
+ String toString();
+
+}
diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/INotifier.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/INotifier.java
new file mode 100644
index 00000000..6dc3f8c0
--- /dev/null
+++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/INotifier.java
@@ -0,0 +1,64 @@
+//
+// PureMVC Java Standard
+//
+// Copyright(c) 2019 Saad Shams The interface definition for a PureMVC Notifier.
+ * + *MacroCommand, Command, Mediator and Proxy
+ * all have a need to send Notifications.
The INotifier interface provides a common method called
+ * sendNotification that relieves implementation code of
+ * the necessity to actually construct Notifications.
The Notifier class, which all of the above mentioned classes
+ * extend, also provides an initialized reference to the Facade
+ * Singleton, which is required for the convienience method
+ * for sending Notifications, but also eases implementation as these
+ * classes have frequent Facade interactions and usually require
+ * access to the facade anyway.
Send a INotification.
Convenience method to prevent having to construct new + * notification instances in our implementation code.
+ * + * @param notificationName the name of the notification to send + * @param body the body of the notification + * @param type the type of the notification + */ + void sendNotification(String notificationName, Object body, String type); + + /** + *Send a INotification.
Convenience method to prevent having to construct new + * notification instances in our implementation code.
+ * + * @param notificationName the name of the notification to send + * @param body the body of the notification + */ + void sendNotification(String notificationName, Object body); + + /** + *Send a INotification.
Convenience method to prevent having to construct new + * notification instances in our implementation code.
+ * + * @param notificationName the name of the notification to send + */ + void sendNotification(String notificationName); +} diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IObserver.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IObserver.java new file mode 100644 index 00000000..95a4e53d --- /dev/null +++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IObserver.java @@ -0,0 +1,81 @@ +// +// PureMVC Java Standard +// +// Copyright(c) 2019 Saad ShamsThe interface definition for a PureMVC Observer.
+ * + *In PureMVC, IObserver implementors assume these responsibilities:
PureMVC does not rely upon underlying event + * models such as the one provided with Flash, + * and ActionScript 3 does not have an inherent + * event model.
+ * + *The Observer Pattern as implemented within + * PureMVC exists to support event driven communication + * between the application and the actors of the + * MVC triad.
+ * + *An Observer is an object that encapsulates information
+ * about an interested object with a notification method that
+ * should be called when an INotification is broadcast. The Observer then
+ * acts as a proxy for notifying the interested object.
Observers can receive Notifications by having their
+ * notifyObserver method invoked, passing
+ * in an object implementing the INotification interface, such
+ * as a subclass of Notification.
Set the notification method.
+ * + *The notification method should take one parameter of type INotification
Set the notification context.
+ * + * @param notifyContext the notification context (this) of the interested object + */ + void setNotifyContext(Object notifyContext); + + /** + *Notify the interested object.
+ * + * @param notification theINotification to pass to the interested object's notification method
+ */
+ void notifyObserver(INotification notification);
+
+ /**
+ * Compare the given object to the notification context object.
+ * + * @param object the object to compare. + * @return boolean indicating if the notification context and the object are the same. + */ + boolean compareNotifyContext(Object object); + +} + diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IProxy.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IProxy.java new file mode 100644 index 00000000..98fc0b76 --- /dev/null +++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IProxy.java @@ -0,0 +1,62 @@ +// +// PureMVC Java Standard +// +// Copyright(c) 2019 Saad ShamsThe interface definition for a PureMVC Proxy.
+ * + *In PureMVC, IProxy implementors assume these responsibilities:
Additionally, IProxys typically:
INotifications when their model data changes.public static const called NAME, if they are not instantiated multiple times.Get the Proxy name
+ * + * @return the Proxy instance name + */ + String getProxyName(); + + /** + *Set the data object
+ * + * @param data the data object + */ + void setData(Object data); + + /** + *Get the data object
+ * + * @return the data as type Object + */ + Object getData(); + + /** + *Called by the Model when the Proxy is registered
+ */ + void onRegister(); + + /** + *Called by the Model when the Proxy is removed
+ */ + void onRemove(); +} diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IView.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IView.java new file mode 100644 index 00000000..9c7a74b5 --- /dev/null +++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/interfaces/IView.java @@ -0,0 +1,100 @@ +// +// PureMVC Java Standard +// +// Copyright(c) 2019 Saad ShamsThe interface definition for a PureMVC View.
+ * + *In PureMVC, IView implementors assume these responsibilities:
In PureMVC, the View class assumes these responsibilities:
IMediator instances.IMediators.INotification in the application.IObservers to an INotification's observer list.INotification.IObservers of a given INotification when it broadcast.Register an IObserver to be notified
+ * of INotifications with a given name.
INotifications to notify this IObserver of
+ * @param observer the IObserver to register
+ */
+ void registerObserver(String notificationName, IObserver observer);
+
+ /**
+ * Remove a group of observers from the observer list for a given Notification name.
+ * + * @param notificationName which observer list to remove from + * @param notifyContext removed the observers with this object as their notifyContext + */ + void removeObserver(String notificationName, Object notifyContext); + + /** + *Notify the IObservers for a particular INotification.
All previously attached IObservers for this INotification's
+ * list are notified and are passed a reference to the INotification in
+ * the order in which they were registered.
INotification to notify IObservers of.
+ */
+ void notifyObservers(INotification notification);
+
+ /**
+ * Register an IMediator instance with the View.
Registers the IMediator so that it can be retrieved by name,
+ * and further interrogates the IMediator for its
+ * INotification interests.
If the IMediator returns any INotification
+ * names to be notified about, an Observer is created encapsulating
+ * the IMediator instance's handleNotification method
+ * and registering it as an Observer for all INotifications the
+ * IMediator is interested in.
IMediator instance
+ */
+ void registerMediator(IMediator mediator);
+
+ /**
+ * Retrieve an IMediator from the View.
IMediator instance to retrieve.
+ * @return the IMediator instance previously registered with the given mediatorName.
+ */
+ Remove an IMediator from the View.
IMediator instance to be removed.
+ * @return the IMediator that was removed from the View
+ */
+ Check if a Mediator is registered or not
+ * + * @param mediatorName mediator name + * @return whether a Mediator is registered with the givenmediatorName.
+ */
+ boolean hasMediator(String mediatorName);
+}
diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/command/MacroCommand.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/command/MacroCommand.java
new file mode 100644
index 00000000..7fff4053
--- /dev/null
+++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/command/MacroCommand.java
@@ -0,0 +1,111 @@
+//
+// PureMVC Java Standard
+//
+// Copyright(c) 2019 Saad Shams A base ICommand implementation that executes other ICommands.
A MacroCommand maintains an list of
+ * ICommand Class references called SubCommands.
When execute is called, the MacroCommand
+ * instantiates and calls execute on each of its SubCommands turn.
+ * Each SubCommand will be passed a reference to the original
+ * INotification that was passed to the MacroCommand's
+ * execute method.
Unlike SimpleCommand, your subclass
+ * should not override execute, but instead, should
+ * override the initializeMacroCommand method,
+ * calling addSubCommand once for each SubCommand
+ * to be executed.
Constructor.
+ * + *You should not need to define a constructor,
+ * instead, override the initializeMacroCommand
+ * method.
If your subclass does define a constructor, be
+ * sure to call super().
Initialize the MacroCommand.
In your subclass, override this method to
+ * initialize the MacroCommand's SubCommand
+ * list with ICommand class references like
+ * this:
+ * {@code
+ * // Initialize MyMacroCommand
+ * protected void initializeMacroCommand( )
+ * {
+ * addSubCommand( () -> new com.me.myapp.controller.FirstCommand() );
+ * addSubCommand( () -> new com.me.myapp.controller.SecondCommand() );
+ * addSubCommand( () -> new com.me.myapp.controller.ThirdCommand() );
+ * }
+ * }
+ *
+ *
+ * Note that SubCommands may be any ICommand implementor,
+ * MacroCommands or SimpleCommands are both acceptable.
Add a SubCommand.
+ * + *The SubCommands will be called in First In/First Out (FIFO) + * order.
+ * + * @param factory a reference to the factory of theICommand.
+ */
+ protected void addSubCommand(SupplierExecute this MacroCommand's SubCommands.
The SubCommands will be called in First In/First Out (FIFO) + * order.
+ * + * @param notification theINotification object to be passsed to each SubCommand.
+ */
+ public void execute(INotification notification) {
+ while(!subCommands.isEmpty()) {
+ SupplierA base ICommand implementation.
Your subclass should override the execute
+ * method where your business logic will handle the INotification.
Fulfill the use-case initiated by the given INotification.
In the Command Pattern, an application use-case typically
+ * begins with some user action, which results in an INotification being broadcast, which
+ * is handled by business logic in the execute method of an
+ * ICommand.
INotification to handle.
+ */
+ public void execute(INotification notification) {
+ }
+}
diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/facade/Facade.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/facade/Facade.java
new file mode 100644
index 00000000..5cb186c7
--- /dev/null
+++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/facade/Facade.java
@@ -0,0 +1,431 @@
+//
+// PureMVC Java Standard
+//
+// Copyright(c) 2019 Saad Shams A base Singleton IFacade implementation.
In PureMVC, the Facade class assumes these
+ * responsibilities:
Model, View
+ * and Controller Singletons.IModel,
+ * IView, & IController interfaces.Model,
+ * View and Controller Singletons created.Commands and notifying ObserversExample usage:
+ *
+ * {@code
+ * import org.puremvc.as3.patterns.facade.Facade;
+ *
+ * import com.me.myapp.model.*;
+ * import com.me.myapp.view.*;
+ * import com.me.myapp.controller.*;
+ *
+ * public class MyFacade extends Facade
+ * {
+ * // Notification constants. The Facade is the ideal
+ * // location for these constants, since any part
+ * // of the application participating in PureMVC
+ * // Observer Notification will know the Facade.
+ * public static final String GO_COMMAND = "go";
+ *
+ * // Override Singleton Factory method
+ * public synchronized static IFacade getInstance(Supplier facadeSupplier) {
+ * if(instance == null) instance = facadeSupplier.get();
+ * return instance;
+ * }
+ *
+ * // optional initialization hook for Facade
+ * public void initializeFacade() {
+ * super.initializeFacade();
+ * // do any special subclass initialization here
+ * }
+ *
+ * // optional initialization hook for Controller
+ * public void initializeController() {
+ * // call super to use the PureMVC Controller Singleton.
+ * super.initializeController();
+ *
+ * // Otherwise, if you're implmenting your own
+ * // IController, then instead do:
+ * // if ( controller != null ) return;
+ * // controller = MyAppController.getInstance(() -> new MyAppController());
+ *
+ * // do any special subclass initialization here
+ * // such as registering Commands
+ * registerCommand( GO_COMMAND, () -> new com.me.myapp.controller.GoCommand() )
+ * }
+ *
+ * // optional initialization hook for Model
+ * public void initializeModel() {
+ * // call super to use the PureMVC Model Singleton.
+ * super.initializeModel();
+ *
+ * // Otherwise, if you're implmenting your own
+ * // IModel, then instead do:
+ * // if ( model != null ) return;
+ * // model = MyAppModel.getInstance(() -> new MyAppModel());
+ *
+ * // do any special subclass initialization here
+ * // such as creating and registering Model proxys
+ * // that don't require a facade reference at
+ * // construction time, such as fixed type lists
+ * // that never need to send Notifications.
+ * registerProxy( new USStateNamesProxy() );
+ *
+ * // CAREFUL: Can't reference Facade instance in constructor
+ * // of new Proxys from here, since this step is part of
+ * // Facade construction! Usually, Proxys needing to send
+ * // notifications are registered elsewhere in the app
+ * // for this reason.
+ * }
+ *
+ * // optional initialization hook for View
+ * public void initializeView() {
+ * // call super to use the PureMVC View Singleton.
+ * super.initializeView();
+ *
+ * // Otherwise, if you're implmenting your own
+ * // IView, then instead do:
+ * // if ( view != null ) return;
+ * // view = MyAppView.getInstance(() -> new MyAppView());
+ *
+ * // do any special subclass initialization here
+ * // such as creating and registering Mediators
+ * // that do not need a Facade reference at construction
+ * // time.
+ * registerMediator( new LoginMediator() );
+ *
+ * // CAREFUL: Can't reference Facade instance in constructor
+ * // of new Mediators from here, since this is a step
+ * // in Facade construction! Usually, all Mediators need
+ * // receive notifications, and are registered elsewhere in
+ * // the app for this reason.
+ * }
+ * }
+ * }
+ *
+ *
+ * @see Model Model
+ * @see View View
+ * @see Controller Controller
+ * @see org.puremvc.java.patterns.observer.Notification Notification
+ * @see org.puremvc.java.patterns.mediator.Mediator Mediator
+ * @see org.puremvc.java.patterns.proxy.Proxy Proxy
+ * @see org.puremvc.java.patterns.command.SimpleCommand SimpleCommand
+ * @see org.puremvc.java.patterns.command.MacroCommand MacroCommand
+ */
+public class Facade implements IFacade {
+
+ // Private references to Model, View and Controlle
+ protected IController controller;
+ protected IModel model;
+ protected IView view;
+
+ // The Singleton Facade instance.
+ protected static IFacade instance;
+
+ // Message Constants
+ protected final String SINGLETON_MSG = "Facade Singleton already constructed!";
+
+ /**
+ * Constructor.
+ * + *This IFacade implementation is a Singleton,
+ * so you should not call the constructor
+ * directly, but instead call the static Singleton
+ * Factory method Facade.getInstance()
Initialize the Singleton Facade instance.
Called automatically by the constructor. Override in your
+ * subclass to do any subclass specific initializations. Be
+ * sure to call super.initializeFacade(), though.
Facade Singleton Factory method
+ * + * @param factory facade Supplier Function + * @return the Singleton instance of the Facade + */ + public synchronized static IFacade getInstance(SupplierInitialize the Controller.
Called by the initializeFacade method.
+ * Override this method in your subclass of Facade
+ * if one or both of the following are true:
IController.Commands to register with the Controller at startup.If you don't want to initialize a different IController,
+ * call super.initializeController() at the beginning of your
+ * method, then register Commands.
Initialize the Model.
Called by the initializeFacade method.
+ * Override this method in your subclass of Facade
+ * if one or both of the following are true:
IModel.Proxys to register with the Model that do not
+ * retrieve a reference to the Facade at construction time.If you don't want to initialize a different IModel,
+ * call super.initializeModel() at the beginning of your
+ * method, then register Proxys.
Note: This method is rarely overridden; in practice you are more
+ * likely to use a Command to create and register Proxys
+ * with the Model, since Proxys with mutable data will likely
+ * need to send INotifications and thus will likely want to fetch a reference to
+ * the Facade during their construction.
Initialize the View.
Called by the initializeFacade method.
+ * Override this method in your subclass of Facade
+ * if one or both of the following are true:
IView.Observers to register with the ViewIf you don't want to initialize a different IView,
+ * call super.initializeView() at the beginning of your
+ * method, then register IMediator instances.
Note: This method is rarely overridden; in practice you are more
+ * likely to use a Command to create and register Mediators
+ * with the View, since IMediator instances will need to send
+ * INotifications and thus will likely want to fetch a reference
+ * to the Facade during their construction.
Register an ICommand with the Controller by Notification name.
INotification to associate the ICommand with
+ * @param commandSupplier a reference to the Supplier Function of the ICommand
+ */
+ public void registerCommand(String notificationName, SupplierRemove a previously registered ICommand to INotification mapping from the Controller.
INotification to remove the ICommand mapping for
+ */
+ public void removeCommand(String notificationName) {
+ controller.removeCommand(notificationName);
+ }
+
+ /**
+ * Check if a Command is registered for a given Notification
+ * + * @param notificationName notification name + * @return whether a Command is currently registered for the givennotificationName.
+ */
+ public boolean hasCommand(String notificationName) {
+ return controller.hasCommand(notificationName);
+ }
+
+ /**
+ * Register an IProxy with the Model by name.
IProxy instance to be registered with the Model.
+ */
+ public void registerProxy(IProxy proxy) {
+ model.registerProxy(proxy);
+ }
+
+ /**
+ * Retrieve an IProxy from the Model by name.
IProxy instance previously registered with the given proxyName.
+ */
+ public Remove an IProxy from the Model by name.
IProxy to remove from the Model.
+ * @return the IProxy that was removed from the Model
+ */
+ public Check if a Proxy is registered
+ * + * @param proxyName proxy name + * @return whether a Proxy is currently registered with the givenproxyName.
+ */
+ public boolean hasProxy(String proxyName) {
+ return model.hasProxy(proxyName);
+ }
+
+ /**
+ * Register a IMediator with the View.
IMediator
+ */
+ public void registerMediator(IMediator mediator) {
+ view.registerMediator(mediator);
+ }
+
+ /**
+ * Retrieve an IMediator from the View.
IMediator previously registered with the given mediatorName.
+ */
+ public Remove an IMediator from the View.
IMediator to be removed.
+ * @return the IMediator that was removed from the View
+ */
+ public Check if a Mediator is registered or not
+ * + * @param mediatorName mediator name + * @return whether a Mediator is registered with the givenmediatorName.
+ */
+ public boolean hasMediator(String mediatorName) {
+ return view.hasMediator(mediatorName);
+ }
+
+ /**
+ * Create and send an INotification.
Keeps us from having to construct new notification + * instances in our implementation code.
+ * + * @param notificationName the name of the notiification to send + * @param body the body of the notification + * @param type the type of the notification + */ + public void sendNotification(String notificationName, Object body, String type) { + notifyObservers(new Notification(notificationName, body, type)); + } + + /** + *Create and send an INotification.
Keeps us from having to construct new notification + * instances in our implementation code.
+ * + * @param notificationName the name of the notiification to send + * @param body the body of the notification + */ + public void sendNotification(String notificationName, Object body) { + sendNotification(notificationName, body, null); + } + + /** + *Create and send an INotification.
Keeps us from having to construct new notification + * instances in our implementation code.
+ * + * @param notificationName the name of the notiification to send + */ + public void sendNotification(String notificationName) { + sendNotification(notificationName, null, null); + } + + /** + *Notify Observers.
This method is left public mostly for backward + * compatibility, and to allow you to send custom + * notification classes using the facade.
+ * + *Usually you should just call sendNotification + * and pass the parameters, never having to + * construct the notification yourself.
+ * + * @param notification theINotification to have the View notify Observers of.
+ */
+ public void notifyObservers(INotification notification) {
+ view.notifyObservers(notification);
+ }
+
+}
diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/mediator/Mediator.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/mediator/Mediator.java
new file mode 100644
index 00000000..0bb1869b
--- /dev/null
+++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/mediator/Mediator.java
@@ -0,0 +1,136 @@
+//
+// PureMVC Java Standard
+//
+// Copyright(c) 2019 Saad Shams A base IMediator implementation.
The name of the Mediator.
Typically, a Mediator will be written to serve
+ * one specific control or group controls and so,
+ * will not have a need to be dynamically named.
Constructor.
+ * + * @param mediatorName mediator name + * @param viewComponent view component + */ + public Mediator(String mediatorName, V viewComponent) { + this.mediatorName = mediatorName != null ? mediatorName : NAME; + this.viewComponent = viewComponent; + } + + /** + *Constructor.
+ * + * @param mediatorName mediator name + */ + public Mediator(String mediatorName) { + this(mediatorName, null); + } + + /** + *Constructor.
+ */ + public Mediator() { + this(null, null); + } + + /** + *List the INotification names this
+ * Mediator is interested in being notified of.
INotification names
+ */
+ public String[] listNotificationInterests() {
+ return new String[0];
+ }
+
+ /**
+ * Handle INotifications.
Typically this will be handled in a switch statement,
+ * with one 'case' entry per INotification
+ * the Mediator is interested in.
Called by the View when the Mediator is registered
+ */ + public void onRegister() { + + } + + /** + *Called by the View when the Mediator is removed
+ */ + public void onRemove() { + + } + + /** + *Get the name of the Mediator.
Get the Mediator's view component.
Additionally, an implicit getter will usually + * be defined in the subclass that casts the view + * object to a type, like this:
+ * + * {@code + * public javax.swing.JComboBox getViewComponent() + * { + * return viewComponent; + * } + *} + * + * @return the view component + */ + public V getViewComponent() { + return viewComponent; + } + + /** + *Set the IMediator's view component.
A base INotification implementation.
PureMVC does not rely upon underlying event models such + * as the one provided with Flash, and ActionScript 3 does + * not have an inherent event model.
+ * + *The Observer Pattern as implemented within PureMVC exists + * to support event-driven communication between the + * application and the actors of the MVC triad.
+ * + *Notifications are not meant to be a replacement for Events
+ * in Flex/Flash/Apollo. Generally, IMediator implementors
+ * place event listeners on their view components, which they
+ * then handle in the usual way. This may lead to the broadcast of Notifications to
+ * trigger ICommands or to communicate with other IMediators. IProxy and ICommand
+ * instances communicate with each other and IMediators
+ * by broadcasting INotifications.
A key difference between Flash Events and PureMVC
+ * Notifications is that Events follow the
+ * 'Chain of Responsibility' pattern, 'bubbling' up the display hierarchy
+ * until some parent component handles the Event, while
+ * PureMVC Notifications follow a 'Publish/Subscribe'
+ * pattern. PureMVC classes need not be related to each other in a
+ * parent/child relationship in order to communicate with one another
+ * using Notifications.
Constructor.
+ * + * @param name name of theNotification instance. (required)
+ * @param body the Notification body.
+ * @param type the type of the Notification
+ */
+ public Notification(String name, Object body, String type) {
+ this.name = name;
+ this.body = body;
+ this.type = type;
+ }
+
+ /**
+ * Constructor.
+ * + * @param name name of theNotification instance.
+ * @param body the Notification body.
+ */
+ public Notification(String name, Object body) {
+ this(name, body, null);
+ }
+
+ /**
+ * Constructor.
+ * + * @param name name of theNotification instance.
+ */
+ public Notification(String name) {
+ this(name, null, null);
+ }
+
+ /**
+ * Get the name of the Notification instance.
Notification instance.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Set the body of the Notification instance.
Get the body of the Notification instance.
Set the type of the Notification instance.
Get the type of the Notification instance.
Get the string representation of the Notification instance.
Notification instance.
+ */
+ public String toString() {
+ return new StringBuilder("Notification Name: " + getName())
+ .append("\nBody:" + ((body == null) ? "null" : body.toString()))
+ .append("\nType:" + ((type == null) ? "null" : type))
+ .toString();
+ }
+}
diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/observer/Notifier.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/observer/Notifier.java
new file mode 100644
index 00000000..f47caa81
--- /dev/null
+++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/observer/Notifier.java
@@ -0,0 +1,83 @@
+//
+// PureMVC Java Standard
+//
+// Copyright(c) 2019 Saad Shams A Base INotifier implementation.
MacroCommand, Command, Mediator and Proxy all
+ * have a need to send Notifications.
The INotifier interface provides a common method called
+ * sendNotification that relieves implementation code of the
+ * necessity to actually construct Notifications.
The Notifier class, which all of the above mentioned classes
+ * extend, provides an initialized reference to the Facade
+ * Singleton, which is required for the convienience method for sending
+ * Notifications, but also eases implementation as these classes
+ * have frequent Facade interactions and usually require access
+ * to the facade anyway.
Local reference to the Facade Singleton
+ */ + protected IFacade facade = Facade.getInstance(()-> new Facade()); + + /** + *Send an INotifications.
Keeps us from having to construct new notification instances in our + * implementation code.
+ * + * @param notificationName the name of the notiification to send + * @param body the body of the notification + * @param type the type of the notification + */ + public void sendNotification(String notificationName, Object body, String type) { + facade.sendNotification(notificationName, body, type); + } + + /** + *Send an INotifications.
Keeps us from having to construct new notification instances in our + * implementation code.
+ * + * @param notificationName the name of the notiification to send + * @param body the body of the notification + */ + public void sendNotification(String notificationName, Object body) { + facade.sendNotification(notificationName, body); + } + + /** + *Send an INotifications.
Keeps us from having to construct new notification instances in our + * implementation code.
+ * + * @param notificationName the name of the notiification to send + */ + public void sendNotification(String notificationName) { + facade.sendNotification(notificationName); + } + +} diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/observer/Observer.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/observer/Observer.java new file mode 100644 index 00000000..aa8fb33a --- /dev/null +++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/observer/Observer.java @@ -0,0 +1,115 @@ +// +// PureMVC Java Standard +// +// Copyright(c) 2019 Saad ShamsA base IObserver implementation.
An Observer is an object that encapsulates information
+ * about an interested object with a method that should
+ * be called when a particular INotification is broadcast.
In PureMVC, the Observer class assumes these responsibilities:
Constructor.
+ * + *The notification method on the interested object should take one
+ * parameter of type INotification
Compare an object to the notification context.
+ * + * @param object the object to compare + * @return boolean indicating if the object and the notification context are + * the same + */ + public boolean compareNotifyContext(Object object) { + return object == this.notifyContext; + } + + /** + *Notify the interested object.
+ * + * @param notification theINotification to pass to the interested
+ * object's notification method.
+ */
+ public void notifyObserver(INotification notification) {
+ notifyMethod.accept(notification);
+ }
+
+ /**
+ * Get the notification context.
+ * + * @return the notification context (this) of the
+ * interested object.
+ */
+ protected Object getNotifyContext() {
+ return notifyContext;
+ }
+
+ /**
+ * Set the notification context.
+ * + * @param notifyContext the notification context (this) of the interested object. + */ + public void setNotifyContext(Object notifyContext) { + this.notifyContext = notifyContext; + } + + /** + *Get the notification method.
+ * + * @return the notification (callback) consumer function of the interested object. + */ + protected ConsumerSet the notification method.
+ * + *The notification method should take one parameter of type
+ * INotification.
A base IProxy implementation.
In PureMVC, Proxy classes are used to manage parts of the
+ * application's data model.
A Proxy might simply manage a reference to a local data
+ * object, in which case interacting with it might involve setting and getting
+ * of its data in synchronous fashion.
Proxy classes are also used to encapsulate the application's
+ * interaction with remote services to save or retrieve data, in which case, we
+ * adopt an asyncronous idiom; setting data (or calling a method) on the
+ * Proxy and listening for a Notification to be
+ * sent when the Proxy has retrieved the data from the service.
Constructor
+ * + * @param proxyName proxy name + * @param data data object + */ + public Proxy(String proxyName, Object data) { + this.proxyName = (proxyName != null) ? proxyName : NAME; + if(data != null) setData(data); + } + + /** + *Constructor
+ * + * @param proxyName Name of theProxy
+ */
+ public Proxy(String proxyName) {
+ this(proxyName, null);
+ }
+
+ /**
+ * Constructor
+ */ + public Proxy(){ + this(null, null); + } + + /** + *Called by the Model when the Proxy is registered
+ */ + public void onRegister() { + + } + + /** + *Called by the Model when the Proxy is removed
+ */ + public void onRemove() { + + } + + /** + *Get the proxy name
+ * + * @return the proxy name + */ + public String getProxyName() { + return proxyName; + } + + /** + *Get the data object
+ * + * @return the data object + */ + public Object getData() { + return data; + } + + /** + *Set the data object
+ * + * @param data data object + */ + public void setData(Object data) { + this.data = data; + } + +} diff --git a/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/MainPanel.java b/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/MainPanel.java index 76c03b83..b7b8996e 100644 --- a/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/MainPanel.java +++ b/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/MainPanel.java @@ -10,8 +10,8 @@ import com.badlogic.gdx.utils.Align; import com.kotcrab.vis.ui.widget.VisLabel; import com.kotcrab.vis.ui.widget.VisTable; import com.kotcrab.vis.ui.widget.VisTextButton; -import com.puremvc.patterns.facade.SimpleFacade; import games.rednblack.h2d.common.H2DDialog; +import org.puremvc.java.interfaces.IFacade; /** * Created by azakhary on 8/18/2015. @@ -21,7 +21,7 @@ public class MainPanel extends H2DDialog { public static final String SAVE_CLICKED = CLASS_NAME + ".SAVE_CLICKED"; - private SimpleFacade facade; + private IFacade facade; private VisTable mainTable; private TextureRegion texture; @@ -32,11 +32,11 @@ public class MainPanel extends H2DDialog { private EditingZone editingZone; private PreviewWidget previewWidget; - public MainPanel() { + public MainPanel(IFacade facade) { super("Nine Patch"); addCloseButton(); - facade = SimpleFacade.getInstance(); + this.facade = facade; mainTable = new VisTable(); add(mainTable).width(520).height(310).padBottom(7); diff --git a/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/MainPanelMediator.java b/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/MainPanelMediator.java index 96ffa09a..5577e82d 100644 --- a/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/MainPanelMediator.java +++ b/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/MainPanelMediator.java @@ -5,13 +5,13 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.g2d.NinePatch; import com.badlogic.gdx.graphics.g2d.TextureAtlas; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.renderer.components.MainItemComponent; import games.rednblack.editor.renderer.components.NinePatchComponent; import games.rednblack.editor.renderer.components.TextureRegionComponent; import games.rednblack.editor.renderer.factory.EntityFactory; import games.rednblack.editor.renderer.utils.ComponentRetriever; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; import java.awt.image.BufferedImage; import java.io.BufferedWriter; @@ -22,7 +22,7 @@ import java.io.IOException; /** * Created by azakhary on 8/18/2015. */ -public class MainPanelMediator extends SimpleMediator