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: - *

- * - * @see com.puremvc.patterns.observer Notification - * @see com.puremvc.patterns.command Command - */ -public interface Controller { - - /** - * Register a particular 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 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: - *

- *

- *

- * Your application must register ICommands with the - * Controller. - *

- * The simplest way is to subclass Facade, - * and use its 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 Map> commandMap; - - /** - * Local reference to View - */ - protected CoreView view; - - /** - * Constructor. - *

- *

- * This IController 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. - *

- *

Called automatically by the constructor.

- *

- *

Note that if you are using a subclass of View - * in your application, you should also subclass Controller - * and override the initializeController method in the - * following way:

- *

- *

- * // ensure that the Controller is talking to my IView implementation - * override public function initializeController( ) : void - * { - * view = MyView.getInstance(); - * } - * - */ - protected void initializeController() { - view = CoreView.getInstance(); - } - - /** - * If an 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 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. - *

- *

- * If an ICommand has already been registered to handle - * INotifications with this name, it is no longer used, the - * new ICommand is used instead. - *

- *

- * 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 Notification - * @param command an instance of Command - */ - public void registerCommand(String notificationName, Class 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. - *

- *

- * In PureMVC, the Model class provides - * access to model objects (Proxies) by named lookup. - *

- *

- * The Model assumes these responsibilities:

- *

- *

- *

- *

- * Your application must register IProxy instances - * with the Model. Typically, you use an - * ICommand to create and register IProxy - * instances once the Facade has initialized the Core - * actors.

- * - * @see com.puremvc.patterns.proxy.BaseProxy BaseProxy - * @see com.puremvc.patterns.proxy.Proxy Proxy - */ -public class CoreModel implements Model { - - /** - * Singleton instance - */ - protected static CoreModel instance; - - /** - * Mapping of proxyNames to IProxy instances - */ - protected Map proxyMap; - - /** - * Constructor. - *

- *

- * This 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. - *

- *

- * Called automatically by the constructor, this is your opportunity to - * initialize the Singleton instance in your subclass without overriding the - * constructor. - *

- */ - protected void initializeModel() { - } - - /** - * Register an 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 T retrieveProxy(String proxy) { - return (T) proxyMap.get(proxy); - } - - /** - * Check if a Proxy is registered - * - * @param proxyName Name of the 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. - *

- *

- * In PureMVC, the 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 HashMap> observerMap; - private HashMap mediatorMap; - - /** - * Constructor. - *

- *

- * This 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. - *

- *

- * Called automatically by the constructor, this is your opportunity to - * initialize the Singleton instance in your subclass without overriding - * the constructor. - *

- */ - protected void initializeView() { - } - - /** - * Notify the Observers for a particular - * Notification. - *

- *

- * All previously attached Observers for this - * Notification's list are notified and are passed a - * reference to the Notification in the order in which they - * were registered. - *

- * - * @param note the Notification to notify - * Observers of. - */ - public void notifyObservers(Notification note) { - List observerList = observerMap.get(note.getName()); - if (observerList != null) { - - // Copy observers from reference array to working array, - // since the reference array may change during the - //notification loop - Observer[] observers = observerList.toArray(new Observer[observerList.size()]); - - // Notify Observers from the working array - for (Observer observer : observers) { - observer.notifyObserver(note); - } - } - } - - /** - * Remove the observer for a given notifyContext from an observer list for a given Notification name. - * - * @param notificationName Which observer list to remove from - * @param notifyContext Remove the observer with this object as its notifyContext - */ - public void removeObserver(String notificationName, Object notifyContext) { - // the observer list for the notification under inspection - List observers = observerMap.get(notificationName); - - if (observers != null) { - // find the observer for the notifyContext - for (int i = 0; i < observers.size(); i++) { - BaseObserver observer = (BaseObserver) observers.get(i); - if (observer.compareNotifyContext(notifyContext)) { - observers.remove(observer); - } - } - - // Also, when a Notification's Observer list length falls to - // zero, delete the notification key from the observer map - if (observers.size() == 0) { - observerMap.remove(notificationName); - } - } - } - - /** - * Register an Mediator instance with the View. - *

- *

- * Registers the Mediator so that it can be retrieved by - * name, and further interrogates the Mediator for its - * Notification interests. - *

- *

- * If the 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. - *

- * - * @param mediator the name to associate with this 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<>()); - } - - List observers = observerMap.get(notificationName); - observers.add(observer); - } - - /** - * Remove an Mediator 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 T retrieveMediator(String mediatorName) { - return (T) mediatorMap.get(mediatorName); - } - - /** - * 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 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. - *

- *

- * In PureMVC, Model implementors provide access to - * Proxy objects by named lookup. - *

- *

- *

- * An Model assumes these responsibilities: - *

- *

- *

    - *
  • Maintain a cache of Proxy instances
  • - *
  • Provide methods for registering, retrieving, and removing - * Proxy instances
  • - *
- */ -public interface Model { - - /** - * Register an Proxy 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. - */ - T retrieveProxy(String proxy); - - /** - * Remove an 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. - *

- *

- * In PureMVC, View implementors assume these responsibilities: - *

- *

- *

- * In PureMVC, the CoreView class assumes these responsibilities: - *

    - *
  • Maintain a cache of Mediator instances.
  • - *
  • Provide methods for registering, retrieving, and removing - * Mediators.
  • - *
  • Managing the observer lists for each Notification in the - * application.
  • - *
  • Providing a method for attaching Observers to an - * Notification's observer list.
  • - *
  • Providing a method for broadcasting an Notification.
  • - *
  • Notifying the Observers of a given - * Notification when it broadcast.
  • - *
- * - * @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 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. - *

- *

- * 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. - *

- * - * @param note the INotification to notify - * IObservers of. - */ - void notifyObservers(Notification note); - - /** - * 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. - *

- * - * @param mediator a reference to the 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. - */ - T retrieveMediator(String mediatorName); - - /** - * Remove an 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. - *

- *

- * 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. - *

- *

- *

- * - * @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> subCommands = null; - - /** - * 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(). - *

- */ - public MacroCommand() { - subCommands = new Vector<>(); - initializeMacroCommand(); - } - - /** - * Initialize the MacroCommand. - *

- *

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

- *

- *

// Initialize MyMacroCommand override protected function - * initializeMacroCommand( ) : void { addSubCommand( - * com.me.myapp.controller.FirstCommand ); addSubCommand( - * com.me.myapp.controller.SecondCommand ); addSubCommand( - * com.me.myapp.controller.ThirdCommand ); } - *

- *

- * Note that SubCommands may be any ICommand - * implementor, MacroCommands or SimpleCommands - * are both acceptable. - */ - protected void initializeMacroCommand() { - } - - /** - * Add a SubCommand. - *

- *

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

- * - * @param commandClassRef a reference to the Class of the - * ICommand. - */ - protected void addSubCommand(Class commandClassRef) { - subCommands.add(commandClassRef); - } - - /** - * Execute this MacroCommand's SubCommands. - *

- *

- * The SubCommands will be called in First In/First Out (FIFO) - * order. - * - * @param notification the INotification object to be passsed to each - * SubCommand. - */ - public void execute(Notification notification) { - for (Class 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. - *

- *

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

- * - * @see com.puremvc.core.Controller Controller - * @see com.puremvc.patterns.observer.Notification Notification - * @see com.puremvc.patterns.command.MacroCommand MacroCommand - */ -public class SimpleCommand extends BaseNotifier implements Command { - - /** - * 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. - *

- * - * @param notification the 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. - *

- *

- * 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 com.puremvc.core.Model Model - * @see com.puremvc.core.View View - * @see com.puremvc.core.Controller Controller - * @see com.puremvc.patterns.command.Command Command - * @see com.puremvc.patterns.observer.Notification Notification - */ -public interface Facade extends Notifier { - /** - * Notify 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. - */ - T retrieveProxy(String proxyName); - - /** - * Remove an IProxy instance from the Model by - * name. - * - * @param proxyName the IProxy to remove from the - * Model. - */ - T removeProxy(String proxyName); - - /** - * Check if a Proxy is registered - * - * @param proxyName - * @return whether a Proxy is currently registered with the given 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 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. - */ - T retrieveMediator(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); - - /** - * 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. - *

- *

- * This 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. - *

- *

- * Called automatically by the constructor. Override in your - * subclass to do any subclass specific initializations. Be - * sure to call super.initializeFacade(), though.

- */ - protected void initializeFacade() { - initializeModel(); - initializeController(); - initializeView(); - } - - /** - * Initialize the Controller. - *

- *

- * Called by the initializeFacade method. Override this - * method in your subclass of Facade if one or both of the - * following are true: - *

    - *
  • You wish to initialize a different IController.
  • - *
  • You have 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. - *

- */ - protected void initializeController() { - if (controller != null) { - return; - } - - controller = CoreController.getInstance(); - } - - /** - * 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: - *

    - *
  • You wish to initialize a different IModel.
  • - *
  • You have 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 - * tools will likely need to send INotifications and thus - * will likely want to fetch a reference to the Facade during - * their construction. - *

- */ - protected void initializeModel() { - if (model != null) { - return; - } - - model = CoreModel.getInstance(); - } - - /** - * 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: - *

    - *
  • You wish to initialize a different IView.
  • - *
  • You have Observers to register with the - * View
  • - *
- * If 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. - *

- */ - protected void initializeView() { - if (view != null) { - return; - } - - view = CoreView.getInstance(); - } - - /** - * Register an 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 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 T retrieveMediator(String mediatorName) { - return this.view.retrieveMediator(mediatorName); - } - - /** - * Retrieve an 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 T retrieveProxy(String proxyName) { - return this.model.retrieveProxy(proxyName); - } - /** - * Create and send an INotification. - *

- *

- * 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 INotification. - *

- *

- * 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 INotification. - *

- *

- * 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 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. - *

- *

- * In PureMVC, IMediator implementors assume these - * responsibilities: - *

- *
    - *
  • Implement a common method which returns a list of all - * INotifications the IMediator has interest in.
  • - *
  • Implement a common notification (callback) method.
  • - *
- *

- * Additionally, IMediators typically: - *

    - *
  • Act as an intermediary between one or more view components such as text - * panels or list controls, maintaining references and coordinating their - * behavior.
  • - *
  • In Flash-based apps, this is often the place where event listeners are - * added to view components, and their handlers implemented.
  • - *
  • Respond to and generate 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 org.puremvc.patterns.mediator.~~; import - * org.puremvc.patterns.observer.~~; import org.puremvc.core.view.~~; - *

- * 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; } }

- * - * @see com.puremvc.patterns.observer.Notification Notification - */ -public interface Mediator extends Notifier { - - /** - * Get the 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 SimpleMediator extends BaseNotifier implements Mediator, Notifier { - - /** - * The default name of the SimpleMediator. - */ - 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: - *

- *

- *

private function get comboBox : mx.controls.ComboBox { return - * viewComponent as mx.controls.ComboBox; } - * - * @return the view component - */ - public V getViewComponent() { - return viewComponent; - } - - /** - * Set the 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 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 T getBody() { - return (T) body; - } - - /** - * Set the body of the Notification instance. - * - * @param body - */ - public void setBody(T body) { - this.body = body; - } - - /** - * Get the name of the 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. - *

- *

- * 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. - *

- * - * @see com.puremvc.patterns.facade.Facade Facade - * @see com.puremvc.patterns.mediator.Mediator Mediator - * @see com.puremvc.patterns.proxy Proxy - * @see com.puremvc.patterns.command.SimpleCommand SimpleCommand - * @see com.puremvc.patterns.command.MacroCommand MacroCommand - */ -public class BaseNotifier { - // The Multiton Key for this app - /** - * Local reference to the Facade Singleton - */ - protected SimpleFacade facade; - - /** - * Send an Notifications. - *

- *

- * 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 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 (optional) - */ - - 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/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 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: - *

    - *
  • Encapsulate the notification (callback) method of the interested object.
  • - *
  • Encapsulate the notification context (this) of the interested object.
  • - *
  • Provide methods for setting the notification method and context.
  • - *
  • Provide a method for notifying the interested object.
  • - *
- * - * @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. - *

- *

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

- * - * @param notify the notification method of the interested object - * @param context the notification context of the interested object - */ - public BaseObserver(Function notify, Object context) { - setNotifyContext(context); - setNotifyMethod(notify); - } - - /** - * 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 context == object; - } - - /** - * Notify the interested object. - * - * @param notification the 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. - *

- *

- * The notification method should take one parameter of type - * INotification. - *

- * - * @param notifyMethod the notification (callback) method of the interested object. - */ - public void setNotifyMethod(Function notifyMethod) { - notify = notifyMethod; - } - - /** - * Get the notification context. - * - * @return the notification context (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. - *

- *

- * 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. - * - * @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 - */ - T getBody(); - - /** - * Set the body of the INotification instance - * - * @param body - */ - void setBody(T body); - - /** - * Get the type of the 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. - *

- *

- *

- * 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. - *

- * - * @see com.puremvc.patterns.facade.Facade Facade - * @see com.puremvc.patterns.observer.Notification Notification - */ -public interface Notifier { - - /** - * 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 (optional) - * @param type the type of the notification (optional) - */ - 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 (optional) - */ - 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/com/puremvc/patterns/observer/Observer.java b/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/observer/Observer.java deleted file mode 100644 index 76c24efb..00000000 --- a/hyperlap2d-common-api/src/main/java/com/puremvc/patterns/observer/Observer.java +++ /dev/null @@ -1,108 +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 Observer. - *

- *

- * In PureMVC, IObserver implementors assume these - * responsibilities: - *

    - *
  • Encapsulate the notification (callback) method of the interested object.
  • - *
  • Encapsulate the notification context (this) of the interested object.
  • - *
  • Provide methods for setting the interested object' notification method - * and context.
  • - *
  • Provide a method for notifying the interested object.
  • - *
- *

- *

- * 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. - *

- * - * @see com.puremvc.core.View View - * @see com.puremvc.patterns.observer.Notification Notification - */ -public interface Observer { - - /** - * Set the notification method. - *

- *

- * The notification method should take one parameter of type - * INotification - *

- * - * @param notifyMethod the notification (callback) method of the interested object - */ - void setNotifyMethod(BaseObserver.Function notifyMethod); - - /** - * Set the notification context. - * - * @param notifyContext the notification context (this) of the interested object - */ - void setNotifyContext(Object notifyContext); - - /** - * Notify the interested object. - * - * @param notification the 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. - *

- *

- * In PureMVC, Proxy classes are used to manage parts of the - * application's tools model. - *

- *

- *

- * A 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. - *

- * - * @see com.puremvc.core.Model Model - */ -public class BaseProxy extends BaseNotifier implements Proxy { - - // the proxy name - protected String proxyName = "BaseProxy"; - - // the tools object - protected Object data = null; - - /** - * Constructor - * - * @param proxyName - * @param data - */ - public BaseProxy(String proxyName, Object data) { - if (proxyName != null) { - this.proxyName = proxyName; - } - if (data != null) { - this.data = data; - } - } - - /** - * Constructor - * - * @param proxyName Name of the 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. - *

- *

- * In PureMVC, Iroxy implementors assume these responsibilities: - *

- *
    - *
  • Implement a common method which returns the name of the Proxy.
  • - *
- *

- * Additionally, IProxys typically: - *

- *
    - *
  • Maintain references to one or more pieces of model tools.
  • - *
  • Provide methods for manipulating that tools.
  • - *
  • Generate INotifications when their model tools changes.
  • - *
  • Expose their name as a public static const called NAME, if they are not instantiated multiple times.
  • - *
  • Encapsulate interaction with local or remote services used to fetch and - * persist model tools.
  • - *
- */ -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 SettingsNodeValue { private final VisTable contentTable = new VisTable(); private T settings; private final String name; - protected Facade facade; + protected IFacade facade; - public SettingsNodeValue(String name, Facade facade) { + public SettingsNodeValue(String name, IFacade facade) { this.name = name; contentTable.top().left(); this.facade = facade; diff --git a/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/view/tools/Tool.java b/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/view/tools/Tool.java index 76eb58fd..9670d68a 100644 --- a/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/view/tools/Tool.java +++ b/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/view/tools/Tool.java @@ -19,7 +19,7 @@ package games.rednblack.h2d.common.view.tools; import com.badlogic.ashley.core.Entity; -import com.puremvc.patterns.observer.Notification; +import org.puremvc.java.interfaces.INotification; /** * Created by azakhary on 4/30/2015. @@ -38,7 +38,7 @@ public interface Tool { String getName(); String getTitle(); String getShortcut(); - void handleNotification(Notification notification); + void handleNotification(INotification notification); void keyDown(Entity entity, int keycode); void keyUp(Entity entity, int keycode); } diff --git a/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/view/ui/StandardWidgetsFactory.java b/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/view/ui/StandardWidgetsFactory.java index 197b6c98..458c0c3d 100644 --- a/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/view/ui/StandardWidgetsFactory.java +++ b/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/view/ui/StandardWidgetsFactory.java @@ -31,18 +31,18 @@ import com.kotcrab.vis.ui.util.InputValidator; import com.kotcrab.vis.ui.widget.*; import com.kotcrab.vis.ui.widget.spinner.IntSpinnerModel; import com.kotcrab.vis.ui.widget.spinner.Spinner; -import com.puremvc.patterns.facade.Facade; import games.rednblack.h2d.common.view.ui.listener.CursorListener; import games.rednblack.h2d.common.view.ui.listener.ScrollFocusListener; import games.rednblack.h2d.common.view.ui.widget.TintButton; +import org.puremvc.java.interfaces.IFacade; /** * Creates standard widgets like labels or text fields with provided standard HyperLap2D specific visual style. */ public class StandardWidgetsFactory { - private static Facade facade; - public static void init(Facade f) { + private static IFacade facade; + public static void init(IFacade f) { facade = f; } diff --git a/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/view/ui/listener/CursorListener.java b/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/view/ui/listener/CursorListener.java index f08abc77..8d8b75af 100644 --- a/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/view/ui/listener/CursorListener.java +++ b/hyperlap2d-common-api/src/main/java/games/rednblack/h2d/common/view/ui/listener/CursorListener.java @@ -21,15 +21,15 @@ package games.rednblack.h2d.common.view.ui.listener; import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.InputListener; -import com.puremvc.patterns.facade.Facade; import games.rednblack.h2d.common.proxy.CursorManager; import games.rednblack.h2d.common.vo.CursorData; +import org.puremvc.java.interfaces.IFacade; public class CursorListener extends InputListener { private final CursorData cursor; private final CursorManager cursorManager; - public CursorListener(CursorData cursor, Facade facade) { + public CursorListener(CursorData cursor, IFacade facade) { this.cursor = cursor; cursorManager = facade.retrieveProxy(CursorManager.NAME); } diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/LICENSE b/hyperlap2d-common-api/src/main/java/org/puremvc/java/LICENSE new file mode 100644 index 00000000..7f7f20e9 --- /dev/null +++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/LICENSE @@ -0,0 +1,11 @@ +* PureMVC Standard Framework for Java - Copyright © 2019 [Saad Shams](https://www.linkedin.com/in/muizz) +* PureMVC - Copyright © 2017 [Futurescale, Inc](http://futurescale.com). +* All rights reserved. + +* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the name of Futurescale, Inc., PureMVC.org, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/README.md b/hyperlap2d-common-api/src/main/java/org/puremvc/java/README.md new file mode 100644 index 00000000..7e80c0ad --- /dev/null +++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/README.md @@ -0,0 +1,12 @@ +## License +* PureMVC Standard Framework for Java - Copyright © 2019 [Saad Shams](https://www.linkedin.com/in/muizz/) +* PureMVC - Copyright © 2019 [Futurescale, Inc](http://futurescale.com) +* All rights reserved. + +* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the name of Futurescale, Inc., PureMVC.org, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/core/Controller.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/core/Controller.java new file mode 100644 index 00000000..b561db45 --- /dev/null +++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/core/Controller.java @@ -0,0 +1,176 @@ +// +// PureMVC Java Standard +// +// Copyright(c) 2019 Saad Shams +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.core; + +import org.puremvc.java.interfaces.ICommand; +import org.puremvc.java.interfaces.IController; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.interfaces.IView; +import org.puremvc.java.patterns.observer.Observer; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Supplier; + +/** + * A Singleton IController implementation. + * + * + *

In PureMVC, the Controller class follows the + * 'Command and Controller' strategy, and assumes these + * responsibilities:

+ * + *
    + *
  • Remembering which ICommands + * are intended to handle which INotifications.
  • + *
  • Registering itself as an IObserver with + * the View for each INotification + * that it has an ICommand mapping for.
  • + *
  • Creating a new instance of the proper ICommand + * to handle a given INotification when notified by the View.
  • + *
  • Calling the 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 initializeController method to add your + * registrations.

+ * + * @see View View + * @see org.puremvc.java.patterns.observer.Observer Observer + * @see org.puremvc.java.patterns.observer.Notification Notification + * @see org.puremvc.java.patterns.command.SimpleCommand SimpleCommand + * @see org.puremvc.java.patterns.command.MacroCommand MacroCommand + */ +public class Controller implements IController { + + // Local reference to View + protected IView view; + + // Mapping of Notification names to Command Supplier Functions + protected ConcurrentMap> commandMap; + + // Singleton instance + protected static IController instance; + + // Message Constants + protected final String SINGLETON_MSG = "Controller Singleton already constructed!"; + + /** + * Constructor. + * + *

This IController implementation is a Singleton, + * so you should not call the constructor + * directly, but instead call the static Singleton + * Factory method Controller.getInstance()

+ * + * @throws Error Error if Singleton instance has already been constructed + * + */ + public Controller() { + if(instance != null) throw new Error(SINGLETON_MSG); + instance = this; + commandMap = new ConcurrentHashMap<>(); + initializeController(); + } + + /** + *

Initialize the Singleton Controller instance.

+ * + *

Called automatically by the constructor.

+ * + *

Note that if you are using a subclass of 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.

+ * + * @param factory controller supplier function + * @return the Singleton instance of Controller + */ + public synchronized static IController getInstance(Supplier factory) { + if(instance == null) instance = factory.get(); + return instance; + } + + /** + *

If an ICommand has previously been registered + * to handle a the given INotification, then it is executed.

+ * + * @param notification an INotification + */ + public void executeCommand(INotification notification) { + Supplier commandSupplier = commandMap.get(notification.getName()); + if(commandSupplier == null) return; + ICommand commandInstance = commandSupplier.get(); + commandInstance.execute(notification); + } + + /** + *

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

+ * + *

If an ICommand has already been registered to + * handle INotifications with this name, it is no longer + * used, the new ICommand is used instead.

+ * + *

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 INotification + * @param commandSupplier the Class of the ICommand + */ + public void registerCommand(String notificationName, Supplier commandSupplier) { + if(commandMap.get(notificationName) == null) { + view.registerObserver(notificationName, new Observer(this::executeCommand, this)); + } + commandMap.put(notificationName, commandSupplier); + } + + /** + *

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(hasCommand(notificationName)) { + view.removeObserver(notificationName, this); + commandMap.remove(notificationName); + } + } + + /** + *

Check if a Command is registered for a given Notification

+ * + * @param notificationName notification name + * @return whether a Command is currently registered for the given 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 +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.core; + +import org.puremvc.java.interfaces.IModel; +import org.puremvc.java.interfaces.IProxy; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Supplier; + +/** + *

A Singleton IModel implementation.

+ * + *

In PureMVC, the Model class provides + * access to model objects (Proxies) by named lookup.

+ * + *

The Model assumes these responsibilities:

+ * + *
    + *
  • Maintain a cache of IProxy instances.
  • + *
  • Provide methods for registering, retrieving, and removing + * IProxy instances.
  • + *
+ * + *

Your application must register IProxy instances + * with the Model. Typically, you use an + * ICommand to create and register IProxy + * instances once the Facade has initialized the Core + * actors.

+ * + * @see org.puremvc.java.patterns.proxy.Proxy Proxy + * @see org.puremvc.java.interfaces.IProxy IProxy + */ +public class Model implements IModel { + + // Mapping of proxyNames to IProxy instances + protected ConcurrentMap proxyMap; + + // Singleton instance + protected static IModel instance; + + // Message Constants + protected final String SINGLETON_MSG = "Model Singleton already constructed!"; + + /** + *

Constructor.

+ * + *

This IModel implementation is a Singleton, + * so you should not call the constructor + * directly, but instead call the static Singleton + * Factory method Model.getInstance()

+ * + * @throws Error Error if Singleton instance has already been constructed + * + */ + public Model() { + if(instance != null) throw new Error(SINGLETON_MSG); + instance = this; + proxyMap = new ConcurrentHashMap<>(); + initializeModel(); + } + + /** + *

Initialize the Singleton Model instance.

+ * + *

Called automatically by the constructor, this + * is your opportunity to initialize the Singleton + * instance in your subclass without overriding the + * constructor.

+ * + */ + protected void initializeModel() { + } + + /** + *

Model Singleton Factory method.

+ * + * @param factory model supplier function + * @return the Singleton instance + */ + public synchronized static IModel getInstance(Supplier factory) { + if(instance == null) instance = factory.get(); + return instance; + } + + /** + *

Register an IProxy with the Model.

+ * + * @param proxy an IProxy to be held by the Model. + */ + public void registerProxy(IProxy proxy) { + proxyMap.put(proxy.getProxyName(), proxy); + proxy.onRegister(); + } + + /** + *

Retrieve an IProxy from the Model.

+ * + * @param proxyName proxy name + * @return the IProxy instance previously registered with the given proxyName. + */ + public IProxy retrieveProxy(String proxyName) { + return proxyMap.get(proxyName); + } + + /** + *

Check if a Proxy is registered

+ * + * @param proxyName proxy name + * @return whether a Proxy is currently registered with the given proxyName. + */ + public boolean hasProxy(String proxyName) { + return proxyMap.containsKey(proxyName); + } + + /** + *

Remove an IProxy from the Model.

+ * + * @param proxyName name of the 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 +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.core; + +import org.puremvc.java.interfaces.IMediator; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.interfaces.IObserver; +import org.puremvc.java.interfaces.IView; +import org.puremvc.java.patterns.observer.Observer; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.function.Supplier; + +/** + *

A Singleton IView implementation.

+ * + *

In PureMVC, the View class assumes these responsibilities:

+ * + *
    + *
  • Maintain a cache of IMediator instances.
  • + *
  • Provide methods for registering, retrieving, and removing IMediators.
  • + *
  • Notifiying IMediators when they are registered or removed.
  • + *
  • Managing the observer lists for each INotification in the application.
  • + *
  • Providing a method for attaching IObservers to an INotification's observer list.
  • + *
  • Providing a method for broadcasting an INotification.
  • + *
  • Notifying the IObservers of a given INotification when it broadcast.
  • + *
+ * + * @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 ConcurrentMap mediatorMap; + + // Mapping of Notification names to Observer lists + protected ConcurrentMap> observerMap; + + // Singleton instance + protected static IView instance; + + // Message Constants + protected final String SINGLETON_MSG = "View Singleton already constructed!"; + + /** + *

Constructor.

+ * + *

This 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 + * + */ + public View() { + if(instance != null) new Error(SINGLETON_MSG); + instance = this; + mediatorMap = new ConcurrentHashMap<>(); + observerMap = new ConcurrentHashMap<>(); + initializeView(); + } + + /** + *

View Singleton Factory method.

+ * + * @param factory view supplier function + * @return the Singleton instance of View + */ + public synchronized static IView getInstance(Supplier factory) { + if(instance == null) instance = factory.get(); + return instance; + } + + /** + *

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.

+ */ + protected void initializeView() { + } + + /** + *

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

+ * + * @param notificationName the name of the 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))); + } + } + + /** + *

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.

+ * + * @param notification the 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 + List observers_ref = observerMap.get(notification.getName()); + + // Copy observers from reference array to working array, + // since the reference array may change during the notification loop + List observers = new ArrayList<>(observers_ref); + + // Notify Observers from the working array + observers.forEach(observer -> observer.notifyObserver(notification)); + } + } + + /** + *

Remove the observer for a given notifyContext from an observer list for a given Notification name.

+ * + * @param notificationName which observer list to remove from + * @param notifyContext remove the observer with this object as its notifyContext + */ + public void removeObserver(String notificationName, Object notifyContext) { + // the observer list for the notification under inspection + List observers = observerMap.get(notificationName); + + // find the observer for the notifyContext + for(int i=0; iRegister 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.

+ * + * @param mediator a reference to the 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; iRetrieve 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. + */ + public IMediator retrieveMediator(String mediatorName) { + return mediatorMap.get(mediatorName); + } + + /** + *

Remove an IMediator from the View.

+ * + * @param mediatorName name of the 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; iCheck if a Mediator is registered or not

+ * + * @param mediatorName mediator name + * @return whether a Mediator is registered with the given mediatorName. + */ + 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 +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.interfaces; + +/** + * The interface definition for a PureMVC Command. + * + * @see org.puremvc.java.interfaces INotification + */ +public interface ICommand extends INotifier { + + /** + *

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

+ * + * @param notification an 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 +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.interfaces; + +import java.util.function.Supplier; + +/** + *

The interface definition for a PureMVC Controller.

+ * + *

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

+ * + *
    + *
  • Remembering which ICommands + * are intended to handle which INotifications.
  • + *
  • Registering itself as an IObserver with + * the View for each INotification + * that it has an ICommand mapping for.
  • + *
  • Creating a new instance of the proper ICommand + * to handle a given INotification when notified by the View.
  • + *
  • Calling the ICommand's execute + * method, passing in the INotification.
  • + *
+ * + * @see org.puremvc.java.interfaces INotification + * @see org.puremvc.java.interfaces ICommand + */ +public interface IController { + + /** + *

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

+ * + * @param notificationName the name of the INotification + * @param commandSupplier the Supplier Function of the ICommand + */ + void registerCommand(String notificationName, Supplier commandSupplier); + + /** + *

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(INotification 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 notification name + * @return whether a Command is currently registered for the given notificationName. + */ + 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 +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.interfaces; + +import java.util.function.Supplier; + +/** + *

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.

+ * + * @param proxy the IProxy to be registered with the Model. + */ + void registerProxy(IProxy 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. + */ + T retrieveProxy(String proxyName); + + /** + *

Remove an IProxy instance from the Model by name.

+ * + * @param proxyName the IProxy to remove from the Model. + * @return the IProxy that was removed from the Model + */ + T removeProxy(String proxyName); + + /** + *

Check if a Proxy is registered

+ * + * @param proxyName proxy name + * @return whether a Proxy is currently registered with the given proxyName. + */ + boolean hasProxy(String proxyName); + + /** + *

Register an ICommand with the Controller.

+ * + * @param notificationName the name of the INotification to associate the ICommand with. + * @param commandSupplier a reference to the Command Supplier Function of the ICommand. + */ + void registerCommand(String notificationName, Supplier commandSupplier); + + /** + *

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 notification name + * @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(IMediator 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. + */ + T retrieveMediator(String mediatorName); + + /** + *

Remove a IMediator instance from the View.

+ * + * @param mediatorName name of the IMediator instance to be removed. + * @return the IMediator instance previously registered with the given mediatorName. + */ + T removeMediator(String mediatorName); + + /** + *

Check if a Mediator is registered or not

+ * + * @param mediatorName mediator name + * @return whether a Mediator is registered with the given mediatorName. + */ + 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 the INotification 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 +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.interfaces; + +/** + *

The interface definition for a PureMVC Mediator.

+ * + *

In PureMVC, IMediator implementors assume these responsibilities:

+ * + *
    + *
  • Implement a common method which returns a list of all INotifications + * the IMediator has interest in.
  • + *
  • Implement a notification callback method.
  • + *
  • Implement methods that are called when the IMediator is registered or removed from the View.
  • + *
+ * + *

Additionally, IMediators typically:

+ * + *
    + *
  • Act as an intermediary between one or more view components such as text boxes or + * list controls, maintaining references and coordinating their behavior.
  • + *
  • In Flash-based apps, this is often the place where event listeners are + * added to view components, and their handlers implemented.
  • + *
  • Respond to and generate 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 IMediator extends INotifier { + + /** + *

Get the 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(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 Shams +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.interfaces; + +/** + *

The interface definition for a PureMVC Model.

+ * + *

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

+ * + *

An IModel assumes these responsibilities:

+ * + *
    + *
  • Maintain a cache of IProxy instances
  • + *
  • Provide methods for registering, retrieving, and removing IProxy instances
  • + *
+ */ +public interface IModel { + + /** + *

Register an IProxy instance with the Model.

+ * + * @param proxy an object reference to be held by the Model. + */ + void registerProxy(IProxy proxy); + + /** + *

Retrieve an IProxy instance from the Model.

+ * + * @param proxyName proxy name + * @return the IProxy instance previously registered with the given proxyName. + */ + T retrieveProxy(String proxyName); + + /** + *

Remove an IProxy instance from the Model.

+ * + * @param proxyName name of the IProxy instance to be removed. + * @return the IProxy that was removed from the Model + */ + T removeProxy(String proxyName); + + /** + *

Check if a Proxy is registered

+ * + * @param proxyName proxy name + * @return whether a Proxy is currently registered with the given proxyName. + */ + 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 +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.interfaces; + +/** + *

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.

+ * + * @see IView IView + * @see IObserver IObserver + */ +public interface INotification { + + /** + *

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

+ * + * @return notification name + */ + String getName(); + + /** + *

Set the body of the INotification instance

+ * + * @param body notification body + */ + void setBody(Object body); + + /** + *

Get the body of the INotification instance

+ * + * @return notification body + */ + T getBody(); + + /** + *

Set the type of the INotification instance

+ * + * @param type notification type + */ + void setType(String type); + + /** + *

Get the type of the INotification instance

+ * + * @return notification type + */ + String getType(); + + /** + *

Get the string representation of the INotification instance

+ * + * @return string representation of 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 +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.interfaces; + +/** + *

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.

+ * + * @see IFacade IFacade + * @see org.puremvc.java.interfaces.INotification INotification + */ +public interface INotifier { + + /** + *

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 Shams +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.interfaces; + +import java.util.function.Consumer; + +/** + *

The interface definition for a PureMVC Observer.

+ * + *

In PureMVC, IObserver implementors assume these responsibilities:

+ * + *
    + *
  • Encapsulate the notification (callback) method of the interested object.
  • + *
  • Encapsulate the notification context (this) of the interested object.
  • + *
  • Provide methods for setting the interested object' notification method and context.
  • + *
  • Provide a method for notifying the interested object.
  • + *
+ * + *

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.

+ * + * @see IView IView + * @see org.puremvc.java.interfaces.INotification INotification + */ +public interface IObserver { + + /** + *

Set the notification method.

+ * + *

The notification method should take one parameter of type INotification

+ * + * @param notifyMethod the notification (callback) method of the interested object + */ + void setNotifyMethod(Consumer notifyMethod); + + /** + *

Set the notification context.

+ * + * @param notifyContext the notification context (this) of the interested object + */ + void setNotifyContext(Object notifyContext); + + /** + *

Notify the interested object.

+ * + * @param notification the INotification 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 Shams +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.interfaces; + +/** + *

The interface definition for a PureMVC Proxy.

+ * + *

In PureMVC, IProxy implementors assume these responsibilities:

+ * + *
    + *
  • Implement a common method which returns the name of the Proxy.
  • + *
  • Provide methods for setting and getting the data object.
  • + *
+ * + *

Additionally, IProxys typically:

+ * + *
    + *
  • Maintain references to one or more pieces of model data.
  • + *
  • Provide methods for manipulating that data.
  • + *
  • Generate INotifications when their model data changes.
  • + *
  • Expose their name as a public static const called NAME, if they are not instantiated multiple times.
  • + *
  • Encapsulate interaction with local or remote services used to fetch and persist model data.
  • + *
+ */ +public interface IProxy extends INotifier { + + /** + *

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 Shams +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.interfaces; + +/** + *

The interface definition for a PureMVC View.

+ * + *

In PureMVC, IView implementors assume these responsibilities:

+ * + *

In PureMVC, the View class assumes these responsibilities:

+ * + *
    + *
  • Maintain a cache of IMediator instances.
  • + *
  • Provide methods for registering, retrieving, and removing IMediators.
  • + *
  • Managing the observer lists for each INotification in the application.
  • + *
  • Providing a method for attaching IObservers to an INotification's observer list.
  • + *
  • Providing a method for broadcasting an INotification.
  • + *
  • Notifying the IObservers of a given INotification when it broadcast.
  • + *
+ * + * @see org.puremvc.java.interfaces.IMediator IMediator + * @see org.puremvc.java.interfaces.IObserver IObserver + * @see org.puremvc.java.interfaces.INotification INotification + */ +public interface IView { + + /** + *

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

+ * + * @param notificationName the name of the 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.

+ * + * @param notification the 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.

+ * + * @param mediator a reference to the IMediator instance + */ + void registerMediator(IMediator 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. + */ + T retrieveMediator(String mediatorName); + + /** + *

Remove an IMediator from the View.

+ * + * @param mediatorName name of the IMediator instance to be removed. + * @return the IMediator that was removed from the View + */ + T removeMediator(String mediatorName); + + /** + *

Check if a Mediator is registered or not

+ * + * @param mediatorName mediator name + * @return whether a Mediator is registered with the given mediatorName. + */ + 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 +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.patterns.command; + +import org.puremvc.java.interfaces.ICommand; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.observer.Notifier; + +import java.util.Vector; +import java.util.function.Supplier; + +/** + *

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.

+ * + * @see org.puremvc.java.core.Controller Controller + * @see org.puremvc.java.patterns.observer.Notification Notification + * @see org.puremvc.java.patterns.command.SimpleCommand SimpleCommand + */ +public class MacroCommand extends Notifier implements ICommand { + + private Vector> subCommands; + + /** + *

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().

+ */ + public MacroCommand() { + subCommands = new Vector>(); + initializeMacroCommand(); + } + + /** + *

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.

+ */ + protected void initializeMacroCommand() { + } + + /** + *

Add a SubCommand.

+ * + *

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

+ * + * @param factory a reference to the factory of the ICommand. + */ + protected void addSubCommand(Supplier factory) { + subCommands.add(factory); + } + + /** + *

Execute this MacroCommand's SubCommands.

+ * + *

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

+ * + * @param notification the INotification object to be passsed to each SubCommand. + */ + public void execute(INotification notification) { + while(!subCommands.isEmpty()) { + Supplier commandSupplier = subCommands.remove(0); + ICommand command = commandSupplier.get(); + command.execute(notification); + } + } +} diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/command/SimpleCommand.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/command/SimpleCommand.java new file mode 100644 index 00000000..52f225c2 --- /dev/null +++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/command/SimpleCommand.java @@ -0,0 +1,38 @@ +// +// PureMVC Java Standard +// +// Copyright(c) 2019 Saad Shams +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.patterns.command; + +import org.puremvc.java.interfaces.ICommand; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.observer.Notifier; + +/** + *

A base ICommand implementation.

+ * + *

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

+ * + * @see org.puremvc.java.core.Controller Controller + * @see org.puremvc.java.patterns.observer.Notification Notification + * @see MacroCommand MacroCommand + */ +public class SimpleCommand extends Notifier implements ICommand { + + /** + *

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.

+ * + * @param notification the 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 +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.patterns.facade; + +import org.puremvc.java.core.Controller; +import org.puremvc.java.core.Model; +import org.puremvc.java.core.View; +import org.puremvc.java.interfaces.*; +import org.puremvc.java.patterns.observer.Notification; + +import java.util.function.Supplier; + +/** + *

A base Singleton IFacade implementation.

+ * + *

In PureMVC, the Facade class assumes these + * responsibilities:

+ * + *
    + *
  • Initializing the Model, View + * and Controller Singletons.
  • + *
  • Providing all the methods defined by the IModel, + * IView, & IController interfaces.
  • + *
  • Providing the ability to override the specific Model, + * View and Controller Singletons created.
  • + *
  • Providing a single point of contact to the application for + * registering Commands and notifying Observers
  • + *
+ * + *

Example 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()

+ * + * @throws Error Error if Singleton instance has already been constructed + * + */ + public Facade() { + if(instance != null) throw new Error(SINGLETON_MSG); + instance = this; + initializeFacade(); + } + + /** + *

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.

+ */ + protected void initializeFacade() { + initializeModel(); + initializeController(); + initializeView(); + } + + /** + *

Facade Singleton Factory method

+ * + * @param factory facade Supplier Function + * @return the Singleton instance of the Facade + */ + public synchronized static IFacade getInstance(Supplier factory) { + if(instance == null) instance = factory.get(); + return instance; + } + + /** + *

Initialize the Controller.

+ * + *

Called by the initializeFacade method. + * Override this method in your subclass of Facade + * if one or both of the following are true:

+ * + *
    + *
  • You wish to initialize a different IController.
  • + *
  • You have 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.

+ */ + protected void initializeController() { + if(controller != null) return; + controller = Controller.getInstance(() -> new Controller()); + } + + /** + *

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:

+ * + *
    + *
  • You wish to initialize a different IModel.
  • + *
  • You have 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.

+ */ + protected void initializeModel() { + if(model != null) return; + model = Model.getInstance(() -> new Model()); + } + + /** + *

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:

+ * + *
    + *
  • You wish to initialize a different IView.
  • + *
  • You have Observers to register with the View
  • + *
+ * + *

If 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.

+ */ + protected void initializeView() { + if(view != null) return; + view = View.getInstance(() -> new View()); + } + + /** + *

Register an ICommand with the Controller by Notification name.

+ * + * @param notificationName the name of the INotification to associate the ICommand with + * @param commandSupplier a reference to the Supplier Function of the ICommand + */ + public void registerCommand(String notificationName, Supplier commandSupplier) { + controller.registerCommand(notificationName, commandSupplier); + } + + /** + *

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 notification name + * @return whether a Command is currently registered for the given notificationName. + */ + public boolean hasCommand(String notificationName) { + return controller.hasCommand(notificationName); + } + + /** + *

Register an IProxy with the Model by name.

+ * + * @param proxy the IProxy instance to be registered with the Model. + */ + public void registerProxy(IProxy proxy) { + model.registerProxy(proxy); + } + + /** + *

Retrieve an 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. + */ + public T retrieveProxy(String proxyName) { + return model.retrieveProxy(proxyName); + } + + /** + *

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 T removeProxy(String proxyName) { + return model.removeProxy(proxyName); + } + + /** + *

Check if a Proxy is registered

+ * + * @param proxyName proxy name + * @return whether a Proxy is currently registered with the given proxyName. + */ + public boolean hasProxy(String proxyName) { + return model.hasProxy(proxyName); + } + + /** + *

Register a IMediator with the View.

+ * + * @param mediator a reference to the IMediator + */ + public void registerMediator(IMediator mediator) { + view.registerMediator(mediator); + } + + /** + *

Retrieve an IMediator from the View.

+ * + * @param mediatorName mediator name + * @return the IMediator previously registered with the given mediatorName. + */ + public T retrieveMediator(String mediatorName) { + return view.retrieveMediator(mediatorName); + } + + /** + *

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 T removeMediator(String mediatorName) { + return view.removeMediator(mediatorName); + } + + /** + *

Check if a Mediator is registered or not

+ * + * @param mediatorName mediator name + * @return whether a Mediator is registered with the given mediatorName. + */ + 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 the INotification 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 +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.patterns.mediator; + +import org.puremvc.java.interfaces.IMediator; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.observer.Notifier; + +/** + *

A base IMediator implementation.

+ * + * @see org.puremvc.java.core.View View + */ +public class Mediator extends Notifier implements IMediator { + + /** + *

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.

+ */ + public static final String NAME = "Mediator"; + + // the mediator name + protected String mediatorName; + + // The view component + protected V viewComponent; + + /** + *

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.

+ * + * @return Array the list 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.

+ */ + public void handleNotification(INotification notification) { + + } + + /** + *

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.

+ * + * @return the Mediator name + */ + public 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:

+ * + * {@code + * public javax.swing.JComboBox getViewComponent() + * { + * return viewComponent; + * } + *} + * + * @return the view component + */ + public V getViewComponent() { + return viewComponent; + } + + /** + *

Set the IMediator's view component.

+ * + * @param viewComponent the view component + */ + public void setViewComponent(V viewComponent) { + this.viewComponent = viewComponent; + } + +} diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/observer/Notification.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/observer/Notification.java new file mode 100644 index 00000000..25511ee5 --- /dev/null +++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/observer/Notification.java @@ -0,0 +1,138 @@ +// +// PureMVC Java Standard +// +// Copyright(c) 2019 Saad Shams +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.patterns.observer; + +import org.puremvc.java.interfaces.INotification; + +/** + *

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.

+ * + * @see Observer Observer + * + */ +public class Notification implements INotification { + + // the name of the notification instance + private String name; + + // the type of the notification instance + private String type; + + // the body of the notification instance + private Object body; + + /** + *

Constructor.

+ * + * @param name name of the Notification 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 the Notification instance. + * @param body the Notification body. + */ + public Notification(String name, Object body) { + this(name, body, null); + } + + /** + *

Constructor.

+ * + * @param name name of the Notification instance. + */ + public Notification(String name) { + this(name, null, null); + } + + /** + *

Get the name of the Notification instance.

+ * + * @return the name of the Notification instance. + */ + public String getName() { + return name; + } + + /** + *

Set the body of the Notification instance.

+ */ + public void setBody(Object body) { + this.body = body; + } + + /** + *

Get the body of the Notification instance.

+ * + * @return the body object. + */ + public Object getBody() { + return body; + } + + /** + *

Set the type of the Notification instance.

+ */ + public void setType(String type) { + this.type = type; + } + + /** + *

Get the type of the Notification instance.

+ * + * @return the type + */ + public String getType() { + return type; + } + + /** + *

Get the string representation of the Notification instance.

+ * + * @return the string representation of the 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 +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.patterns.observer; + +import org.puremvc.java.interfaces.IFacade; +import org.puremvc.java.interfaces.INotifier; +import org.puremvc.java.patterns.facade.Facade; + +/** + *

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.

+ * + * @see Facade Facade + * @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 Notifier implements INotifier { + + /** + *

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 Shams +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.patterns.observer; + +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.interfaces.IObserver; + +import java.util.function.Consumer; + +/** + *

A 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:

+ * + *
    + *
  • Encapsulate the notification (callback) method of the interested object.
  • + *
  • Encapsulate the notification context (this) of the interested object.
  • + *
  • Provide methods for setting the notification method and context.
  • + *
  • Provide a method for notifying the interested object.
  • + *
+ * + * @see org.puremvc.java.core.View View + * @see org.puremvc.java.patterns.observer.Notification Notification + */ +public class Observer implements IObserver { + + private Object notifyContext; + + private Consumer notifyMethod; + + /** + *

Constructor.

+ * + *

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

+ * + * @param notifyMethod the notification method of the interested object + * @param notifyContext the notification context of the interested object + */ + public Observer(Consumer notifyMethod, Object notifyContext) { + this.notifyMethod = notifyMethod; + this.notifyContext = notifyContext; + } + + /** + *

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 the INotification 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 Consumer getNotifyMethod() { + return notifyMethod; + } + + /** + *

Set the notification method.

+ * + *

The notification method should take one parameter of type + * INotification.

+ * + * @param notifyMethod the notification (callback) consumer function of the interested object. + */ + public void setNotifyMethod(Consumer notifyMethod) { + this.notifyMethod = notifyMethod; + } + +} diff --git a/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/proxy/Proxy.java b/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/proxy/Proxy.java new file mode 100644 index 00000000..3b8636d0 --- /dev/null +++ b/hyperlap2d-common-api/src/main/java/org/puremvc/java/patterns/proxy/Proxy.java @@ -0,0 +1,110 @@ +// +// PureMVC Java Standard +// +// Copyright(c) 2019 Saad Shams +// Your reuse is governed by the Creative Commons Attribution 3.0 License +// + +package org.puremvc.java.patterns.proxy; + +import org.puremvc.java.interfaces.IProxy; +import org.puremvc.java.patterns.observer.Notifier; + +/** + *

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.

+ * + * @see org.puremvc.java.core.Model Model + */ +public class Proxy extends Notifier implements IProxy { + + // the proxy name + public static final String NAME = "Proxy"; + + // the data object + protected String proxyName; + + // the data object + protected Object data; + + /** + *

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 the Proxy + */ + 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 { +public class MainPanelMediator extends Mediator { private static final String TAG = MainPanelMediator.class.getCanonicalName(); public static final String NAME = TAG; @@ -31,7 +31,7 @@ public class MainPanelMediator extends SimpleMediator { private ImageUtils imageUtils = new ImageUtils(); public MainPanelMediator(NinePatchPlugin plugin) { - super(NAME, new MainPanel()); + super(NAME, new MainPanel(plugin.facade)); this.plugin = plugin; } @@ -45,7 +45,7 @@ public class MainPanelMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); switch (notification.getName()) { case NinePatchPlugin.EDIT_NINE_PATCH: diff --git a/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/NinePatchPlugin.java b/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/NinePatchPlugin.java index ef916df7..3e179b69 100644 --- a/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/NinePatchPlugin.java +++ b/plugin-9patch/src/main/java/games/rednblack/editor/plugin/ninepatch/NinePatchPlugin.java @@ -27,11 +27,11 @@ public class NinePatchPlugin extends H2DPluginAdapter { public NinePatchPlugin() { super(CLASS_NAME); - performancePanelMediator = new MainPanelMediator(this); } @Override public void initPlugin() { + performancePanelMediator = new MainPanelMediator(this); facade.registerMediator(performancePanelMediator); pluginAPI.setDropDownItemName(EDIT_NINE_PATCH, "Edit NinePatch"); pluginAPI.setDropDownItemName(CONVERT_TO_NINE_PATCH, "Convert to NinePatch"); diff --git a/plugin-performance/src/main/java/games/rednblack/editor/plugin/performance/PerformancePanel.java b/plugin-performance/src/main/java/games/rednblack/editor/plugin/performance/PerformancePanel.java index 7a164cb5..55a21c9c 100644 --- a/plugin-performance/src/main/java/games/rednblack/editor/plugin/performance/PerformancePanel.java +++ b/plugin-performance/src/main/java/games/rednblack/editor/plugin/performance/PerformancePanel.java @@ -4,13 +4,10 @@ import com.badlogic.ashley.core.Engine; import com.badlogic.gdx.Gdx; import com.kotcrab.vis.ui.widget.VisLabel; import com.kotcrab.vis.ui.widget.VisTable; -import com.puremvc.patterns.facade.SimpleFacade; import games.rednblack.h2d.common.UIDraggablePanel; public class PerformancePanel extends UIDraggablePanel { - private SimpleFacade facade; - private VisTable mainTable; private VisLabel entitiesCount; @@ -22,8 +19,6 @@ public class PerformancePanel extends UIDraggablePanel { super("Performance"); addCloseButton(); - facade = SimpleFacade.getInstance(); - mainTable = new VisTable(); getContentTable().add(mainTable).left().width(150).pad(5); diff --git a/plugin-performance/src/main/java/games/rednblack/editor/plugin/performance/PerformancePanelMediator.java b/plugin-performance/src/main/java/games/rednblack/editor/plugin/performance/PerformancePanelMediator.java index 4f29931c..a21f9e7e 100644 --- a/plugin-performance/src/main/java/games/rednblack/editor/plugin/performance/PerformancePanelMediator.java +++ b/plugin-performance/src/main/java/games/rednblack/editor/plugin/performance/PerformancePanelMediator.java @@ -1,10 +1,10 @@ package games.rednblack.editor.plugin.performance; import com.badlogic.ashley.core.Engine; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; -public class PerformancePanelMediator extends SimpleMediator { +public class PerformancePanelMediator extends Mediator { private static final String TAG = PerformancePanelMediator.class.getCanonicalName(); public static final String NAME = TAG; @@ -32,7 +32,7 @@ public class PerformancePanelMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); switch (notification.getName()) { case SCENE_LOADED: diff --git a/plugin-skin-composer/src/main/java/games/rednblack/editor/plugin/skincomposer/SkinComposerMediator.java b/plugin-skin-composer/src/main/java/games/rednblack/editor/plugin/skincomposer/SkinComposerMediator.java index 667b4bea..df87bc85 100644 --- a/plugin-skin-composer/src/main/java/games/rednblack/editor/plugin/skincomposer/SkinComposerMediator.java +++ b/plugin-skin-composer/src/main/java/games/rednblack/editor/plugin/skincomposer/SkinComposerMediator.java @@ -2,17 +2,17 @@ package games.rednblack.editor.plugin.skincomposer; import com.badlogic.gdx.utils.Json; import com.kotcrab.vis.ui.util.dialog.Dialogs; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.h2d.common.MsgAPI; import org.apache.commons.io.FileUtils; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; import java.io.File; import java.io.IOException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -public class SkinComposerMediator extends SimpleMediator { +public class SkinComposerMediator extends Mediator { private static final String TAG = SkinComposerMediator.class.getCanonicalName(); public static final String NAME = TAG; @@ -33,7 +33,7 @@ public class SkinComposerMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); pluginPath = plugin.getAPI().getCacheDir(); diff --git a/plugin-skin-composer/src/main/java/games/rednblack/editor/plugin/skincomposer/SkinComposerSettings.java b/plugin-skin-composer/src/main/java/games/rednblack/editor/plugin/skincomposer/SkinComposerSettings.java index 687a2fce..90737dba 100644 --- a/plugin-skin-composer/src/main/java/games/rednblack/editor/plugin/skincomposer/SkinComposerSettings.java +++ b/plugin-skin-composer/src/main/java/games/rednblack/editor/plugin/skincomposer/SkinComposerSettings.java @@ -1,11 +1,11 @@ package games.rednblack.editor.plugin.skincomposer; import com.kotcrab.vis.ui.widget.VisCheckBox; -import com.puremvc.patterns.facade.Facade; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.plugins.H2DPluginAdapter; import games.rednblack.h2d.common.view.SettingsNodeValue; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import org.puremvc.java.interfaces.IFacade; public class SkinComposerSettings extends SettingsNodeValue { @@ -13,7 +13,7 @@ public class SkinComposerSettings extends SettingsNodeValue { private final H2DPluginAdapter plugin; private boolean loaded = false; - public SkinComposerSettings(Facade facade, H2DPluginAdapter plugin) { + public SkinComposerSettings(IFacade facade, H2DPluginAdapter plugin) { super("Skin Composer", facade); this.plugin = plugin; diff --git a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/TiledPanel.java b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/TiledPanel.java index 62c7f9ea..aa7c1825 100644 --- a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/TiledPanel.java +++ b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/TiledPanel.java @@ -29,13 +29,12 @@ import com.kotcrab.vis.ui.widget.VisTextButton; import com.kotcrab.vis.ui.widget.tabbedpane.Tab; import com.kotcrab.vis.ui.widget.tabbedpane.TabbedPane; import com.kotcrab.vis.ui.widget.tabbedpane.TabbedPaneListener; -import com.puremvc.patterns.facade.Facade; -import com.puremvc.patterns.facade.SimpleFacade; import games.rednblack.editor.plugin.tiled.data.TileVO; import games.rednblack.editor.plugin.tiled.manager.ResourcesManager; import games.rednblack.editor.plugin.tiled.view.tabs.GridTilesTab; import games.rednblack.editor.plugin.tiled.view.tabs.SettingsTab; import games.rednblack.h2d.common.UIDraggablePanel; +import org.puremvc.java.interfaces.IFacade; /** * Created by mariam on 2/2/2016. @@ -52,7 +51,7 @@ public class TiledPanel extends UIDraggablePanel { public static final float BOTTOM_BAR_DELTA_Y = 6f; public TiledPlugin tiledPlugin; - public Facade facade; + private IFacade facade; protected TabbedPane tabbedPane; protected VisTable tabTable; //table inside of each tab @@ -69,7 +68,7 @@ public class TiledPanel extends UIDraggablePanel { super("Tiles"); this.tiledPlugin = tiledPlugin; - facade = SimpleFacade.getInstance(); + facade = tiledPlugin.facade; mainTable = new VisTable(); add(mainTable) @@ -230,4 +229,8 @@ public class TiledPanel extends UIDraggablePanel { public void setEngine(Engine engine) { this.engine = engine; } + + public IFacade getFacade() { + return facade; + } } diff --git a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/TiledPanelMediator.java b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/TiledPanelMediator.java index 3793a13d..2dfef313 100644 --- a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/TiledPanelMediator.java +++ b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/TiledPanelMediator.java @@ -22,8 +22,6 @@ import com.badlogic.ashley.core.Engine; import com.badlogic.ashley.core.Entity; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.h2d.common.vo.CursorData; import games.rednblack.editor.plugin.tiled.data.TileVO; import games.rednblack.editor.plugin.tiled.tools.DeleteTileTool; @@ -34,13 +32,15 @@ import games.rednblack.editor.renderer.components.MainItemComponent; import games.rednblack.editor.renderer.utils.ComponentRetriever; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.ResourcePayloadObject; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; import java.util.HashMap; /** * Created by mariam on 2/2/2016. */ -public class TiledPanelMediator extends SimpleMediator { +public class TiledPanelMediator extends Mediator { private static final String TAG = TiledPanelMediator.class.getCanonicalName(); public static final String NAME = TAG; @@ -74,7 +74,7 @@ public class TiledPanelMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); String tileName; diff --git a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/offset/OffsetPanelMediator.java b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/offset/OffsetPanelMediator.java index a1f90a88..dadef9be 100644 --- a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/offset/OffsetPanelMediator.java +++ b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/offset/OffsetPanelMediator.java @@ -1,14 +1,14 @@ package games.rednblack.editor.plugin.tiled.offset; import com.badlogic.gdx.math.Vector2; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.plugin.tiled.TiledPlugin; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; /** * Created by mariam on 5/12/16. */ -public class OffsetPanelMediator extends SimpleMediator { +public class OffsetPanelMediator extends Mediator { private static final String TAG = OffsetPanelMediator.class.getCanonicalName(); public static final String NAME = TAG; @@ -32,7 +32,7 @@ public class OffsetPanelMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); switch (notification.getName()) { diff --git a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/tools/DeleteTileTool.java b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/tools/DeleteTileTool.java index 933757d2..4738ae23 100644 --- a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/tools/DeleteTileTool.java +++ b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/tools/DeleteTileTool.java @@ -2,10 +2,10 @@ package games.rednblack.editor.plugin.tiled.tools; import com.badlogic.ashley.core.Entity; import com.badlogic.gdx.Input; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.plugin.tiled.TiledPlugin; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.tools.Tool; +import org.puremvc.java.interfaces.INotification; /** * Created by mariam on 4/5/16. @@ -87,7 +87,7 @@ public class DeleteTileTool implements Tool { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { } diff --git a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/tools/DrawTileTool.java b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/tools/DrawTileTool.java index 9a346129..eb4c4dbd 100644 --- a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/tools/DrawTileTool.java +++ b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/tools/DrawTileTool.java @@ -4,7 +4,6 @@ import com.badlogic.ashley.core.Entity; import com.badlogic.gdx.Input; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Vector2; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.plugin.tiled.TiledPlugin; import games.rednblack.editor.renderer.components.DimensionsComponent; import games.rednblack.editor.renderer.components.MainItemComponent; @@ -13,6 +12,7 @@ import games.rednblack.editor.renderer.components.TransformComponent; import games.rednblack.editor.renderer.data.ProjectInfoVO; import games.rednblack.editor.renderer.utils.ComponentRetriever; import games.rednblack.h2d.common.view.tools.Tool; +import org.puremvc.java.interfaces.INotification; /** * Created by mariam on 3/29/16. @@ -121,7 +121,7 @@ public class DrawTileTool implements Tool { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { } diff --git a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/view/tabs/SettingsTab.java b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/view/tabs/SettingsTab.java index 3abd4d95..e9c52522 100644 --- a/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/view/tabs/SettingsTab.java +++ b/plugin-tiled/src/main/java/games/rednblack/editor/plugin/tiled/view/tabs/SettingsTab.java @@ -60,7 +60,7 @@ public class SettingsTab extends DefaultTab { currentParameters.gridWidth = grid.getAttributeVO("Width: ").value; currentParameters.gridHeight = grid.getAttributeVO("Height: ").value; - panel.facade.sendNotification(OK_BTN_CLICKED, currentParameters); + panel.getFacade().sendNotification(OK_BTN_CLICKED, currentParameters); } }); } diff --git a/src/main/java/games/rednblack/editor/HyperLap2D.java b/src/main/java/games/rednblack/editor/HyperLap2D.java index 07723494..bdf6dcf4 100644 --- a/src/main/java/games/rednblack/editor/HyperLap2D.java +++ b/src/main/java/games/rednblack/editor/HyperLap2D.java @@ -31,21 +31,21 @@ import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.ObjectMap; -import com.puremvc.patterns.observer.BaseNotification; import games.rednblack.editor.proxy.CommandManager; import games.rednblack.editor.splash.SplashScreenAdapter; import games.rednblack.editor.view.frame.FileDropListener; import games.rednblack.editor.view.ui.panel.ImportPanel; import games.rednblack.h2d.common.MsgAPI; import com.kotcrab.vis.ui.VisUI; -import com.puremvc.patterns.proxy.Proxy; import org.lwjgl.BufferUtils; import org.lwjgl.glfw.GLFW; +import org.puremvc.java.interfaces.IProxy; +import org.puremvc.java.patterns.observer.Notification; import java.nio.IntBuffer; -public class HyperLap2D implements Proxy, ApplicationListener, Lwjgl3WindowListener { +public class HyperLap2D implements IProxy, ApplicationListener, Lwjgl3WindowListener { private static final String TAG = HyperLap2D.class.getCanonicalName(); public static final String NAME = TAG; @@ -53,7 +53,7 @@ public class HyperLap2D implements Proxy, ApplicationListener, Lwjgl3WindowListe private Object data; private AssetManager assetManager; - private final BaseNotification renderNotification; + private final Notification renderNotification; public HyperLap2DFacade getFacade() { return facade; @@ -62,7 +62,7 @@ public class HyperLap2D implements Proxy, ApplicationListener, Lwjgl3WindowListe private final Sync sync = new Sync(); public HyperLap2D() { - renderNotification = new BaseNotification(MsgAPI.RENDER, null, null); + renderNotification = new Notification(MsgAPI.RENDER, null, null); } @Override diff --git a/src/main/java/games/rednblack/editor/HyperLap2DFacade.java b/src/main/java/games/rednblack/editor/HyperLap2DFacade.java index 021526a1..8dc5c297 100644 --- a/src/main/java/games/rednblack/editor/HyperLap2DFacade.java +++ b/src/main/java/games/rednblack/editor/HyperLap2DFacade.java @@ -18,16 +18,16 @@ package games.rednblack.editor; -import com.puremvc.patterns.facade.SimpleFacade; -import com.puremvc.patterns.observer.BaseNotification; import games.rednblack.editor.controller.StartupCommand; import games.rednblack.editor.splash.SplashMediator; import games.rednblack.h2d.common.view.ui.StandardWidgetsFactory; +import org.puremvc.java.patterns.facade.Facade; +import org.puremvc.java.patterns.observer.Notification; /** * Created by sargis on 3/30/15. */ -public class HyperLap2DFacade extends SimpleFacade { +public class HyperLap2DFacade extends Facade { public static final String STARTUP = "startup"; private static HyperLap2DFacade instance = null; private HyperLap2D hyperlap2D; @@ -51,7 +51,7 @@ public class HyperLap2DFacade extends SimpleFacade { public void startup(HyperLap2D hyperlap2D) { this.hyperlap2D = hyperlap2D; - notifyObservers(new BaseNotification(STARTUP, null, null)); + notifyObservers(new Notification(STARTUP, null, null)); } @Override @@ -62,7 +62,7 @@ public class HyperLap2DFacade extends SimpleFacade { @Override protected void initializeController() { super.initializeController(); - registerCommand(STARTUP, StartupCommand.class); + registerCommand(STARTUP, StartupCommand::new); } @Override diff --git a/src/main/java/games/rednblack/editor/controller/BootstrapCommand.java b/src/main/java/games/rednblack/editor/controller/BootstrapCommand.java index efcca5de..af15cef7 100644 --- a/src/main/java/games/rednblack/editor/controller/BootstrapCommand.java +++ b/src/main/java/games/rednblack/editor/controller/BootstrapCommand.java @@ -21,85 +21,85 @@ package games.rednblack.editor.controller; import games.rednblack.editor.controller.commands.component.*; import games.rednblack.editor.splash.SplashScreenAdapter; import games.rednblack.h2d.common.MsgAPI; -import com.puremvc.patterns.command.SimpleCommand; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.*; import games.rednblack.editor.controller.commands.resource.*; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.command.SimpleCommand; /** * Created by azakhary on 4/28/2015. */ public class BootstrapCommand extends SimpleCommand { - public void execute(Notification notification) { + public void execute(INotification notification) { super.execute(notification); facade = HyperLap2DFacade.getInstance(); facade.sendNotification(SplashScreenAdapter.UPDATE_SPLASH, "Loading Commands..."); - facade.registerCommand(MsgAPI.ACTION_CUT, CutItemsCommand.class); - facade.registerCommand(MsgAPI.ACTION_COPY, CopyItemsCommand.class); - facade.registerCommand(MsgAPI.ACTION_PASTE, PasteItemsCommand.class); - facade.registerCommand(MsgAPI.ACTION_DELETE, DeleteItemsCommand.class); - facade.registerCommand(MsgAPI.ACTION_CREATE_ITEM, CreateItemCommand.class); - facade.registerCommand(MsgAPI.ACTION_CAMERA_CHANGE_COMPOSITE, CompositeCameraChangeCommand.class); - facade.registerCommand(MsgAPI.ACTION_CREATE_PRIMITIVE, CreatePrimitiveCommand.class); + facade.registerCommand(MsgAPI.ACTION_CUT, CutItemsCommand::new); + facade.registerCommand(MsgAPI.ACTION_COPY, CopyItemsCommand::new); + facade.registerCommand(MsgAPI.ACTION_PASTE, PasteItemsCommand::new); + facade.registerCommand(MsgAPI.ACTION_DELETE, DeleteItemsCommand::new); + facade.registerCommand(MsgAPI.ACTION_CREATE_ITEM, CreateItemCommand::new); + facade.registerCommand(MsgAPI.ACTION_CAMERA_CHANGE_COMPOSITE, CompositeCameraChangeCommand::new); + facade.registerCommand(MsgAPI.ACTION_CREATE_PRIMITIVE, CreatePrimitiveCommand::new); - facade.registerCommand(MsgAPI.ACTION_DELETE_LAYER, DeleteLayerCommand.class); - facade.registerCommand(MsgAPI.ACTION_NEW_LAYER, NewLayerCommand.class); - facade.registerCommand(MsgAPI.ACTION_SWAP_LAYERS, LayerSwapCommand.class); - facade.registerCommand(MsgAPI.ACTION_RENAME_LAYER, RenameLayerCommand.class); + facade.registerCommand(MsgAPI.ACTION_DELETE_LAYER, DeleteLayerCommand::new); + facade.registerCommand(MsgAPI.ACTION_NEW_LAYER, NewLayerCommand::new); + facade.registerCommand(MsgAPI.ACTION_SWAP_LAYERS, LayerSwapCommand::new); + facade.registerCommand(MsgAPI.ACTION_RENAME_LAYER, RenameLayerCommand::new); - facade.registerCommand(MsgAPI.ACTION_ADD_COMPONENT, AddComponentToItemCommand.class); - facade.registerCommand(MsgAPI.ACTION_REMOVE_COMPONENT, RemoveComponentFromItemCommand.class); - facade.registerCommand(MsgAPI.CUSTOM_VARIABLE_MODIFY, CustomVariableModifyCommand.class); + facade.registerCommand(MsgAPI.ACTION_ADD_COMPONENT, AddComponentToItemCommand::new); + facade.registerCommand(MsgAPI.ACTION_REMOVE_COMPONENT, RemoveComponentFromItemCommand::new); + facade.registerCommand(MsgAPI.CUSTOM_VARIABLE_MODIFY, CustomVariableModifyCommand::new); - facade.registerCommand(MsgAPI.ACTION_ITEMS_MOVE_TO, ItemsMoveCommand.class); + facade.registerCommand(MsgAPI.ACTION_ITEMS_MOVE_TO, ItemsMoveCommand::new); - facade.registerCommand(MsgAPI.ACTION_ITEM_AND_CHILDREN_TO, ItemChildrenTransformCommand.class); + facade.registerCommand(MsgAPI.ACTION_ITEM_AND_CHILDREN_TO, ItemChildrenTransformCommand::new); - facade.registerCommand(MsgAPI.ACTION_ITEM_TRANSFORM_TO, ItemTransformCommand.class); - facade.registerCommand(MsgAPI.ACTION_ADD_TO_LIBRARY, AddToLibraryCommand.class); - facade.registerCommand(MsgAPI.ACTION_CONVERT_TO_BUTTON, ConvertToButtonCommand.class); - facade.registerCommand(MsgAPI.ACTION_GROUP_ITEMS, ConvertToCompositeCommand.class); + facade.registerCommand(MsgAPI.ACTION_ITEM_TRANSFORM_TO, ItemTransformCommand::new); + facade.registerCommand(MsgAPI.ACTION_ADD_TO_LIBRARY, AddToLibraryCommand::new); + facade.registerCommand(MsgAPI.ACTION_CONVERT_TO_BUTTON, ConvertToButtonCommand::new); + facade.registerCommand(MsgAPI.ACTION_GROUP_ITEMS, ConvertToCompositeCommand::new); - facade.registerCommand(MsgAPI.ACTION_SET_SELECTION, SetSelectionCommand.class); - facade.registerCommand(MsgAPI.ACTION_ADD_SELECTION, AddSelectionCommand.class); - facade.registerCommand(MsgAPI.ACTION_RELEASE_SELECTION, ReleaseSelectionCommand.class); + facade.registerCommand(MsgAPI.ACTION_SET_SELECTION, SetSelectionCommand::new); + facade.registerCommand(MsgAPI.ACTION_ADD_SELECTION, AddSelectionCommand::new); + facade.registerCommand(MsgAPI.ACTION_RELEASE_SELECTION, ReleaseSelectionCommand::new); - facade.registerCommand(MsgAPI.ACTION_UPDATE_RULER_POSITION, ChangeRulerPositionCommand.class); - facade.registerCommand(MsgAPI.ACTION_CHANGE_POLYGON_VERTEX_POSITION, ChangePolygonVertexPositionCommand.class); - facade.registerCommand(MsgAPI.ACTION_DELETE_POLYGON_VERTEX, DeletePolygonVertexCommand.class); + facade.registerCommand(MsgAPI.ACTION_UPDATE_RULER_POSITION, ChangeRulerPositionCommand::new); + facade.registerCommand(MsgAPI.ACTION_CHANGE_POLYGON_VERTEX_POSITION, ChangePolygonVertexPositionCommand::new); + facade.registerCommand(MsgAPI.ACTION_DELETE_POLYGON_VERTEX, DeletePolygonVertexCommand::new); // DATA MODIFY by components - facade.registerCommand(MsgAPI.ACTION_UPDATE_SCENE_DATA, UpdateSceneDataCommand.class); - facade.registerCommand(MsgAPI.ACTION_UPDATE_ITEM_DATA, UpdateEntityComponentsCommand.class); - facade.registerCommand(MsgAPI.ACTION_UPDATE_LABEL_DATA, UpdateLabelDataCommand.class); - facade.registerCommand(MsgAPI.ACTION_UPDATE_LIGHT_DATA, UpdateLightDataCommand.class); - facade.registerCommand(MsgAPI.ACTION_UPDATE_COMPOSITE_DATA, UpdateCompositeDataCommand.class); - facade.registerCommand(MsgAPI.ACTION_UPDATE_BODY_LIGHT_DATA, UpdateLightBodyDataCommand.class); - facade.registerCommand(MsgAPI.ACTION_UPDATE_PHYSICS_BODY_DATA, UpdatePhysicsDataCommand.class); - facade.registerCommand(MsgAPI.ACTION_UPDATE_SHADER_DATA, UpdateShaderDataCommand.class); - facade.registerCommand(MsgAPI.ACTION_UPDATE_IMAGE_ITEM_DATA, UpdateImageItemDataCommand.class); - facade.registerCommand(MsgAPI.ACTION_UPDATE_SPRITE_ANIMATION_DATA, UpdateSpriteAnimationDataCommand.class); - facade.registerCommand(MsgAPI.ACTION_UPDATE_SPINE_ANIMATION_DATA, UpdateSpineDataCommand.class); + facade.registerCommand(MsgAPI.ACTION_UPDATE_SCENE_DATA, UpdateSceneDataCommand::new); + facade.registerCommand(MsgAPI.ACTION_UPDATE_ITEM_DATA, UpdateEntityComponentsCommand::new); + facade.registerCommand(MsgAPI.ACTION_UPDATE_LABEL_DATA, UpdateLabelDataCommand::new); + facade.registerCommand(MsgAPI.ACTION_UPDATE_LIGHT_DATA, UpdateLightDataCommand::new); + facade.registerCommand(MsgAPI.ACTION_UPDATE_COMPOSITE_DATA, UpdateCompositeDataCommand::new); + facade.registerCommand(MsgAPI.ACTION_UPDATE_BODY_LIGHT_DATA, UpdateLightBodyDataCommand::new); + facade.registerCommand(MsgAPI.ACTION_UPDATE_PHYSICS_BODY_DATA, UpdatePhysicsDataCommand::new); + facade.registerCommand(MsgAPI.ACTION_UPDATE_SHADER_DATA, UpdateShaderDataCommand::new); + facade.registerCommand(MsgAPI.ACTION_UPDATE_IMAGE_ITEM_DATA, UpdateImageItemDataCommand::new); + facade.registerCommand(MsgAPI.ACTION_UPDATE_SPRITE_ANIMATION_DATA, UpdateSpriteAnimationDataCommand::new); + facade.registerCommand(MsgAPI.ACTION_UPDATE_SPINE_ANIMATION_DATA, UpdateSpineDataCommand::new); - facade.registerCommand(MsgAPI.ACTION_UPDATE_MESH_DATA, UpdatePolygonDataCommand.class); + facade.registerCommand(MsgAPI.ACTION_UPDATE_MESH_DATA, UpdatePolygonDataCommand::new); - facade.registerCommand(MsgAPI.ACTION_EXPORT_PROJECT, ExportProjectCommand.class); - facade.registerCommand(MsgAPI.SAVE_EXPORT_PATH, SaveExportPathCommand.class); + facade.registerCommand(MsgAPI.ACTION_EXPORT_PROJECT, ExportProjectCommand::new); + facade.registerCommand(MsgAPI.SAVE_EXPORT_PATH, SaveExportPathCommand::new); - facade.registerCommand(MsgAPI.ACTION_PLUGIN_PROXY_COMMAND, PluginItemCommand.class); + facade.registerCommand(MsgAPI.ACTION_PLUGIN_PROXY_COMMAND, PluginItemCommand::new); // Resources - facade.registerCommand(MsgAPI.ACTION_DELETE_IMAGE_RESOURCE, DeleteImageResource.class); - facade.registerCommand(MsgAPI.ACTION_DELETE_LIBRARY_ITEM, DeleteLibraryItem.class); - facade.registerCommand(MsgAPI.ACTION_EXPORT_LIBRARY_ITEM, ExportLibraryItemCommand.class); - facade.registerCommand(MsgAPI.ACTION_DELETE_PARTICLE_EFFECT, DeleteParticleEffect.class); - facade.registerCommand(MsgAPI.ACTION_DELETE_SPINE_ANIMATION_RESOURCE, DeleteSpineAnimation.class); - facade.registerCommand(MsgAPI.ACTION_DELETE_SPRITE_ANIMATION_RESOURCE, DeleteSpriteAnimation.class); - facade.registerCommand(MsgAPI.ACTION_DELETE_SPRITER_ANIMATION_RESOURCE, DeleteSpriterAnimation.class); + facade.registerCommand(MsgAPI.ACTION_DELETE_IMAGE_RESOURCE, DeleteImageResource::new); + facade.registerCommand(MsgAPI.ACTION_DELETE_LIBRARY_ITEM, DeleteLibraryItem::new); + facade.registerCommand(MsgAPI.ACTION_EXPORT_LIBRARY_ITEM, ExportLibraryItemCommand::new); + facade.registerCommand(MsgAPI.ACTION_DELETE_PARTICLE_EFFECT, DeleteParticleEffect::new); + facade.registerCommand(MsgAPI.ACTION_DELETE_SPINE_ANIMATION_RESOURCE, DeleteSpineAnimation::new); + facade.registerCommand(MsgAPI.ACTION_DELETE_SPRITE_ANIMATION_RESOURCE, DeleteSpriteAnimation::new); + facade.registerCommand(MsgAPI.ACTION_DELETE_SPRITER_ANIMATION_RESOURCE, DeleteSpriterAnimation::new); - facade.registerCommand(MsgAPI.SHOW_NOTIFICATION, ShowNotificationCommand.class); + facade.registerCommand(MsgAPI.SHOW_NOTIFICATION, ShowNotificationCommand::new); } } diff --git a/src/main/java/games/rednblack/editor/controller/BootstrapPlugins.java b/src/main/java/games/rednblack/editor/controller/BootstrapPlugins.java index c3e1c769..a96215c4 100644 --- a/src/main/java/games/rednblack/editor/controller/BootstrapPlugins.java +++ b/src/main/java/games/rednblack/editor/controller/BootstrapPlugins.java @@ -21,13 +21,13 @@ package games.rednblack.editor.controller; import games.rednblack.editor.proxy.SettingsManager; import games.rednblack.editor.splash.SplashScreenAdapter; import games.rednblack.h2d.common.plugins.H2DPlugin; -import com.puremvc.patterns.command.SimpleCommand; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.PluginManager; import net.mountainblade.modular.Module; import net.mountainblade.modular.ModuleManager; import net.mountainblade.modular.impl.DefaultModuleManager; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.command.SimpleCommand; import java.io.File; import java.lang.reflect.InvocationTargetException; @@ -35,7 +35,7 @@ import java.util.Collection; public class BootstrapPlugins extends SimpleCommand { - public void execute(Notification notification) { + public void execute(INotification notification) { super.execute(notification); facade = HyperLap2DFacade.getInstance(); diff --git a/src/main/java/games/rednblack/editor/controller/BootstrapProxyCommand.java b/src/main/java/games/rednblack/editor/controller/BootstrapProxyCommand.java index e7e2ff31..e9aca76c 100644 --- a/src/main/java/games/rednblack/editor/controller/BootstrapProxyCommand.java +++ b/src/main/java/games/rednblack/editor/controller/BootstrapProxyCommand.java @@ -18,19 +18,19 @@ package games.rednblack.editor.controller; -import com.puremvc.patterns.command.SimpleCommand; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.*; import games.rednblack.editor.splash.SplashScreenAdapter; import games.rednblack.h2d.common.proxy.CursorManager; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.command.SimpleCommand; /** * Created by sargis on 4/1/15. */ public class BootstrapProxyCommand extends SimpleCommand { @Override - public void execute(Notification notification) { + public void execute(INotification notification) { super.execute(notification); facade = HyperLap2DFacade.getInstance(); facade.sendNotification(SplashScreenAdapter.UPDATE_SPLASH, "Loading Proxies..."); diff --git a/src/main/java/games/rednblack/editor/controller/BootstrapViewCommand.java b/src/main/java/games/rednblack/editor/controller/BootstrapViewCommand.java index 8153037e..c73843b7 100644 --- a/src/main/java/games/rednblack/editor/controller/BootstrapViewCommand.java +++ b/src/main/java/games/rednblack/editor/controller/BootstrapViewCommand.java @@ -18,8 +18,6 @@ package games.rednblack.editor.controller; -import com.puremvc.patterns.command.SimpleCommand; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.splash.SplashScreenAdapter; import games.rednblack.editor.view.ui.FollowersUIMediator; @@ -35,13 +33,15 @@ import games.rednblack.editor.view.ui.panel.CustomVariablesPanelMediator; import games.rednblack.editor.view.ui.panel.EditSpriteAnimationPanelMediator; import games.rednblack.editor.view.ui.panel.ImportPanelMediator; import games.rednblack.editor.view.ui.panel.TagsPanelMediator; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.command.SimpleCommand; /** * Created by sargis on 4/1/15. */ public class BootstrapViewCommand extends SimpleCommand { @Override - public void execute(Notification notification) { + public void execute(INotification notification) { super.execute(notification); facade = HyperLap2DFacade.getInstance(); facade.sendNotification(SplashScreenAdapter.UPDATE_SPLASH, "Loading Views..."); diff --git a/src/main/java/games/rednblack/editor/controller/SandboxCommand.java b/src/main/java/games/rednblack/editor/controller/SandboxCommand.java index 9c7a399a..e4cf2d8d 100644 --- a/src/main/java/games/rednblack/editor/controller/SandboxCommand.java +++ b/src/main/java/games/rednblack/editor/controller/SandboxCommand.java @@ -18,9 +18,9 @@ package games.rednblack.editor.controller; -import com.puremvc.patterns.command.SimpleCommand; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.HyperLap2DFacade; +import org.puremvc.java.patterns.command.SimpleCommand; /** * Created by azakhary on 4/28/2015. diff --git a/src/main/java/games/rednblack/editor/controller/StartupCommand.java b/src/main/java/games/rednblack/editor/controller/StartupCommand.java index 79b6647c..52f96574 100644 --- a/src/main/java/games/rednblack/editor/controller/StartupCommand.java +++ b/src/main/java/games/rednblack/editor/controller/StartupCommand.java @@ -18,7 +18,8 @@ package games.rednblack.editor.controller; -import com.puremvc.patterns.command.MacroCommand; + +import org.puremvc.java.patterns.command.MacroCommand; /** * Created by sargis on 3/30/15. @@ -28,9 +29,9 @@ public class StartupCommand extends MacroCommand { protected void initializeMacroCommand() { super.initializeMacroCommand(); - addSubCommand(BootstrapProxyCommand.class); - addSubCommand(BootstrapViewCommand.class); - addSubCommand(BootstrapCommand.class); - addSubCommand(BootstrapPlugins.class); + addSubCommand(BootstrapProxyCommand::new); + addSubCommand(BootstrapViewCommand::new); + addSubCommand(BootstrapCommand::new); + addSubCommand(BootstrapPlugins::new); } } diff --git a/src/main/java/games/rednblack/editor/controller/commands/ChangePolygonVertexPositionCommand.java b/src/main/java/games/rednblack/editor/controller/commands/ChangePolygonVertexPositionCommand.java index 7b106a2b..384808b7 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/ChangePolygonVertexPositionCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/ChangePolygonVertexPositionCommand.java @@ -2,7 +2,6 @@ package games.rednblack.editor.controller.commands; import com.badlogic.gdx.math.Vector2; import com.kotcrab.vis.ui.util.InputValidator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.SandboxCommand; import games.rednblack.editor.controller.commands.component.UpdatePolygonDataCommand; @@ -13,6 +12,7 @@ import games.rednblack.editor.view.ui.followers.PolygonFollower; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.ui.dialog.MultipleInputDialog; import games.rednblack.h2d.common.view.ui.listener.MultipleInputDialogListener; +import org.puremvc.java.interfaces.INotification; import java.util.Collections; @@ -21,7 +21,7 @@ public class ChangePolygonVertexPositionCommand extends SandboxCommand { private Object[] currentCommandPayload; @Override - public void execute(Notification notification) { + public void execute(INotification notification) { super.execute(notification); Object[] payload = notification.getBody(); diff --git a/src/main/java/games/rednblack/editor/controller/commands/DeletePolygonVertexCommand.java b/src/main/java/games/rednblack/editor/controller/commands/DeletePolygonVertexCommand.java index 7e544bd6..e8cb223d 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/DeletePolygonVertexCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/DeletePolygonVertexCommand.java @@ -2,7 +2,6 @@ package games.rednblack.editor.controller.commands; import com.badlogic.gdx.math.Vector2; import com.kotcrab.vis.ui.util.dialog.Dialogs; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.SandboxCommand; import games.rednblack.editor.controller.commands.component.UpdatePolygonDataCommand; @@ -11,11 +10,12 @@ import games.rednblack.editor.renderer.utils.ComponentRetriever; import games.rednblack.editor.utils.poly.PolygonUtils; import games.rednblack.editor.view.ui.followers.PolygonFollower; import games.rednblack.h2d.common.MsgAPI; +import org.puremvc.java.interfaces.INotification; public class DeletePolygonVertexCommand extends SandboxCommand { @Override - public void execute(Notification notification) { + public void execute(INotification notification) { super.execute(notification); Dialogs.showConfirmDialog(sandbox.getUIStage(), "Delete Vertex", @@ -26,7 +26,7 @@ public class DeletePolygonVertexCommand extends SandboxCommand { }).padBottom(20).pack(); } - private void callDoAction(Notification notification) { + private void callDoAction(INotification notification) { Object[] payload = notification.getBody(); PolygonFollower follower = (PolygonFollower) payload[0]; int anchor = (int) payload[1]; diff --git a/src/main/java/games/rednblack/editor/controller/commands/ExportProjectCommand.java b/src/main/java/games/rednblack/editor/controller/commands/ExportProjectCommand.java index 59b5df1f..22722999 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/ExportProjectCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/ExportProjectCommand.java @@ -18,15 +18,15 @@ package games.rednblack.editor.controller.commands; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.controller.SandboxCommand; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.h2d.common.MsgAPI; +import org.puremvc.java.interfaces.INotification; public class ExportProjectCommand extends SandboxCommand { @Override - public void execute(Notification notification) { + public void execute(INotification notification) { ProjectManager projectManager = facade.retrieveProxy(ProjectManager.NAME); projectManager.exportProject(); diff --git a/src/main/java/games/rednblack/editor/controller/commands/NonRevertibleCommand.java b/src/main/java/games/rednblack/editor/controller/commands/NonRevertibleCommand.java index f4b7d408..1c1d1267 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/NonRevertibleCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/NonRevertibleCommand.java @@ -1,12 +1,12 @@ package games.rednblack.editor.controller.commands; import com.kotcrab.vis.ui.util.dialog.Dialogs; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.controller.SandboxCommand; import games.rednblack.editor.proxy.CommandManager; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.proxy.SettingsManager; import games.rednblack.editor.renderer.data.CompositeItemVO; +import org.puremvc.java.interfaces.INotification; import java.util.HashMap; @@ -16,7 +16,7 @@ import java.util.HashMap; public abstract class NonRevertibleCommand extends SandboxCommand { protected CommandManager commandManager; - protected Notification notification; + protected INotification notification; protected boolean showConfirmDialog = true; protected boolean isCancelled = false; @@ -31,7 +31,7 @@ public abstract class NonRevertibleCommand extends SandboxCommand { } @Override - public void execute(Notification notification) { + public void execute(INotification notification) { commandManager = facade.retrieveProxy(CommandManager.NAME); this.notification = notification; if (showConfirmDialog) { diff --git a/src/main/java/games/rednblack/editor/controller/commands/RevertibleCommand.java b/src/main/java/games/rednblack/editor/controller/commands/RevertibleCommand.java index ff525fad..41d97c52 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/RevertibleCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/RevertibleCommand.java @@ -18,20 +18,20 @@ package games.rednblack.editor.controller.commands; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.controller.SandboxCommand; import games.rednblack.editor.proxy.CommandManager; +import org.puremvc.java.interfaces.INotification; public abstract class RevertibleCommand extends SandboxCommand { protected CommandManager commandManager; - protected Notification notification; + protected INotification notification; protected boolean isCancelled = false; protected boolean stateDone = false; @Override - public void execute(Notification notification) { + public void execute(INotification notification) { commandManager = facade.retrieveProxy(CommandManager.NAME); this.notification = notification; callDoAction(); @@ -50,7 +50,7 @@ public abstract class RevertibleCommand extends SandboxCommand { undoAction(); } - public Notification getNotification() { + public INotification getNotification() { return notification; } diff --git a/src/main/java/games/rednblack/editor/controller/commands/SaveExportPathCommand.java b/src/main/java/games/rednblack/editor/controller/commands/SaveExportPathCommand.java index f93c6bd6..14a39e2b 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/SaveExportPathCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/SaveExportPathCommand.java @@ -18,9 +18,9 @@ package games.rednblack.editor.controller.commands; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.controller.SandboxCommand; import games.rednblack.editor.proxy.ProjectManager; +import org.puremvc.java.interfaces.INotification; /** * Created by azakhary on 11/12/2015. @@ -28,7 +28,7 @@ import games.rednblack.editor.proxy.ProjectManager; public class SaveExportPathCommand extends SandboxCommand { @Override - public void execute(Notification notification) { + public void execute(INotification notification) { String path = notification.getBody(); ProjectManager projectManager = facade.retrieveProxy(ProjectManager.NAME); diff --git a/src/main/java/games/rednblack/editor/controller/commands/ShowNotificationCommand.java b/src/main/java/games/rednblack/editor/controller/commands/ShowNotificationCommand.java index e4a4b213..afd1b5cb 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/ShowNotificationCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/ShowNotificationCommand.java @@ -1,13 +1,13 @@ package games.rednblack.editor.controller.commands; import com.kotcrab.vis.ui.widget.toast.MessageToast; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.controller.SandboxCommand; +import org.puremvc.java.interfaces.INotification; public class ShowNotificationCommand extends SandboxCommand { @Override - public void execute(Notification notification) { + public void execute(INotification notification) { String text = notification.getBody(); final MessageToast messageToast = new MessageToast(text); messageToast.pad(10); diff --git a/src/main/java/games/rednblack/editor/controller/commands/TransactiveCommand.java b/src/main/java/games/rednblack/editor/controller/commands/TransactiveCommand.java index 88a8e804..86d94c9a 100644 --- a/src/main/java/games/rednblack/editor/controller/commands/TransactiveCommand.java +++ b/src/main/java/games/rednblack/editor/controller/commands/TransactiveCommand.java @@ -1,7 +1,7 @@ package games.rednblack.editor.controller.commands; import com.badlogic.gdx.utils.Array; -import com.puremvc.patterns.observer.Notification; +import org.puremvc.java.interfaces.INotification; /** * Created by CyberJoe on 7/25/2015. @@ -11,7 +11,7 @@ public abstract class TransactiveCommand extends RevertibleCommand { protected Array commands = new Array(); @Override - public void execute(Notification notification) { + public void execute(INotification notification) { this.notification = notification; transaction(); super.execute(notification); diff --git a/src/main/java/games/rednblack/editor/live/LivePreviewScreen.java b/src/main/java/games/rednblack/editor/live/LivePreviewScreen.java index 4987d0e0..d8368969 100644 --- a/src/main/java/games/rednblack/editor/live/LivePreviewScreen.java +++ b/src/main/java/games/rednblack/editor/live/LivePreviewScreen.java @@ -7,7 +7,6 @@ import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer; import com.badlogic.gdx.utils.viewport.ExtendViewport; import com.badlogic.gdx.utils.viewport.Viewport; -import com.puremvc.patterns.facade.Facade; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.proxy.ResolutionManager; @@ -15,6 +14,7 @@ import games.rednblack.editor.proxy.ResourceManager; import games.rednblack.editor.renderer.SceneLoader; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.extention.spine.SpineItemType; +import org.puremvc.java.interfaces.IFacade; public class LivePreviewScreen extends ScreenAdapter { private Viewport viewport; @@ -23,7 +23,7 @@ public class LivePreviewScreen extends ScreenAdapter { private final ProjectManager projectManager; private final Box2DDebugRenderer mBox2DDebugRenderer; - private final Facade facade = HyperLap2DFacade.getInstance(); + private final IFacade facade = HyperLap2DFacade.getInstance(); private final Color bgColor; public LivePreviewScreen() { diff --git a/src/main/java/games/rednblack/editor/proxy/CommandManager.java b/src/main/java/games/rednblack/editor/proxy/CommandManager.java index 14ad674b..07ccb99a 100644 --- a/src/main/java/games/rednblack/editor/proxy/CommandManager.java +++ b/src/main/java/games/rednblack/editor/proxy/CommandManager.java @@ -20,14 +20,14 @@ package games.rednblack.editor.proxy; import java.util.ArrayList; -import com.puremvc.patterns.proxy.BaseProxy; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.EntityModifyRevertibleCommand; import games.rednblack.editor.controller.commands.RevertibleCommand; import games.rednblack.editor.controller.commands.TransactiveCommand; import games.rednblack.editor.view.menu.FileMenu; +import org.puremvc.java.patterns.proxy.Proxy; -public class CommandManager extends BaseProxy { +public class CommandManager extends Proxy { private static final String TAG = CommandManager.class.getCanonicalName(); public static final String NAME = TAG; diff --git a/src/main/java/games/rednblack/editor/proxy/EditorTextureManager.java b/src/main/java/games/rednblack/editor/proxy/EditorTextureManager.java index e3b7b08a..c62ad3e4 100644 --- a/src/main/java/games/rednblack/editor/proxy/EditorTextureManager.java +++ b/src/main/java/games/rednblack/editor/proxy/EditorTextureManager.java @@ -22,12 +22,12 @@ import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.TextureAtlas; -import com.puremvc.patterns.proxy.BaseProxy; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.utils.MySkin; +import org.puremvc.java.patterns.proxy.Proxy; -public class EditorTextureManager extends BaseProxy { +public class EditorTextureManager extends Proxy { private static final String TAG = EditorTextureManager.class.getCanonicalName(); public static final String NAME = TAG; diff --git a/src/main/java/games/rednblack/editor/proxy/FontManager.java b/src/main/java/games/rednblack/editor/proxy/FontManager.java index c406c41d..49585f39 100644 --- a/src/main/java/games/rednblack/editor/proxy/FontManager.java +++ b/src/main/java/games/rednblack/editor/proxy/FontManager.java @@ -21,13 +21,13 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Preferences; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.utils.Array; -import com.puremvc.patterns.proxy.BaseProxy; import games.rednblack.editor.HyperLap2DFacade; +import org.puremvc.java.patterns.proxy.Proxy; /** * Created by azakhary on 4/24/2015. */ -public class FontManager extends BaseProxy { +public class FontManager extends Proxy { private static final String TAG = FontManager.class.getCanonicalName(); public static final String NAME = TAG; diff --git a/src/main/java/games/rednblack/editor/proxy/PluginManager.java b/src/main/java/games/rednblack/editor/proxy/PluginManager.java index d5469e0d..e64d3c1f 100644 --- a/src/main/java/games/rednblack/editor/proxy/PluginManager.java +++ b/src/main/java/games/rednblack/editor/proxy/PluginManager.java @@ -33,8 +33,6 @@ import games.rednblack.h2d.common.plugins.PluginAPI; import games.rednblack.h2d.common.proxy.CursorManager; import games.rednblack.h2d.common.view.tools.Tool; import com.kotcrab.vis.ui.widget.VisImageButton; -import com.puremvc.patterns.facade.Facade; -import com.puremvc.patterns.proxy.BaseProxy; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.PluginItemCommand; import games.rednblack.editor.factory.ItemFactory; @@ -52,13 +50,15 @@ import games.rednblack.editor.view.ui.box.UILayerBoxMediator; import games.rednblack.editor.view.ui.box.UIToolBoxMediator; import games.rednblack.h2d.common.vo.CursorData; import games.rednblack.h2d.common.vo.EditorConfigVO; +import org.puremvc.java.interfaces.IFacade; +import org.puremvc.java.patterns.proxy.Proxy; import java.util.*; /** * Created by azakhary on 7/24/2015. */ -public class PluginManager extends BaseProxy implements PluginAPI { +public class PluginManager extends Proxy implements PluginAPI { private static final String TAG = PluginManager.class.getCanonicalName(); public static final String NAME = TAG; @@ -205,7 +205,7 @@ public class PluginManager extends BaseProxy implements PluginAPI { } @Override - public Facade getFacade() { + public IFacade getFacade() { return facade; } diff --git a/src/main/java/games/rednblack/editor/proxy/ProjectManager.java b/src/main/java/games/rednblack/editor/proxy/ProjectManager.java index 71922764..1d1d5c9f 100755 --- a/src/main/java/games/rednblack/editor/proxy/ProjectManager.java +++ b/src/main/java/games/rednblack/editor/proxy/ProjectManager.java @@ -25,7 +25,6 @@ import com.badlogic.gdx.tools.texturepacker.TexturePacker.Settings; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Json; import com.kotcrab.vis.ui.util.dialog.Dialogs; -import com.puremvc.patterns.proxy.BaseProxy; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.data.manager.PreferencesManager; import games.rednblack.editor.data.migrations.ProjectVersionMigrator; @@ -43,6 +42,7 @@ import games.rednblack.h2d.common.ProgressHandler; import games.rednblack.h2d.common.vo.*; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; +import org.puremvc.java.patterns.proxy.Proxy; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; @@ -59,7 +59,7 @@ import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -public class ProjectManager extends BaseProxy { +public class ProjectManager extends Proxy { private static final String TAG = ProjectManager.class.getCanonicalName(); public static final String NAME = TAG; private static final String EVENT_PREFIX = "games.rednblack.editor.proxy.ProjectManager"; diff --git a/src/main/java/games/rednblack/editor/proxy/ResolutionManager.java b/src/main/java/games/rednblack/editor/proxy/ResolutionManager.java index 9148a9fd..1ec5720e 100644 --- a/src/main/java/games/rednblack/editor/proxy/ResolutionManager.java +++ b/src/main/java/games/rednblack/editor/proxy/ResolutionManager.java @@ -33,13 +33,11 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; import com.badlogic.gdx.files.FileHandle; -import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.tools.texturepacker.TexturePacker; import com.badlogic.gdx.tools.texturepacker.TextureUnpacker; import com.badlogic.gdx.utils.Array; import com.mortennobel.imagescaling.ResampleOp; -import com.puremvc.patterns.proxy.BaseProxy; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.ProgressHandler; import games.rednblack.editor.HyperLap2DFacade; @@ -47,8 +45,9 @@ import games.rednblack.editor.renderer.data.ProjectInfoVO; import games.rednblack.editor.renderer.data.ResolutionEntryVO; import games.rednblack.editor.utils.NinePatchUtils; import games.rednblack.editor.utils.HyperLap2DUtils; +import org.puremvc.java.patterns.proxy.Proxy; -public class ResolutionManager extends BaseProxy { +public class ResolutionManager extends Proxy { private static final String TAG = ResolutionManager.class.getCanonicalName(); public static final String NAME = TAG; diff --git a/src/main/java/games/rednblack/editor/proxy/ResourceManager.java b/src/main/java/games/rednblack/editor/proxy/ResourceManager.java index 6dc39696..fc10617c 100644 --- a/src/main/java/games/rednblack/editor/proxy/ResourceManager.java +++ b/src/main/java/games/rednblack/editor/proxy/ResourceManager.java @@ -28,17 +28,17 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator; import com.badlogic.gdx.graphics.glutils.ShaderProgram; import com.badlogic.gdx.utils.Json; -import com.puremvc.patterns.proxy.BaseProxy; import games.rednblack.editor.data.SpineAnimData; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.resources.FontSizePair; import games.rednblack.editor.renderer.resources.IResourceRetriever; import games.rednblack.editor.renderer.utils.MySkin; +import org.puremvc.java.patterns.proxy.Proxy; /** * Created by azakhary on 4/26/2015. */ -public class ResourceManager extends BaseProxy implements IResourceRetriever { +public class ResourceManager extends Proxy implements IResourceRetriever { public String packResolutionName = "orig"; diff --git a/src/main/java/games/rednblack/editor/proxy/SceneDataManager.java b/src/main/java/games/rednblack/editor/proxy/SceneDataManager.java index 959b8097..e7da6033 100644 --- a/src/main/java/games/rednblack/editor/proxy/SceneDataManager.java +++ b/src/main/java/games/rednblack/editor/proxy/SceneDataManager.java @@ -20,10 +20,10 @@ package games.rednblack.editor.proxy; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; -import com.puremvc.patterns.proxy.BaseProxy; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.data.SceneVO; import org.apache.commons.io.FileUtils; +import org.puremvc.java.patterns.proxy.Proxy; import java.io.File; import java.io.IOException; @@ -32,7 +32,7 @@ import java.util.ArrayList; /** * Created by sargis on 3/23/15. */ -public class SceneDataManager extends BaseProxy { +public class SceneDataManager extends Proxy { private static final String TAG = SceneDataManager.class.getCanonicalName(); public static final String NAME = TAG; diff --git a/src/main/java/games/rednblack/editor/proxy/SettingsManager.java b/src/main/java/games/rednblack/editor/proxy/SettingsManager.java index 301f5ad8..ea3d12f4 100644 --- a/src/main/java/games/rednblack/editor/proxy/SettingsManager.java +++ b/src/main/java/games/rednblack/editor/proxy/SettingsManager.java @@ -3,18 +3,18 @@ package games.rednblack.editor.proxy; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.utils.Json; -import com.puremvc.patterns.proxy.BaseProxy; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.Main; import games.rednblack.editor.utils.HyperLap2DUtils; import games.rednblack.h2d.common.vo.EditorConfigVO; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.SystemUtils; +import org.puremvc.java.patterns.proxy.Proxy; import java.io.File; import java.io.IOException; -public class SettingsManager extends BaseProxy { +public class SettingsManager extends Proxy { private static final String TAG = SettingsManager.class.getCanonicalName(); public static final String NAME = TAG; diff --git a/src/main/java/games/rednblack/editor/splash/SplashMediator.java b/src/main/java/games/rednblack/editor/splash/SplashMediator.java index 37b6c54f..3ba72a61 100644 --- a/src/main/java/games/rednblack/editor/splash/SplashMediator.java +++ b/src/main/java/games/rednblack/editor/splash/SplashMediator.java @@ -1,14 +1,11 @@ package games.rednblack.editor.splash; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DApp; import games.rednblack.editor.HyperLap2DFacade; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -public class SplashMediator extends SimpleMediator { +public class SplashMediator extends Mediator { private static final String TAG = SplashMediator.class.getCanonicalName(); private static final String NAME = TAG; @@ -32,7 +29,7 @@ public class SplashMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); System.out.println(notification.getBody().toString()); diff --git a/src/main/java/games/rednblack/editor/view/HyperLap2DScreenMediator.java b/src/main/java/games/rednblack/editor/view/HyperLap2DScreenMediator.java index 84856046..f5bd0f44 100644 --- a/src/main/java/games/rednblack/editor/view/HyperLap2DScreenMediator.java +++ b/src/main/java/games/rednblack/editor/view/HyperLap2DScreenMediator.java @@ -19,20 +19,19 @@ package games.rednblack.editor.view; import com.badlogic.ashley.core.Engine; -import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.proxy.SettingsManager; import games.rednblack.h2d.common.MsgAPI; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.systems.render.HyperLap2dRenderer; import games.rednblack.editor.view.stage.SandboxMediator; import games.rednblack.editor.view.ui.widget.actors.basic.SandboxBackUI; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; /** * Created by sargis on 3/30/15. */ -public class HyperLap2DScreenMediator extends SimpleMediator { +public class HyperLap2DScreenMediator extends Mediator { private static final String TAG = HyperLap2DScreenMediator.class.getCanonicalName(); public static final String NAME = TAG; @@ -55,7 +54,7 @@ public class HyperLap2DScreenMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); switch (notification.getName()) { case MsgAPI.CREATE: diff --git a/src/main/java/games/rednblack/editor/view/menu/HyperLap2DMenuBarMediator.java b/src/main/java/games/rednblack/editor/view/menu/HyperLap2DMenuBarMediator.java index cd16a612..0e837903 100644 --- a/src/main/java/games/rednblack/editor/view/menu/HyperLap2DMenuBarMediator.java +++ b/src/main/java/games/rednblack/editor/view/menu/HyperLap2DMenuBarMediator.java @@ -27,19 +27,19 @@ import games.rednblack.h2d.common.view.ui.widget.HyperLapFileChooser; import games.rednblack.h2d.common.MsgAPI; import com.kotcrab.vis.ui.widget.file.FileChooser; import com.kotcrab.vis.ui.widget.file.FileChooserAdapter; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.data.manager.PreferencesManager; import games.rednblack.editor.proxy.CommandManager; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.renderer.data.SceneVO; import games.rednblack.editor.view.stage.Sandbox; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; /** * Created by sargis on 3/25/15. */ -public class HyperLap2DMenuBarMediator extends SimpleMediator { +public class HyperLap2DMenuBarMediator extends Mediator { private static final String TAG = HyperLap2DMenuBarMediator.class.getCanonicalName(); public static final String NAME = TAG; private ProjectManager projectManager; @@ -81,7 +81,7 @@ public class HyperLap2DMenuBarMediator extends SimpleMediator } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); String type = notification.getType(); @@ -106,7 +106,7 @@ public class HyperLap2DMenuBarMediator extends SimpleMediator } } - private void handleGeneralNotification(Notification notification) { + private void handleGeneralNotification(INotification notification) { switch (notification.getName()) { case ProjectManager.PROJECT_OPENED: onProjectOpened(); @@ -114,7 +114,7 @@ public class HyperLap2DMenuBarMediator extends SimpleMediator } } - private void handleEditMenuNotification(Notification notification) { + private void handleEditMenuNotification(INotification notification) { Sandbox sandbox = Sandbox.getInstance(); switch (notification.getName()) { case EditMenu.CUT: @@ -137,7 +137,7 @@ public class HyperLap2DMenuBarMediator extends SimpleMediator } } - private void handleFileMenuNotification(Notification notification) { + private void handleFileMenuNotification(INotification notification) { Sandbox sandbox = Sandbox.getInstance(); switch (notification.getName()) { case FileMenu.NEW_PROJECT: diff --git a/src/main/java/games/rednblack/editor/view/stage/SandboxMediator.java b/src/main/java/games/rednblack/editor/view/stage/SandboxMediator.java index b6f19d7f..cbed5247 100644 --- a/src/main/java/games/rednblack/editor/view/stage/SandboxMediator.java +++ b/src/main/java/games/rednblack/editor/view/stage/SandboxMediator.java @@ -28,8 +28,6 @@ import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.SnapshotArray; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.tools.Tool; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.AddComponentToItemCommand; import games.rednblack.editor.controller.commands.CompositeCameraChangeCommand; @@ -42,6 +40,8 @@ import games.rednblack.editor.view.stage.input.EntityClickListener; import games.rednblack.editor.view.stage.input.InputListenerComponent; import games.rednblack.editor.view.stage.tools.*; import games.rednblack.editor.view.ui.box.UIToolBoxMediator; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; import java.util.HashMap; @@ -50,7 +50,7 @@ import static games.rednblack.editor.view.ui.box.UIToolBox.TOOL_CLICKED; /** * Created by sargis on 4/20/15. */ -public class SandboxMediator extends SimpleMediator { +public class SandboxMediator extends Mediator { private static final String TAG = SandboxMediator.class.getCanonicalName(); public static final String NAME = TAG; @@ -110,7 +110,7 @@ public class SandboxMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); switch (notification.getName()) { case MsgAPI.SCENE_LOADED: @@ -136,7 +136,7 @@ public class SandboxMediator extends SimpleMediator { } } - private void handleSceneLoaded(Notification notification) { + private void handleSceneLoaded(INotification notification) { initItemListeners(); setCurrentTool(SelectionTool.NAME); diff --git a/src/main/java/games/rednblack/editor/view/stage/UIStageMediator.java b/src/main/java/games/rednblack/editor/view/stage/UIStageMediator.java index 3a24af2e..9a7213e0 100644 --- a/src/main/java/games/rednblack/editor/view/stage/UIStageMediator.java +++ b/src/main/java/games/rednblack/editor/view/stage/UIStageMediator.java @@ -22,14 +22,14 @@ import com.badlogic.ashley.core.Entity; import games.rednblack.h2d.common.MsgAPI; import com.kotcrab.vis.ui.util.dialog.Dialogs; import com.kotcrab.vis.ui.util.dialog.InputDialogListener; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; /** * Created by sargis on 4/20/15. */ -public class UIStageMediator extends SimpleMediator { +public class UIStageMediator extends Mediator { private static final String TAG = UIStageMediator.class.getCanonicalName(); public static final String NAME = TAG; @@ -51,7 +51,7 @@ public class UIStageMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { switch (notification.getName()) { case MsgAPI.SHOW_ADD_LIBRARY_DIALOG: Sandbox sandbox = Sandbox.getInstance(); diff --git a/src/main/java/games/rednblack/editor/view/stage/tools/PolygonTool.java b/src/main/java/games/rednblack/editor/view/stage/tools/PolygonTool.java index 51a52632..4492a57f 100644 --- a/src/main/java/games/rednblack/editor/view/stage/tools/PolygonTool.java +++ b/src/main/java/games/rednblack/editor/view/stage/tools/PolygonTool.java @@ -23,20 +23,19 @@ import com.badlogic.gdx.Input; import com.badlogic.gdx.math.Intersector; import com.badlogic.gdx.math.Vector2; import games.rednblack.h2d.common.MsgAPI; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.AddComponentToItemCommand; import games.rednblack.editor.controller.commands.RemoveComponentFromItemCommand; import games.rednblack.editor.controller.commands.component.UpdatePolygonDataCommand; import games.rednblack.editor.renderer.components.PolygonComponent; import games.rednblack.editor.renderer.utils.ComponentRetriever; -import games.rednblack.editor.utils.poly.Clipper; import games.rednblack.editor.utils.poly.PolygonUtils; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.ui.FollowersUIMediator; import games.rednblack.editor.view.ui.followers.BasicFollower; import games.rednblack.editor.view.ui.followers.PolygonFollower; import games.rednblack.editor.view.ui.followers.PolygonTransformationListener; +import org.puremvc.java.interfaces.INotification; import java.util.Collections; import java.util.HashSet; @@ -85,7 +84,7 @@ public class PolygonTool extends SelectionTool implements PolygonTransformationL } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { switch (notification.getName()) { case AddComponentToItemCommand.DONE: updateSubFollowerList(); diff --git a/src/main/java/games/rednblack/editor/view/stage/tools/SimpleTool.java b/src/main/java/games/rednblack/editor/view/stage/tools/SimpleTool.java index 8f1b2464..1b40550a 100644 --- a/src/main/java/games/rednblack/editor/view/stage/tools/SimpleTool.java +++ b/src/main/java/games/rednblack/editor/view/stage/tools/SimpleTool.java @@ -2,12 +2,12 @@ package games.rednblack.editor.view.stage.tools; import com.badlogic.ashley.core.Entity; import games.rednblack.h2d.common.view.tools.Tool; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.ui.FollowersUIMediator; import games.rednblack.editor.view.ui.followers.BasicFollower; import games.rednblack.editor.view.ui.followers.NormalSelectionFollower; +import org.puremvc.java.interfaces.INotification; import java.util.Set; @@ -76,7 +76,7 @@ public abstract class SimpleTool implements Tool { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { } diff --git a/src/main/java/games/rednblack/editor/view/stage/tools/TransformTool.java b/src/main/java/games/rednblack/editor/view/stage/tools/TransformTool.java index e28c3b54..e4e7c3c6 100644 --- a/src/main/java/games/rednblack/editor/view/stage/tools/TransformTool.java +++ b/src/main/java/games/rednblack/editor/view/stage/tools/TransformTool.java @@ -24,7 +24,6 @@ import com.badlogic.gdx.math.Vector2; import com.kotcrab.vis.ui.util.OsUtils; import games.rednblack.editor.view.stage.tools.transformStrategy.*; import games.rednblack.h2d.common.MsgAPI; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.h2d.common.proxy.CursorManager; import games.rednblack.editor.renderer.components.TransformComponent; @@ -37,6 +36,7 @@ import games.rednblack.editor.view.ui.FollowersUIMediator; import games.rednblack.editor.view.ui.followers.FollowerTransformationListener; import games.rednblack.editor.view.ui.followers.NormalSelectionFollower; import games.rednblack.h2d.common.view.ui.Cursors; +import org.puremvc.java.interfaces.INotification; import java.util.HashSet; import java.util.Set; @@ -101,7 +101,7 @@ public class TransformTool extends SelectionTool implements FollowerTransformati } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { switch (notification.getName()) { case MsgAPI.NEW_ITEM_ADDED: updateListeners((Entity) notification.getBody()); diff --git a/src/main/java/games/rednblack/editor/view/ui/FollowersUIMediator.java b/src/main/java/games/rednblack/editor/view/ui/FollowersUIMediator.java index eab1e641..1a9fb425 100644 --- a/src/main/java/games/rednblack/editor/view/ui/FollowersUIMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/FollowersUIMediator.java @@ -20,9 +20,6 @@ package games.rednblack.editor.view.ui; import com.badlogic.ashley.core.Entity; import games.rednblack.h2d.common.MsgAPI; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.BaseNotification; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.CompositeCameraChangeCommand; import games.rednblack.editor.controller.commands.ConvertToCompositeCommand; @@ -34,6 +31,9 @@ import games.rednblack.editor.view.stage.tools.PanTool; import games.rednblack.editor.view.ui.followers.BasicFollower; import games.rednblack.editor.view.ui.followers.FollowerFactory; import games.rednblack.editor.view.ui.followers.NormalSelectionFollower; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; +import org.puremvc.java.patterns.observer.Notification; import java.util.HashMap; import java.util.Set; @@ -41,11 +41,11 @@ import java.util.Set; /** * Created by azakhary on 5/20/2015. */ -public class FollowersUIMediator extends SimpleMediator { +public class FollowersUIMediator extends Mediator { private static final String TAG = FollowersUIMediator.class.getCanonicalName(); public static final String NAME = TAG; - private HashMap followers = new HashMap<>(); + private final HashMap followers = new HashMap<>(); public FollowersUIMediator() { super(NAME, new FollowersUI()); @@ -76,7 +76,7 @@ public class FollowersUIMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); switch (notification.getName()) { case CompositeCameraChangeCommand.DONE: @@ -125,7 +125,7 @@ public class FollowersUIMediator extends SimpleMediator { } } - public void pushNotificationToFollowers(Notification notification) { + public void pushNotificationToFollowers(INotification notification) { for (BasicFollower follower : followers.values()) { follower.handleNotification(notification); } @@ -191,7 +191,7 @@ public class FollowersUIMediator extends SimpleMediator { followers.put(entity, follower); SandboxMediator sandboxMediator = facade.retrieveMediator(SandboxMediator.NAME); - follower.handleNotification(new BaseNotification(MsgAPI.TOOL_SELECTED, sandboxMediator.getCurrentSelectedToolName())); + follower.handleNotification(new Notification(MsgAPI.TOOL_SELECTED, sandboxMediator.getCurrentSelectedToolName())); } public void removeFollower(Entity entity) { diff --git a/src/main/java/games/rednblack/editor/view/ui/RulersUIMediator.java b/src/main/java/games/rednblack/editor/view/ui/RulersUIMediator.java index e2eaad6b..d18e05fb 100644 --- a/src/main/java/games/rednblack/editor/view/ui/RulersUIMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/RulersUIMediator.java @@ -1,19 +1,18 @@ package games.rednblack.editor.view.ui; -import com.badlogic.gdx.Gdx; import com.badlogic.gdx.utils.Array; import games.rednblack.h2d.common.MsgAPI; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.data.SceneVO; import games.rednblack.editor.utils.Guide; import games.rednblack.editor.view.stage.Sandbox; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; /** * Created by azakhary on 7/18/2015. */ -public class RulersUIMediator extends SimpleMediator { +public class RulersUIMediator extends Mediator { private static final String TAG = RulersUIMediator.class.getCanonicalName(); public static final String NAME = TAG; @@ -41,7 +40,7 @@ public class RulersUIMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); SceneVO sceneVO = Sandbox.getInstance().getSceneControl().getCurrentSceneVO(); diff --git a/src/main/java/games/rednblack/editor/view/ui/UIDropDownMenuMediator.java b/src/main/java/games/rednblack/editor/view/ui/UIDropDownMenuMediator.java index 81245a45..1268efb1 100644 --- a/src/main/java/games/rednblack/editor/view/ui/UIDropDownMenuMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/UIDropDownMenuMediator.java @@ -23,19 +23,19 @@ import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; import games.rednblack.editor.view.stage.tools.PolygonTool; import games.rednblack.h2d.common.MsgAPI; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.PluginManager; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.ui.box.UIResourcesBoxMediator; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; import java.util.HashMap; /** * Created by azakhary on 4/20/2015. */ -public class UIDropDownMenuMediator extends SimpleMediator { +public class UIDropDownMenuMediator extends Mediator { private static final String TAG = UIDropDownMenuMediator.class.getCanonicalName(); public static final String NAME = TAG; @@ -140,7 +140,7 @@ public class UIDropDownMenuMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); Array actionsSet; diff --git a/src/main/java/games/rednblack/editor/view/ui/box/PanelMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/PanelMediator.java index bada614b..4ac44ce9 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/PanelMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/PanelMediator.java @@ -19,14 +19,14 @@ package games.rednblack.editor.view.ui.box; import com.badlogic.gdx.scenes.scene2d.Actor; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.proxy.ProjectManager; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; /** * Created by azakhary on 6/17/2015. */ -public class PanelMediator extends SimpleMediator { +public class PanelMediator extends Mediator { /** * Constructor. * @@ -46,7 +46,7 @@ public class PanelMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); switch (notification.getName()) { case ProjectManager.PROJECT_OPENED: diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UIAlignBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/UIAlignBoxMediator.java index 12cef0f9..2083ec48 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UIAlignBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UIAlignBoxMediator.java @@ -23,9 +23,9 @@ import java.lang.reflect.Method; import java.util.stream.Stream; import com.badlogic.gdx.utils.Align; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.view.stage.ItemSelector; import games.rednblack.editor.view.stage.Sandbox; +import org.puremvc.java.interfaces.INotification; /** * Created by sargis on 4/10/15. @@ -56,7 +56,7 @@ public class UIAlignBoxMediator extends PanelMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); String alignFunctionName = ""; int align = -1; diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UICompositeHierarchyMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/UICompositeHierarchyMediator.java index 437a22ca..651917f4 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UICompositeHierarchyMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UICompositeHierarchyMediator.java @@ -3,21 +3,20 @@ package games.rednblack.editor.view.ui.box; import com.badlogic.ashley.core.Entity; import com.badlogic.gdx.utils.Array; import games.rednblack.h2d.common.MsgAPI; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.CompositeCameraChangeCommand; -import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.renderer.components.ParentNodeComponent; import games.rednblack.editor.renderer.data.CompositeItemVO; import games.rednblack.editor.renderer.utils.ComponentRetriever; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.view.stage.Sandbox; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; /** * Created by CyberJoe on 4/22/2015. */ -public class UICompositeHierarchyMediator extends SimpleMediator { +public class UICompositeHierarchyMediator extends Mediator { private static final String TAG = UICompositeHierarchyMediator.class.getCanonicalName(); public static final String NAME = TAG; @@ -36,7 +35,7 @@ public class UICompositeHierarchyMediator extends SimpleMediator { +public class UIGridBoxMediator extends Mediator { private static final String TAG = UIGridBoxMediator.class.getCanonicalName(); public static final String NAME = TAG; @@ -47,7 +47,7 @@ public class UIGridBoxMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); Sandbox sandbox = Sandbox.getInstance(); diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UIItemsTreeBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/UIItemsTreeBoxMediator.java index 22ab8963..98c3a87d 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UIItemsTreeBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UIItemsTreeBoxMediator.java @@ -4,7 +4,6 @@ import com.badlogic.ashley.core.Entity; import com.badlogic.gdx.scenes.scene2d.utils.Selection; import com.badlogic.gdx.utils.Array; import games.rednblack.h2d.common.MsgAPI; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.AddSelectionCommand; import games.rednblack.editor.controller.commands.ReleaseSelectionCommand; @@ -12,6 +11,7 @@ import games.rednblack.editor.controller.commands.SetSelectionCommand; import games.rednblack.editor.renderer.data.LayerItemVO; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.view.stage.Sandbox; +import org.puremvc.java.interfaces.INotification; import java.util.HashSet; import java.util.Set; @@ -46,7 +46,7 @@ public class UIItemsTreeBoxMediator extends PanelMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); Sandbox sandbox = Sandbox.getInstance(); switch (notification.getName()) { diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UILayerBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/UILayerBoxMediator.java index 2154e9b9..d5fabba6 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UILayerBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UILayerBoxMediator.java @@ -19,11 +19,9 @@ package games.rednblack.editor.view.ui.box; import com.badlogic.ashley.core.Entity; -import games.rednblack.editor.proxy.SceneDataManager; import games.rednblack.h2d.common.MsgAPI; import com.kotcrab.vis.ui.util.dialog.Dialogs; import com.kotcrab.vis.ui.util.dialog.InputDialogListener; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.*; import games.rednblack.editor.renderer.components.LayerMapComponent; @@ -33,6 +31,7 @@ import games.rednblack.editor.renderer.data.LayerItemVO; import games.rednblack.editor.renderer.utils.ComponentRetriever; import games.rednblack.editor.utils.runtime.EntityUtils; import games.rednblack.editor.view.stage.Sandbox; +import org.puremvc.java.interfaces.INotification; import java.util.ArrayList; import java.util.HashSet; @@ -83,7 +82,7 @@ public class UILayerBoxMediator extends PanelMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); Sandbox sandbox = Sandbox.getInstance(); UILayerBox.UILayerItem layerItem; diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UILivePreviewBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/UILivePreviewBoxMediator.java index 91f73df8..c96097ad 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UILivePreviewBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UILivePreviewBoxMediator.java @@ -5,18 +5,15 @@ import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Window; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3WindowListener; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.live.LiveScreenAdapter; -import games.rednblack.editor.live.WorldSizeVO; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.proxy.ResolutionManager; -import games.rednblack.editor.proxy.ResourceManager; -import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.h2d.common.MsgAPI; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; -public class UILivePreviewBoxMediator extends SimpleMediator { +public class UILivePreviewBoxMediator extends Mediator { private static final String TAG = UILivePreviewBoxMediator.class.getCanonicalName(); public static final String NAME = TAG; @@ -39,7 +36,7 @@ public class UILivePreviewBoxMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); switch (notification.getName()) { diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UIMultiPropertyBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/UIMultiPropertyBoxMediator.java index f19f82e1..cdd5197d 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UIMultiPropertyBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UIMultiPropertyBoxMediator.java @@ -24,8 +24,6 @@ import com.badlogic.gdx.utils.reflect.ReflectionException; import games.rednblack.editor.renderer.components.label.TypingLabelComponent; import games.rednblack.editor.renderer.components.light.LightBodyComponent; import games.rednblack.h2d.common.MsgAPI; -import com.puremvc.patterns.mediator.Mediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.AddComponentToItemCommand; import games.rednblack.editor.controller.commands.RemoveComponentFromItemCommand; @@ -42,6 +40,8 @@ import games.rednblack.editor.view.stage.tools.TextTool; import games.rednblack.editor.view.ui.properties.UIAbstractProperties; import games.rednblack.editor.view.ui.properties.UIAbstractPropertiesMediator; import games.rednblack.editor.view.ui.properties.panels.*; +import org.puremvc.java.interfaces.IMediator; +import org.puremvc.java.interfaces.INotification; import java.util.ArrayList; import java.util.HashMap; @@ -146,7 +146,7 @@ public class UIMultiPropertyBoxMediator extends PanelMediator propertyBoxMediator = facade.retrieveMediator(mediatorName); currentRegisteredPropertyBoxes.add(propertyBoxMediator); diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UIResolutionBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/UIResolutionBoxMediator.java index df567208..aa7e4b26 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UIResolutionBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UIResolutionBoxMediator.java @@ -20,19 +20,19 @@ package games.rednblack.editor.view.ui.box; import com.badlogic.gdx.math.Vector3; import com.kotcrab.vis.ui.util.dialog.Dialogs; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.proxy.ResolutionManager; import games.rednblack.editor.renderer.data.ResolutionEntryVO; import games.rednblack.editor.view.ui.dialog.CreateNewResolutionDialog; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; /** * Created by sargis on 4/8/15. */ -public class UIResolutionBoxMediator extends SimpleMediator { +public class UIResolutionBoxMediator extends Mediator { private static final String TAG = UIResolutionBoxMediator.class.getCanonicalName(); public static final String NAME = TAG; private ProjectManager projectManager; @@ -61,7 +61,7 @@ public class UIResolutionBoxMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); Sandbox sandbox = Sandbox.getInstance(); ResolutionEntryVO resolutionEntryVO; diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UIResourcesBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/UIResourcesBoxMediator.java index 11636d6d..2469250f 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UIResourcesBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UIResourcesBoxMediator.java @@ -22,13 +22,13 @@ import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; import com.badlogic.gdx.utils.Array; import games.rednblack.h2d.common.MsgAPI; import com.kotcrab.vis.ui.widget.tabbedpane.Tab; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.view.ui.box.resourcespanel.UIAnimationsTabMediator; import games.rednblack.editor.view.ui.box.resourcespanel.UIImagesTabMediator; import games.rednblack.editor.view.ui.box.resourcespanel.UILibraryItemsTabMediator; import games.rednblack.editor.view.ui.box.resourcespanel.UIParticleEffectsTabMediator; +import org.puremvc.java.interfaces.INotification; import java.util.stream.Stream; @@ -74,7 +74,7 @@ public class UIResourcesBoxMediator extends PanelMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); switch (notification.getName()) { case ProjectManager.PROJECT_OPENED: diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UISceneBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/UISceneBoxMediator.java index 447a7488..f449aece 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UISceneBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UISceneBoxMediator.java @@ -2,16 +2,16 @@ package games.rednblack.editor.view.ui.box; import com.kotcrab.vis.ui.util.dialog.Dialogs; import com.kotcrab.vis.ui.util.dialog.InputDialogListener; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.proxy.SceneDataManager; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.ui.validator.StringNameValidator; import games.rednblack.h2d.common.MsgAPI; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; -public class UISceneBoxMediator extends SimpleMediator { +public class UISceneBoxMediator extends Mediator { private static final String TAG = UISceneBoxMediator.class.getCanonicalName(); public static final String NAME = TAG; @@ -32,7 +32,7 @@ public class UISceneBoxMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); Sandbox sandbox = Sandbox.getInstance(); diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UIToolBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/UIToolBoxMediator.java index 09e4c866..35a90c14 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UIToolBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UIToolBoxMediator.java @@ -23,14 +23,14 @@ import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.tools.Tool; import com.kotcrab.vis.ui.widget.Separator; import com.kotcrab.vis.ui.widget.VisImageButton; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.stage.tools.*; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; import java.util.HashMap; -public class UIToolBoxMediator extends SimpleMediator { +public class UIToolBoxMediator extends Mediator { private static final String TAG = UIToolBoxMediator.class.getCanonicalName(); public static final String NAME = TAG; @@ -87,7 +87,7 @@ public class UIToolBoxMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); switch (notification.getName()) { diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UIZoomBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/UIZoomBoxMediator.java index 02ab85a7..47e172f1 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UIZoomBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UIZoomBoxMediator.java @@ -19,17 +19,17 @@ package games.rednblack.editor.view.ui.box; import games.rednblack.h2d.common.MsgAPI; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.view.stage.Sandbox; import org.apache.commons.lang3.math.NumberUtils; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; /** * Created by sargis on 4/9/15. */ -public class UIZoomBoxMediator extends SimpleMediator { +public class UIZoomBoxMediator extends Mediator { private static final String TAG = UIZoomBoxMediator.class.getCanonicalName(); public static final String NAME = TAG; @@ -56,7 +56,7 @@ public class UIZoomBoxMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); Sandbox sandbox = Sandbox.getInstance(); switch (notification.getName()) { diff --git a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIAnimationsTabMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIAnimationsTabMediator.java index 59b2af17..4cdcbdce 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIAnimationsTabMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UIAnimationsTabMediator.java @@ -21,7 +21,6 @@ package games.rednblack.editor.view.ui.box.resourcespanel; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.utils.Array; import games.rednblack.h2d.extention.spine.SpineItemType; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.controller.commands.resource.DeleteSpineAnimation; import games.rednblack.editor.controller.commands.resource.DeleteSpriteAnimation; import games.rednblack.editor.controller.commands.resource.DeleteSpriterAnimation; @@ -35,6 +34,7 @@ import games.rednblack.editor.view.ui.box.resourcespanel.draggable.box.SpineReso import games.rednblack.editor.view.ui.box.resourcespanel.draggable.box.SpriteResource; import games.rednblack.editor.view.ui.box.resourcespanel.draggable.box.SpriterResource; import org.apache.commons.lang3.ArrayUtils; +import org.puremvc.java.interfaces.INotification; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; @@ -65,7 +65,7 @@ public class UIAnimationsTabMediator extends UIResourcesTabMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); switch (notification.getName()) { case DeleteImageResource.DONE: diff --git a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UILibraryItemsTabMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UILibraryItemsTabMediator.java index 9cf82f36..f7827250 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UILibraryItemsTabMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/UILibraryItemsTabMediator.java @@ -21,7 +21,6 @@ package games.rednblack.editor.view.ui.box.resourcespanel; import com.badlogic.gdx.utils.Array; import games.rednblack.editor.controller.commands.resource.ExportLibraryItemCommand; import games.rednblack.h2d.common.MsgAPI; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.resource.DeleteLibraryItem; import games.rednblack.editor.factory.ItemFactory; @@ -30,6 +29,7 @@ import games.rednblack.editor.renderer.data.CompositeItemVO; import games.rednblack.editor.view.ui.box.resourcespanel.draggable.DraggableResource; import games.rednblack.editor.view.ui.box.resourcespanel.draggable.list.LibraryItemResource; import org.apache.commons.lang3.ArrayUtils; +import org.puremvc.java.interfaces.INotification; import java.util.HashMap; @@ -58,7 +58,7 @@ public class UILibraryItemsTabMediator extends UIResourcesTabMediator extends SimpleMediator { +public abstract class UIResourcesTabMediator extends Mediator { /** * Constructor. * @@ -54,7 +54,7 @@ public abstract class UIResourcesTabMediator extends S @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { switch (notification.getName()) { case ProjectManager.PROJECT_OPENED: case ProjectManager.PROJECT_DATA_UPDATED: diff --git a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/BoxItemResource.java b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/BoxItemResource.java index 70099fe4..45056054 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/BoxItemResource.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/box/BoxItemResource.java @@ -23,7 +23,7 @@ import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.scenes.scene2d.Group; import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.InputListener; -import com.puremvc.patterns.facade.SimpleFacade; +import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.ui.widget.actors.basic.PixelRect; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.ui.box.resourcespanel.draggable.DraggableResourceView; @@ -54,7 +54,7 @@ public abstract class BoxItemResource extends Group implements DraggableResource } public void touchUp (InputEvent event, float x, float y, int pointer, int button) { if(button == Input.Buttons.RIGHT) { - SimpleFacade.getInstance().sendNotification(eventName, payload); + HyperLap2DFacade.getInstance().sendNotification(eventName, payload); } } }); diff --git a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/list/ListItemResource.java b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/list/ListItemResource.java index a25c8153..23140637 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/list/ListItemResource.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/resourcespanel/draggable/list/ListItemResource.java @@ -27,7 +27,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.utils.Drawable; import com.kotcrab.vis.ui.VisUI; import com.kotcrab.vis.ui.widget.VisLabel; -import com.puremvc.patterns.facade.SimpleFacade; +import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.ui.box.resourcespanel.draggable.DraggableResourceView; @@ -55,7 +55,7 @@ public abstract class ListItemResource extends Button implements DraggableResour } public void touchUp (InputEvent event, float x, float y, int pointer, int button) { if(button == Input.Buttons.RIGHT) { - SimpleFacade.getInstance().sendNotification(eventName, payload); + HyperLap2DFacade.getInstance().sendNotification(eventName, payload); } } }); diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/AboutDialog.java b/src/main/java/games/rednblack/editor/view/ui/dialog/AboutDialog.java index b646b446..7b69b799 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/AboutDialog.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/AboutDialog.java @@ -24,7 +24,7 @@ public class AboutDialog extends H2DDialog { scrollPane.setFadeScrollBars(false); mainTable.add(leftTable).top().padLeft(10).left(); - mainTable.add(scrollPane).maxHeight(300).top().width(450).padLeft(28).expand().left(); + mainTable.add(scrollPane).maxHeight(300).top().width(550).padLeft(28).expand().left(); leftTable.add(new VisImage(VisUI.getSkin().getDrawable("splash_logo"))).pad(5).row(); leftTable.add("HyperLap2D").padLeft(5).padRight(5).row(); @@ -38,12 +38,12 @@ public class AboutDialog extends H2DDialog { forkTable.add(new LinkLabel("Overlap2D", "https://github.com/UnderwaterApps/overlap2d")); contentTable.add(forkTable).left().row(); contentTable.add("").row(); - contentTable.add("HyperLap2D is based on following libraries and open source tools:").left().row(); + contentTable.add("HyperLap2D is based on following libraries and open source tools:").left().padBottom(4).row(); contentTable.add(new LinkLabel("- libGDX [https://github.com/libgdx/libgdx]", "https://github.com/libgdx/libgdx")).padLeft(6).left().row(); contentTable.add(new LinkLabel("- Overlap2D [https://github.com/UnderwaterApps/overlap2d]", "https://github.com/UnderwaterApps/overlap2d")).padLeft(6).left().row(); contentTable.add(new LinkLabel("- Ashley [https://github.com/libgdx/ashley]", "https://github.com/libgdx/ashley")).padLeft(6).left().row(); contentTable.add(new LinkLabel("- Box2DLights [https://github.com/libgdx/box2dlights]", "https://github.com/libgdx/box2dlights")).padLeft(6).left().row(); - contentTable.add(new LinkLabel("- PureMVC Framework [https://puremvc.org]", "https://puremvc.org/")).padLeft(6).left().row(); + contentTable.add(new LinkLabel("- PureMVC Framework [https://github.com/PureMVC/puremvc-java-standard-framework]", "https://github.com/PureMVC/puremvc-java-standard-framework")).padLeft(6).left().row(); contentTable.add(new LinkLabel("- VisUI [https://github.com/kotcrab/vis-ui]", "https://github.com/kotcrab/vis-ui")).padLeft(6).left().row(); contentTable.add(new LinkLabel("- Modular [https://github.com/mountainblade/modular]", "https://github.com/mountainblade/modular")).padLeft(6).left().row(); contentTable.add(new LinkLabel("- Spine Runtime [https://github.com/EsotericSoftware/spine-runtimes]", "https://github.com/EsotericSoftware/spine-runtimes")).padLeft(6).left().row(); diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/AboutDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/AboutDialogMediator.java index 79dcb783..423aee6b 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/AboutDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/AboutDialogMediator.java @@ -1,13 +1,13 @@ package games.rednblack.editor.view.ui.dialog; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.menu.HelpMenu; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.UIStage; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; -public class AboutDialogMediator extends SimpleMediator { +public class AboutDialogMediator extends Mediator { private static final String TAG = AboutDialogMediator.class.getCanonicalName(); private static final String NAME = TAG; @@ -29,7 +29,7 @@ public class AboutDialogMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); Sandbox sandbox = Sandbox.getInstance(); UIStage uiStage = sandbox.getUIStage(); diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/AutoTraceDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/AutoTraceDialogMediator.java index e925661f..e627547b 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/AutoTraceDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/AutoTraceDialogMediator.java @@ -2,8 +2,6 @@ package games.rednblack.editor.view.ui.dialog; import com.badlogic.ashley.core.Entity; import com.badlogic.gdx.math.Vector2; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.PolygonComponent; import games.rednblack.editor.renderer.components.TextureRegionComponent; @@ -12,10 +10,12 @@ import games.rednblack.editor.utils.poly.tracer.Tracer; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.UIStage; import games.rednblack.h2d.common.MsgAPI; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; import java.util.stream.Stream; -public class AutoTraceDialogMediator extends SimpleMediator { +public class AutoTraceDialogMediator extends Mediator { private static final String TAG = AutoTraceDialogMediator.class.getCanonicalName(); private static final String NAME = TAG; @@ -41,7 +41,7 @@ public class AutoTraceDialogMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); Sandbox sandbox = Sandbox.getInstance(); UIStage uiStage = sandbox.getUIStage(); diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/CodeEditorDialog.java b/src/main/java/games/rednblack/editor/view/ui/dialog/CodeEditorDialog.java index ae329919..65dfa2e0 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/CodeEditorDialog.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/CodeEditorDialog.java @@ -22,7 +22,6 @@ public class CodeEditorDialog extends H2DDialog { setResizable(true); textArea = new HighlightTextArea("", "code-editor"); - getContentTable().add(textArea.createCompatibleScrollPane()).grow().row(); VisTextButton cancelButton = StandardWidgetsFactory.createTextButton("Cancel"); @@ -46,6 +45,8 @@ public class CodeEditorDialog extends H2DDialog { getButtonsTable().add(cancelButton).width(65).pad(2).right(); getButtonsTable().add(saveButton).width(65).pad(2).right(); getCell(getButtonsTable()).right(); + + pack(); } public void setSyntax(Highlighter syntax) { @@ -54,8 +55,9 @@ public class CodeEditorDialog extends H2DDialog { } public void setText(String text) { - if (text != null) + if (text != null) { textArea.setText(text); + } } public void setNotificationCallback(String notificationCallback) { @@ -64,11 +66,11 @@ public class CodeEditorDialog extends H2DDialog { @Override public float getPrefWidth() { - return Sandbox.getInstance().getUIStage().getWidth() * 0.7f; + return 900; } @Override public float getPrefHeight() { - return Sandbox.getInstance().getUIStage().getHeight() * 0.8f; + return 700; } } diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/CodeEditorDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/CodeEditorDialogMediator.java index 6107c01b..00244f52 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/CodeEditorDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/CodeEditorDialogMediator.java @@ -1,14 +1,14 @@ package games.rednblack.editor.view.ui.dialog; import com.kotcrab.vis.ui.util.highlight.Highlighter; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.UIStage; import games.rednblack.h2d.common.MsgAPI; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; -public class CodeEditorDialogMediator extends SimpleMediator { +public class CodeEditorDialogMediator extends Mediator { private static final String TAG = CodeEditorDialogMediator.class.getCanonicalName(); private static final String NAME = TAG; @@ -31,7 +31,7 @@ public class CodeEditorDialogMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { Sandbox sandbox = Sandbox.getInstance(); UIStage uiStage = sandbox.getUIStage(); switch (notification.getName()) { diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/CreateNewResolutionDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/CreateNewResolutionDialogMediator.java index 8a499bd4..dc4cfc19 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/CreateNewResolutionDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/CreateNewResolutionDialogMediator.java @@ -18,19 +18,19 @@ package games.rednblack.editor.view.ui.dialog; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ResolutionManager; import games.rednblack.editor.view.stage.UIStage; import games.rednblack.editor.view.ui.box.UIResolutionBox; import games.rednblack.editor.renderer.data.ResolutionEntryVO; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; /** * Created by sargis on 4/9/15. */ -public class CreateNewResolutionDialogMediator extends SimpleMediator { +public class CreateNewResolutionDialogMediator extends Mediator { private static final String TAG = CreateNewResolutionDialogMediator.class.getCanonicalName(); private static final String NAME = TAG; @@ -53,7 +53,7 @@ public class CreateNewResolutionDialogMediator extends SimpleMediator { +public class NewProjectDialogMediator extends Mediator { private static final String TAG = NewProjectDialogMediator.class.getCanonicalName(); private static final String NAME = TAG; @@ -57,7 +56,7 @@ public class NewProjectDialogMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); Sandbox sandbox = Sandbox.getInstance(); UIStage uiStage = sandbox.getUIStage(); diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/SaveProjectDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/SaveProjectDialogMediator.java index 7f6b7a45..591308f0 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/SaveProjectDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/SaveProjectDialogMediator.java @@ -1,15 +1,15 @@ package games.rednblack.editor.view.ui.dialog; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DApp; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.ProjectManager; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.UIStage; import games.rednblack.h2d.common.MsgAPI; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; -public class SaveProjectDialogMediator extends SimpleMediator { +public class SaveProjectDialogMediator extends Mediator { private static final String TAG = SaveProjectDialogMediator.class.getCanonicalName(); private static final String NAME = TAG; @@ -31,7 +31,7 @@ public class SaveProjectDialogMediator extends SimpleMediator } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); Sandbox sandbox = Sandbox.getInstance(); UIStage uiStage = sandbox.getUIStage(); diff --git a/src/main/java/games/rednblack/editor/view/ui/dialog/SettingsDialogMediator.java b/src/main/java/games/rednblack/editor/view/ui/dialog/SettingsDialogMediator.java index b3e96a7d..9d0e575a 100644 --- a/src/main/java/games/rednblack/editor/view/ui/dialog/SettingsDialogMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/dialog/SettingsDialogMediator.java @@ -1,20 +1,19 @@ package games.rednblack.editor.view.ui.dialog; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.proxy.SettingsManager; import games.rednblack.editor.view.menu.FileMenu; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.UIStage; import games.rednblack.editor.view.ui.settings.GeneralSettings; -import games.rednblack.editor.view.ui.settings.LivePreviewSettings; import games.rednblack.editor.view.ui.settings.PluginsSettings; import games.rednblack.editor.view.ui.settings.SandboxSettings; import games.rednblack.h2d.common.MsgAPI; import games.rednblack.h2d.common.view.SettingsNodeValue; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; -public class SettingsDialogMediator extends SimpleMediator { +public class SettingsDialogMediator extends Mediator { private static final String TAG = SettingsDialogMediator.class.getCanonicalName(); private static final String NAME = TAG; @@ -56,7 +55,7 @@ public class SettingsDialogMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); Sandbox sandbox = Sandbox.getInstance(); UIStage uiStage = sandbox.getUIStage(); diff --git a/src/main/java/games/rednblack/editor/view/ui/followers/BasicFollower.java b/src/main/java/games/rednblack/editor/view/ui/followers/BasicFollower.java index 06d90b45..288c32c3 100644 --- a/src/main/java/games/rednblack/editor/view/ui/followers/BasicFollower.java +++ b/src/main/java/games/rednblack/editor/view/ui/followers/BasicFollower.java @@ -25,12 +25,12 @@ import com.badlogic.gdx.scenes.scene2d.Actor; import com.badlogic.gdx.scenes.scene2d.Group; import com.badlogic.gdx.utils.Array; import com.badlogic.gdx.utils.Pools; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.renderer.components.DimensionsComponent; import games.rednblack.editor.renderer.components.TransformComponent; import games.rednblack.editor.renderer.utils.TransformMathUtils; import games.rednblack.editor.renderer.utils.ComponentRetriever; +import org.puremvc.java.interfaces.INotification; /** * Created by azakhary on 5/20/2015. @@ -134,7 +134,7 @@ public abstract class BasicFollower extends Group { return hitActor; } - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { for(SubFollower follower: subFollowers) { follower.handleNotification(notification); } diff --git a/src/main/java/games/rednblack/editor/view/ui/followers/NormalSelectionFollower.java b/src/main/java/games/rednblack/editor/view/ui/followers/NormalSelectionFollower.java index 88254723..c9f02ab6 100644 --- a/src/main/java/games/rednblack/editor/view/ui/followers/NormalSelectionFollower.java +++ b/src/main/java/games/rednblack/editor/view/ui/followers/NormalSelectionFollower.java @@ -26,12 +26,12 @@ import com.badlogic.gdx.scenes.scene2d.Touchable; import com.badlogic.gdx.scenes.scene2d.ui.Image; import games.rednblack.h2d.common.MsgAPI; import com.kotcrab.vis.ui.VisUI; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.view.ui.widget.actors.basic.PixelRect; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.h2d.common.proxy.CursorManager; import games.rednblack.editor.view.stage.tools.TransformTool; import games.rednblack.editor.view.ui.widget.EmptyTarget; +import org.puremvc.java.interfaces.INotification; /** * Created by azakhary on 5/20/2015. @@ -217,7 +217,7 @@ public class NormalSelectionFollower extends BasicFollower { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); switch (notification.getName()) { case MsgAPI.TOOL_SELECTED: diff --git a/src/main/java/games/rednblack/editor/view/ui/followers/SubFollower.java b/src/main/java/games/rednblack/editor/view/ui/followers/SubFollower.java index b57dd67a..d1b16ba1 100644 --- a/src/main/java/games/rednblack/editor/view/ui/followers/SubFollower.java +++ b/src/main/java/games/rednblack/editor/view/ui/followers/SubFollower.java @@ -2,7 +2,7 @@ package games.rednblack.editor.view.ui.followers; import com.badlogic.ashley.core.Entity; import com.badlogic.gdx.scenes.scene2d.Actor; -import com.puremvc.patterns.observer.Notification; +import org.puremvc.java.interfaces.INotification; /** * Created by CyberJoe on 7/2/2015. @@ -22,7 +22,7 @@ public abstract class SubFollower extends Actor { } - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { } diff --git a/src/main/java/games/rednblack/editor/view/ui/panel/CustomVariablesPanelMediator.java b/src/main/java/games/rednblack/editor/view/ui/panel/CustomVariablesPanelMediator.java index 4995f718..cc199862 100644 --- a/src/main/java/games/rednblack/editor/view/ui/panel/CustomVariablesPanelMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/panel/CustomVariablesPanelMediator.java @@ -21,8 +21,6 @@ package games.rednblack.editor.view.ui.panel; import com.badlogic.ashley.core.Entity; import games.rednblack.editor.view.menu.WindowMenu; import games.rednblack.h2d.common.MsgAPI; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.controller.commands.CustomVariableModifyCommand; import games.rednblack.editor.renderer.components.MainItemComponent; @@ -30,13 +28,15 @@ import games.rednblack.editor.renderer.utils.ComponentRetriever; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.UIStage; import games.rednblack.editor.view.ui.properties.panels.UIBasicItemProperties; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; import java.util.Set; /** * Created by azakhary on 5/12/2015. */ -public class CustomVariablesPanelMediator extends SimpleMediator { +public class CustomVariablesPanelMediator extends Mediator { private static final String TAG = CustomVariablesPanelMediator.class.getCanonicalName(); private static final String NAME = TAG; @@ -67,7 +67,7 @@ public class CustomVariablesPanelMediator extends SimpleMediator { +public class EditSpriteAnimationPanelMediator extends Mediator { private static final String TAG = EditSpriteAnimationPanelMediator.class.getCanonicalName(); private static final String NAME = TAG; @@ -68,7 +68,7 @@ public class EditSpriteAnimationPanelMediator extends SimpleMediator { +public class ImportPanelMediator extends Mediator { private static final String TAG = ImportPanelMediator.class.getCanonicalName(); private static final String NAME = TAG; @@ -85,7 +85,7 @@ public class ImportPanelMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); Sandbox sandbox = Sandbox.getInstance(); UIStage uiStage = sandbox.getUIStage(); diff --git a/src/main/java/games/rednblack/editor/view/ui/panel/TagsPanelMediator.java b/src/main/java/games/rednblack/editor/view/ui/panel/TagsPanelMediator.java index 762ed70d..7008b368 100644 --- a/src/main/java/games/rednblack/editor/view/ui/panel/TagsPanelMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/panel/TagsPanelMediator.java @@ -2,21 +2,21 @@ package games.rednblack.editor.view.ui.panel; import com.badlogic.ashley.core.Entity; import games.rednblack.h2d.common.MsgAPI; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.renderer.components.MainItemComponent; import games.rednblack.editor.renderer.utils.ComponentRetriever; import games.rednblack.editor.view.stage.Sandbox; import games.rednblack.editor.view.stage.UIStage; import games.rednblack.editor.view.ui.properties.panels.UIBasicItemProperties; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; import java.util.Set; /** * Created by azakhary on 8/1/2015. */ -public class TagsPanelMediator extends SimpleMediator { +public class TagsPanelMediator extends Mediator { private static final String TAG = TagsPanelMediator.class.getCanonicalName(); private static final String NAME = TAG; @@ -44,7 +44,7 @@ public class TagsPanelMediator extends SimpleMediator { } @Override - public void handleNotification(Notification notification) { + public void handleNotification(INotification notification) { super.handleNotification(notification); Sandbox sandbox = Sandbox.getInstance(); diff --git a/src/main/java/games/rednblack/editor/view/ui/properties/UIAbstractPropertiesMediator.java b/src/main/java/games/rednblack/editor/view/ui/properties/UIAbstractPropertiesMediator.java index 89ab7a68..041b27c4 100644 --- a/src/main/java/games/rednblack/editor/view/ui/properties/UIAbstractPropertiesMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/properties/UIAbstractPropertiesMediator.java @@ -19,15 +19,15 @@ package games.rednblack.editor.view.ui.properties; import games.rednblack.h2d.common.MsgAPI; -import com.puremvc.patterns.mediator.SimpleMediator; -import com.puremvc.patterns.observer.Notification; import games.rednblack.editor.HyperLap2DFacade; import games.rednblack.editor.view.stage.Sandbox; +import org.puremvc.java.interfaces.INotification; +import org.puremvc.java.patterns.mediator.Mediator; /** * Created by azakhary on 4/15/2015. */ -public abstract class UIAbstractPropertiesMediator extends SimpleMediator { +public abstract class UIAbstractPropertiesMediator extends Mediator { private Sandbox sandbox; protected T observableReference; @@ -56,7 +56,7 @@ public abstract class UIAbstractPropertiesMediator { @@ -44,7 +44,7 @@ public class UILabelItemPropertiesMediator extends UIItemPropertiesMediator { @@ -40,7 +40,7 @@ public class UILightBodyPropertiesMediator extends UIItemPropertiesMediator { @@ -34,7 +34,7 @@ public class UIPhysicsPropertiesMediator extends UIItemPropertiesMediator { private static final String TAG = UITypingLabelPropertiesMediator.class.getCanonicalName(); @@ -30,7 +30,7 @@ public class UITypingLabelPropertiesMediator extends UIItemPropertiesMediator