diff --git a/README.md b/README.md
index 66775c3..cb39a76 100755
--- a/README.md
+++ b/README.md
@@ -8,12 +8,22 @@ PureMVC is a lightweight framework for creating applications based upon the clas
* [Standard Version Overview Presentation](http://puremvc.tv/#P100)
* [Legacy Implementation](https://github.com/PureMVC/puremvc-java-standard-framework/tree/1.2)
+## Maven Installation
+```xml
+
- In PureMVC, the In PureMVC, the
- Your application must register
- The simplest way is to subclass Your application must register The simplest way is to subclass P
IProxy
implementation.C
Class Controller
implements IController
IController
implementation.
- Controller
class follows the
+
+ Controller
class follows the
'Command and Controller' strategy, and assumes these
- responsibilities:
+ responsibilities:
- ICommand
s
are intended to handle which INotifications
.Class Controller
method, passing in the INotification
.
ICommands
with the
- Controller.
- Facade
,
+
+ ICommands
with the
+ Controller.Facade
,
and use its initializeController
method to add your
- registrations.
View
,
@@ -385,11 +385,10 @@ public Controller()
- This IController
implementation is a Singleton,
+
This IController
implementation is a Singleton,
so you should not call the constructor
directly, but instead call the static Singleton
- Factory method Controller.getInstance()
Controller.getInstance()
java.lang.Error
- Error if Singleton instance has already been constructedpublic void executeCommand(INotification notification)-
ICommand
has previously been registered
- to handle a the given INotification
, then it is executed.If an ICommand
has previously been registered
+ to handle a the given INotification
, then it is executed.
executeCommand
in interface IController
public static IController getInstance(java.util.function.Supplier<IController> controllerSupplier)-
Controller
Singleton Factory method.Controller
Singleton Factory method.
controllerSupplier
- controller supplier functionpublic boolean hasCommand(java.lang.String notificationName)-
Check if a Command is registered for a given Notification
hasCommand
in interface IController
public void initializeController()-
Controller
instance.
+Initialize the Singleton Controller
instance.
Called automatically by the constructor.
@@ -473,13 +472,14 @@initializeController
method in the
following way:
-
- // ensure that the Controller is talking to my IView implementation
- override public function initializeController( ) : void
- {
- view = MyView.getInstance(() -> new MyView());
- }
-
+ // ensure that the Controller is talking to my IView implementation
+ override public function initializeController( ) : void
+ {
+ view = MyView.getInstance(() -> new MyView());
+ }
+
+
public void registerCommand(java.lang.String notificationName, java.util.function.Supplier<ICommand> commandSupplier)-
ICommand
class as the handler
- for a particular INotification
.
+Register a particular ICommand
class as the handler
+ for a particular INotification
.
- If an ICommand
has already been registered to
+
If an ICommand
has already been registered to
handle INotification
s 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.
registerCommand
in interface IController
public void removeCommand(java.lang.String notificationName)-
ICommand
to INotification
mapping.Remove a previously registered ICommand
to INotification
mapping.
removeCommand
in interface IController
public class Model extends java.lang.Object implements IModel-
IModel
implementation.
+A Singleton IModel
implementation.
- In PureMVC, the Model
class provides
- access to model objects (Proxies) by named lookup.
+
In PureMVC, the Model
class provides
+ access to model objects (Proxies) by named lookup.
- The Model
assumes these responsibilities:
The Model
assumes these responsibilities:
IProxy
instances.IProxy
instances.
- Your application must register 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.
Proxy
,
@@ -359,13 +356,12 @@ public Model()-
Constructor.
-
- This IModel
implementation is a Singleton,
+
This IModel
implementation is a Singleton,
so you should not call the constructor
directly, but instead call the static Singleton
- Factory method Model.getInstance()
Model.getInstance()
java.lang.Error
- Error if Singleton instance has already been constructedpublic static IModel getInstance(java.util.function.Supplier<IModel> modelSupplier)-
Model
Singleton Factory method.Model
Singleton Factory method.
modelSupplier
- model supplier functionpublic boolean hasProxy(java.lang.String proxyName)-
Check if a Proxy is registered
protected void initializeModel()-
Model
instance.
+Initialize the Singleton Model
instance.
- Called automatically by the constructor, this +
Called automatically by the constructor, this is your opportunity to initialize the Singleton instance in your subclass without overriding the constructor.
public void registerProxy(IProxy proxy)-
IProxy
with the Model
.Register an IProxy
with the Model
.
registerProxy
in interface IModel
public IProxy removeProxy(java.lang.String proxyName)-
IProxy
from the Model
.Remove an IProxy
from the Model
.
removeProxy
in interface IModel
public IProxy retrieveProxy(java.lang.String proxyName)-
IProxy
from the Model
.Retrieve an IProxy
from the Model
.
retrieveProxy
in interface IModel
public class View extends java.lang.Object implements IView-
IView
implementation.
+A Singleton IView
implementation.
In PureMVC, the View
class assumes these responsibilities:
- In PureMVC, the View
class assumes these responsibilities:
IMediator
instances.IMediators
.public View()-
Constructor.
-
- This IView
implementation is a Singleton,
+
This IView
implementation is a Singleton,
so you should not call the constructor
directly, but instead call the static Singleton
- Factory method View.getInstance()
View.getInstance()
java.lang.Error
- Error if Singleton instance has already been constructedpublic static IView getInstance(java.util.function.Supplier<IView> viewSupplier)-
View Singleton Factory method.
viewSupplier
- view supplier functionpublic boolean hasMediator(java.lang.String mediatorName)-
Check if a Mediator is registered or not
hasMediator
in interface IView
protected void initializeView()-
Initialize the Singleton View instance.
-- Called automatically by the constructor, this +
Called automatically by the constructor, this is your opportunity to initialize the Singleton instance in your subclass without overriding the constructor.
public void notifyObservers(INotification notification)-
IObservers
for a particular INotification
.
+Notify the IObservers
for a particular INotification
.
- All previously attached IObservers
for this INotification
's
+
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.
public void registerMediator(IMediator mediator)-
IMediator
instance with the View
.
+Register an IMediator
instance with the View
.
- Registers the IMediator
so that it can be retrieved by name,
+
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
+
+
If the IMediator
returns any INotification
names to be notified about, an Observer
is created encapsulating
the IMediator
instance's handleNotification
method
and registering it as an Observer
for all INotifications
the
- IMediator
is interested in.
IMediator
is interested in.registerMediator
in interface IView
public void registerObserver(java.lang.String notificationName, IObserver observer)-
IObserver
to be notified
- of INotifications
with a given name.Register an IObserver
to be notified
+ of INotifications
with a given name.
registerObserver
in interface IView
public IMediator removeMediator(java.lang.String mediatorName)-
IMediator
from the View
.Remove an IMediator
from the View
.
removeMediator
in interface IView
public void removeObserver(java.lang.String notificationName, java.lang.Object notifyContext)-
Remove the observer for a given notifyContext from an observer list for a given Notification name.
removeObserver
in interface IView
public IMediator retrieveMediator(java.lang.String mediatorName)-
IMediator
from the View
.Retrieve an IMediator
from the View
.
retrieveMediator
in interface IView
void execute(INotification notification)-
ICommand
's logic to handle a given INotification
.Execute the ICommand
's logic to handle a given INotification
.
notification
- an INotification
to handle.public interface IController
-The interface definition for a PureMVC Controller.
-
- In PureMVC, an IController
implementor
+
In PureMVC, an IController
implementor
follows the 'Command and Controller' strategy, and
- assumes these responsibilities:
+ assumes these responsibilities:
ICommand
s
are intended to handle which INotifications
.void executeCommand(INotification notification)-
ICommand
previously registered as the
- handler for INotification
s with the given notification name.Execute the ICommand
previously registered as the
+ handler for INotification
s with the given notification name.
notification
- the INotification
to execute the associated ICommand
forboolean hasCommand(java.lang.String notificationName)-
Check if a Command is registered for a given Notification
notificationName
- notification namevoid registerCommand(java.lang.String notificationName, java.util.function.Supplier<ICommand> commandSupplier)-
ICommand
class as the handler
- for a particular INotification
.Register a particular ICommand
class as the handler
+ for a particular INotification
.
notificationName
- the name of the INotification
void removeCommand(java.lang.String notificationName)-
ICommand
to INotification
mapping.Remove a previously registered ICommand
to INotification
mapping.
notificationName
- the name of the INotification
to remove the ICommand
mapping forpublic interface IFacade extends INotifier-
The interface definition for a PureMVC Facade.
-- The Facade Pattern suggests providing a single +
The Facade Pattern suggests providing a single class to act as a central point of communication - for a subsystem.
+ for a subsystem. -- In PureMVC, the Facade acts as an interface between +
In PureMVC, the Facade acts as an interface between the core MVC actors (Model, View, Controller) and the rest of your application.
boolean hasCommand(java.lang.String notificationName)-
Check if a Command is registered for a given Notification
notificationName
- notification nameboolean hasMediator(java.lang.String mediatorName)-
Check if a Mediator is registered or not
mediatorName
- mediator nameboolean hasProxy(java.lang.String proxyName)-
Check if a Proxy is registered
proxyName
- proxy namevoid notifyObservers(INotification notification)-
IObservers
for a particular INotification
.
+Notify the IObservers
for a particular INotification
.
- All previously attached IObservers
for this INotification
's
+
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 + +
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.
void registerCommand(java.lang.String notificationName, java.util.function.Supplier<ICommand> commandSupplier)-
ICommand
with the Controller
.Register an ICommand
with the Controller
.
notificationName
- the name of the INotification
to associate the ICommand
with.void registerMediator(IMediator mediator)-
IMediator
instance with the View
.Register an IMediator
instance with the View
.
mediator
- a reference to the IMediator
instancevoid registerProxy(IProxy proxy)-
IProxy
with the Model
by name.Register an IProxy
with the Model
by name.
proxy
- the IProxy
to be registered with the Model
.void removeCommand(java.lang.String notificationName)-
ICommand
to INotification
mapping from the Controller.Remove a previously registered ICommand
to INotification
mapping from the Controller.
notificationName
- the name of the INotification
to remove the ICommand
mapping forIMediator removeMediator(java.lang.String mediatorName)-
IMediator
instance from the View
.Remove a IMediator
instance from the View
.
mediatorName
- name of the IMediator
instance to be removed.IProxy removeProxy(java.lang.String proxyName)-
IProxy
instance from the Model
by name.Remove an IProxy
instance from the Model
by name.
proxyName
- the IProxy
to remove from the Model
.IMediator retrieveMediator(java.lang.String mediatorName)-
IMediator
instance from the View
.Retrieve an IMediator
instance from the View
.
mediatorName
- the name of the IMediator
instance to retrievveIProxy retrieveProxy(java.lang.String proxyName)-
IProxy
from the Model
by name.Retrieve a IProxy
from the Model
by name.
proxyName
- the name of the IProxy
instance to be retrieved.public interface IMediator extends INotifier-
The interface definition for a PureMVC Mediator.
+ +In PureMVC, IMediator
implementors assume these responsibilities:
- In PureMVC, IMediator
implementors assume these responsibilities:
INotification
s
the IMediator
has interest in.
- Additionally, IMediator
s typically:
-
Additionally, IMediator
s typically:
INotifications
, interacting with of
- the rest of the PureMVC app.
+ the rest of the PureMVC app.
- When an IMediator
is registered with the IView
,
+
+
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
+
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:
+A concrete IMediator implementor usually looks something like this:
-
- import org.puremvc.as3.multicore.patterns.mediator.*;
- import org.puremvc.as3.multicore.patterns.observer.*;
- import org.puremvc.as3.multicore.core.view.*;
+ 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 com.me.myapp.model.*;
+ import com.me.myapp.view.*;
+ import com.me.myapp.controller.*;
- import javax.swing.JComboBox;
- import java.awt.event.ActionListener;
+ import javax.swing.JComboBox;
+ import java.awt.event.ActionListener;
- public class MyMediator extends Mediator implements IMediator, ActionListener {
+ public class MyMediator extends Mediator implements IMediator, ActionListener {
- public MyMediator( Object viewComponent ) {
- super( viewComponent );
- combo.addActionListener( this );
- }
+ public MyMediator( Object viewComponent ) {
+ super( viewComponent );
+ combo.addActionListener( this );
+ }
- public String[] listNotificationInterests() {
- return [ MyFacade.SET_SELECTION,
- MyFacade.SET_DATAPROVIDER ];
- }
+ 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;
- }
- }
+ 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<String>(notification.getBody()));
- }
+ // Set the data provider of the combo box
+ protected void setDataProvider( INotification notification ) {
+ combo.setModel(ComboBoxModel<String>(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 );
- }
+ // 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;
- }
+ // A private getter for accessing the view object by class
+ protected JComboBox getViewComponent() {
+ return viewComponent;
+ }
- }
+ }
java.lang.String getMediatorName()-
IMediator
instance nameGet the IMediator
instance name
IMediator
instance namejava.lang.Object getViewComponent()-
IMediator
's view component.Get the IMediator
's view component.
void handleNotification(INotification notification)-
INotification
.Handle an INotification
.
notification
- the INotification
to be handledjava.lang.String[] listNotificationInterests()-
INotification
interests.List INotification
interests.
Array
of the INotification
names this IMediator
has an interest in.void onRegister()-
Called by the View when the Mediator is registered
void onRemove()-
Called by the View when the Mediator is removed
void setViewComponent(java.lang.Object viewComponent)-
IMediator
's view component.Set the IMediator
's view component.
viewComponent
- the view componentpublic interface IModel
-The interface definition for a PureMVC Model.
-
- In PureMVC, IModel
implementors provide
+
In PureMVC, IModel
implementors provide
access to IProxy
objects by named lookup.
- An IModel
assumes these responsibilities:
An IModel
assumes these responsibilities:
IProxy
instancesboolean hasProxy(java.lang.String proxyName)-
Check if a Proxy is registered
proxyName
- proxy namevoid registerProxy(IProxy proxy)-
IProxy
instance with the Model
.Register an IProxy
instance with the Model
.
proxy
- an object reference to be held by the Model
.IProxy removeProxy(java.lang.String proxyName)-
IProxy
instance from the Model.Remove an IProxy
instance from the Model.
proxyName
- name of the IProxy
instance to be removed.IProxy retrieveProxy(java.lang.String proxyName)-
IProxy
instance from the Model.Retrieve an IProxy
instance from the Model.
proxyName
- proxy namepublic interface INotification
-The interface definition for a PureMVC Notification.
-- PureMVC does not rely upon underlying event models such +
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 +
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 +
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 Notification
s to
@@ -154,15 +151,14 @@
IMediator
s
by broadcasting INotification
s.
-
- A key difference between Flash Event
s and PureMVC
+
A key difference between Flash Event
s and PureMVC
Notification
s is that Event
s follow the
'Chain of Responsibility' pattern, 'bubbling' up the display hierarchy
until some parent component handles the Event
, while
PureMVC Notification
s 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 Notification
s.
Notification
s.IView
,
@@ -254,7 +250,7 @@ java.lang.Object getBody()-
INotification
instanceGet the body of the INotification
instance
java.lang.String getName()-
INotification
instance.
- No setter, should be set by constructor onlyGet the name of the INotification
instance.
+ No setter, should be set by constructor only
java.lang.String getType()-
INotification
instanceGet the type of the INotification
instance
void setBody(java.lang.Object body)-
INotification
instanceSet the body of the INotification
instance
body
- notification bodyvoid setType(java.lang.String type)-
INotification
instanceSet the type of the INotification
instance
type
- notification typejava.lang.String toString()-
INotification
instanceGet the string representation of the INotification
instance
toString
in class java.lang.Object
public interface INotifier
-The interface definition for a PureMVC Notifier.
-
- MacroCommand, Command, Mediator
and Proxy
- all have a need to send Notifications
.
MacroCommand, Command, Mediator
and Proxy
+ all have a need to send Notifications
.
- The INotifier
interface provides a common method called
+
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
+
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
@@ -228,10 +225,9 @@
void sendNotification(java.lang.String notificationName)-
INotification
.
+Send a INotification
.
- Convenience method to prevent having to construct new +
Convenience method to prevent having to construct new notification instances in our implementation code.
void sendNotification(java.lang.String notificationName, java.lang.Object body)-
INotification
.
+Send a INotification
.
- Convenience method to prevent having to construct new +
Convenience method to prevent having to construct new notification instances in our implementation code.
void sendNotification(java.lang.String notificationName, java.lang.Object body, java.lang.String type)-
INotification
.
+Send a INotification
.
- Convenience method to prevent having to construct new +
Convenience method to prevent having to construct new notification instances in our implementation code.
public interface IObserver
-The interface definition for a PureMVC Observer.
+ +In PureMVC, IObserver
implementors assume these responsibilities:
- In PureMVC, IObserver
implementors assume these responsibilities:
- PureMVC does not rely upon underlying event +
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 +
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 +
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.
+ acts as a proxy for notifying the interested object.
- Observers can receive Notification
s by having their
+
Observers can receive Notification
s by having their
notifyObserver
method invoked, passing
in an object implementing the INotification
interface, such
as a subclass of Notification
.
boolean
compareNotifyContext(java.lang.Object object)
boolean compareNotifyContext(java.lang.Object object)-
Compare the given object to the notification context object.
object
- the object to compare.void notifyObserver(INotification notification)-
Notify the interested object.
notification
- the INotification
to pass to the interested object's notification methodvoid setNotifyContext(java.lang.Object notifyContext)-
Set the notification context.
notifyContext
- the notification context (this) of the interested objectvoid setNotifyMethod(java.util.function.Consumer<INotification> notifyMethod)-
Set the notification method.
-
- The notification method should take one parameter of type INotification
The notification method should take one parameter of type INotification
notifyMethod
- the notification (callback) method of the interested objectpublic interface IProxy extends INotifier-
The interface definition for a PureMVC Proxy.
+ +In PureMVC, IProxy
implementors assume these responsibilities:
- In PureMVC, IProxy
implementors assume these responsibilities:
- Additionally, IProxy
s typically:
Additionally, IProxy
s typically:
java.lang.Object getData()-
Get the data object
java.lang.String getProxyName()-
Get the Proxy name
void onRegister()-
Called by the Model when the Proxy is registered
void onRemove()-
Called by the Model when the Proxy is removed
void setData(java.lang.Object data)-
Set the data object
data
- the data objectpublic interface IView
-The interface definition for a PureMVC View.
-
- In PureMVC, IView
implementors assume these responsibilities:
In PureMVC, IView
implementors assume these responsibilities:
In PureMVC, the View
class assumes these responsibilities:
- In PureMVC, the View
class assumes these responsibilities:
IMediator
instances.IMediators
.boolean hasMediator(java.lang.String mediatorName)-
Check if a Mediator is registered or not
mediatorName
- mediator namevoid notifyObservers(INotification notification)-
IObservers
for a particular INotification
.
+Notify the IObservers
for a particular INotification
.
- All previously attached IObservers
for this INotification
's
+
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.
void registerMediator(IMediator mediator)-
IMediator
instance with the View
.
+Register an IMediator
instance with the View
.
- Registers the IMediator
so that it can be retrieved by name,
+
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
+
+
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
@@ -311,8 +308,8 @@
void registerObserver(java.lang.String notificationName, IObserver observer)-
IObserver
to be notified
- of INotifications
with a given name.Register an IObserver
to be notified
+ of INotifications
with a given name.
notificationName
- the name of the INotifications
to notify this IObserver
ofIMediator removeMediator(java.lang.String mediatorName)-
IMediator
from the View
.Remove an IMediator
from the View
.
mediatorName
- name of the IMediator
instance to be removed.void removeObserver(java.lang.String notificationName, java.lang.Object notifyContext)-
Remove a group of observers from the observer list for a given Notification name.
notificationName
- which observer list to remove fromIMediator retrieveMediator(java.lang.String mediatorName)-
IMediator
from the View
.Retrieve an IMediator
from the View
.
mediatorName
- the name of the IMediator
instance to retrieve.public class MacroCommand extends Notifier implements ICommand-
ICommand
implementation that executes other ICommand
s.
+A base ICommand
implementation that executes other ICommand
s.
- A MacroCommand
maintains an list of
+
A MacroCommand
maintains an list of
ICommand
Class references called SubCommands.
- When execute
is called, the MacroCommand
+
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
+
Unlike SimpleCommand
, your subclass
should not override execute
, but instead, should
override the initializeMacroCommand
method,
calling addSubCommand
once for each SubCommand
- to be executed.
Controller
,
@@ -301,15 +296,13 @@ public MacroCommand()-
Constructor.
-- You should not need to define a constructor, +
You should not need to define a constructor,
instead, override the initializeMacroCommand
method.
- If your subclass does define a constructor, be +
If your subclass does define a constructor, be
sure to call super()
.
protected void addSubCommand(java.util.function.Supplier<ICommand> commandSupplier)-
Add a SubCommand.
-- The SubCommands will be called in First In/First Out (FIFO) +
The SubCommands will be called in First In/First Out (FIFO) order.
public void execute(INotification notification)-
MacroCommand
's SubCommands.
+Execute this MacroCommand
's SubCommands.
- The SubCommands will be called in First In/First Out (FIFO) - order.
The SubCommands will be called in First In/First Out (FIFO) + order.
protected void initializeMacroCommand()-
MacroCommand
.
+Initialize the MacroCommand
.
- In your subclass, override this method to +
In your subclass, override this method to
initialize the MacroCommand
's SubCommand
list with ICommand
class references like
this:
- Note that SubCommands may be any ICommand
implementor,
+
+
Note that SubCommands may be any ICommand
implementor,
MacroCommand
s or SimpleCommands
are both acceptable.
public class SimpleCommand extends Notifier implements ICommand-
ICommand
implementation.
+A base ICommand
implementation.
- Your subclass should override the execute
- method where your business logic will handle the INotification
.
Your subclass should override the execute
+ method where your business logic will handle the INotification
.
Controller
,
@@ -288,10 +287,9 @@ public void execute(INotification notification)-
INotification
.
+Fulfill the use-case initiated by the given INotification
.
- In the Command Pattern, an application use-case typically +
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
.
public class Facade extends java.lang.Object implements IFacade-
IFacade
implementation.
+A base Singleton IFacade
implementation.
In PureMVC, the Facade
class assumes these
+ responsibilities:
- In PureMVC, the Facade
class assumes these
- responsibilities:
Model
, View
and Controller
Singletons.Commands
and notifying Observers
- Example usage: + +
Example usage:
import org.puremvc.as3.patterns.facade.Facade;
@@ -583,13 +583,12 @@ Constructor Detail
-
Facade
public Facade()
-Constructor.
+Constructor.
-
- This IFacade
implementation is a Singleton,
+
This IFacade
implementation is a Singleton,
so you should not call the constructor
directly, but instead call the static Singleton
- Factory method Facade.getInstance()
+ Factory method Facade.getInstance()
- Throws:
java.lang.Error
- Error if Singleton instance has already been constructed
@@ -613,7 +612,7 @@ Method Detail
-
getInstance
public static IFacade getInstance(java.util.function.Supplier<IFacade> facadeSupplier)
-Facade Singleton Factory method
+Facade Singleton Factory method
- Parameters:
facadeSupplier
- facade Supplier Function
@@ -629,7 +628,7 @@ getInstance
-
hasCommand
public boolean hasCommand(java.lang.String notificationName)
-Check if a Command is registered for a given Notification
+Check if a Command is registered for a given Notification
- Specified by:
hasCommand
in interface IFacade
@@ -647,7 +646,7 @@ hasCommand
-
hasMediator
public boolean hasMediator(java.lang.String mediatorName)
-Check if a Mediator is registered or not
+Check if a Mediator is registered or not
- Specified by:
hasMediator
in interface IFacade
@@ -665,7 +664,7 @@ hasMediator
-
hasProxy
public boolean hasProxy(java.lang.String proxyName)
-Check if a Proxy is registered
+Check if a Proxy is registered
-
initializeController
protected void initializeController()
-Initialize the Controller
.
+Initialize the Controller
.
-
- Called by the initializeFacade
method.
+
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 Command
s.
-
+ method, then register Command
s.
@@ -706,10 +705,9 @@ initializeController
-
initializeFacade
protected void initializeFacade()
-Initialize the Singleton Facade
instance.
+Initialize the Singleton Facade
instance.
-
- Called automatically by the constructor. Override in your
+
Called automatically by the constructor. Override in your
subclass to do any subclass specific initializations. Be
sure to call super.initializeFacade()
, though.
@@ -721,27 +719,27 @@ initializeFacade
-
initializeModel
protected void initializeModel()
-Initialize the Model
.
+Initialize the Model
.
-
- Called by the initializeFacade
method.
+
Called by the initializeFacade
method.
Override this method in your subclass of Facade
- if one or both of the following are true:
+ if one or both of the following are true:
+
- You wish to initialize a different
IModel
.
- You have
Proxy
s 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
,
+
+ If you don't want to initialize a different IModel
,
call super.initializeModel()
at the beginning of your
- method, then register Proxy
s.
-
- Note: This method is rarely overridden; in practice you are more
+ method, then register Proxy
s.
+
+ Note: This method is rarely overridden; in practice you are more
likely to use a Command
to create and register Proxy
s
with the Model
, since Proxy
s with mutable data will likely
need to send INotification
s and thus will likely want to fetch a reference to
- the Facade
during their construction.
-
+ the Facade
during their construction.
@@ -751,26 +749,26 @@ initializeModel
-
initializeView
protected void initializeView()
-Initialize the View
.
+Initialize the View
.
-
- Called by the initializeFacade
method.
+
Called by the initializeFacade
method.
Override this method in your subclass of Facade
- if one or both of the following are true:
+ 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
,
+
+
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
+ 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 Mediator
s
with the View
, since IMediator
instances will need to send
INotification
s and thus will likely want to fetch a reference
- to the Facade
during their construction.
-
+ to the Facade
during their construction.
@@ -780,13 +778,13 @@ initializeView
-
notifyObservers
public void notifyObservers(INotification notification)
-Notify Observer
s.
-
- This method is left public mostly for backward
+
Notify Observer
s.
+
+ 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
+
+
Usually you should just call sendNotification
and pass the parameters, never having to
construct the notification yourself.
@@ -805,7 +803,7 @@ notifyObservers
registerCommand
public void registerCommand(java.lang.String notificationName,
java.util.function.Supplier<ICommand> commandSupplier)
-Register an ICommand
with the Controller
by Notification name.
+Register an ICommand
with the Controller
by Notification name.
- Specified by:
registerCommand
in interface IFacade
@@ -822,7 +820,7 @@ registerCommand
-
registerMediator
public void registerMediator(IMediator mediator)
-Register a IMediator
with the View
.
+Register a IMediator
with the View
.
- Specified by:
registerMediator
in interface IFacade
@@ -838,7 +836,7 @@ registerMediator
-
registerProxy
public void registerProxy(IProxy proxy)
-Register an IProxy
with the Model
by name.
+Register an IProxy
with the Model
by name.
- Specified by:
registerProxy
in interface IFacade
@@ -854,7 +852,7 @@ registerProxy
-
removeCommand
public void removeCommand(java.lang.String notificationName)
-Remove a previously registered ICommand
to INotification
mapping from the Controller.
+Remove a previously registered ICommand
to INotification
mapping from the Controller.
- Specified by:
removeCommand
in interface IFacade
@@ -870,7 +868,7 @@ removeCommand
-
removeMediator
public IMediator removeMediator(java.lang.String mediatorName)
-Remove an IMediator
from the View
.
+Remove an IMediator
from the View
.
- Specified by:
removeMediator
in interface IFacade
@@ -888,7 +886,7 @@ removeMediator
-
removeProxy
public IProxy removeProxy(java.lang.String proxyName)
-Remove an IProxy
from the Model
by name.
+Remove an IProxy
from the Model
by name.
- Specified by:
removeProxy
in interface IFacade
@@ -906,7 +904,7 @@ removeProxy
-
retrieveMediator
public IMediator retrieveMediator(java.lang.String mediatorName)
-Retrieve an IMediator
from the View
.
+Retrieve an IMediator
from the View
.
- Specified by:
retrieveMediator
in interface IFacade
@@ -924,7 +922,7 @@ retrieveMediator
-
retrieveProxy
public IProxy retrieveProxy(java.lang.String proxyName)
-Retrieve an IProxy
from the Model
by name.
+Retrieve an IProxy
from the Model
by name.
- Specified by:
retrieveProxy
in interface IFacade
@@ -942,11 +940,10 @@ retrieveProxy
-
sendNotification
public void sendNotification(java.lang.String notificationName)
-Create and send an INotification
.
+Create and send an INotification
.
-
- Keeps us from having to construct new notification
- instances in our implementation code.
+ Keeps us from having to construct new notification
+ instances in our implementation code.
- Specified by:
sendNotification
in interface INotifier
@@ -963,11 +960,10 @@ sendNotification
sendNotification
public void sendNotification(java.lang.String notificationName,
java.lang.Object body)
-Create and send an INotification
.
+Create and send an INotification
.
-
- Keeps us from having to construct new notification
- instances in our implementation code.
+ Keeps us from having to construct new notification
+ instances in our implementation code.
- Specified by:
sendNotification
in interface INotifier
@@ -986,11 +982,10 @@ sendNotification
public void sendNotification(java.lang.String notificationName,
java.lang.Object body,
java.lang.String type)
-Create and send an INotification
.
+Create and send an INotification
.
-
- Keeps us from having to construct new notification
- instances in our implementation code.
+ Keeps us from having to construct new notification
+ instances in our implementation code.
- Specified by:
sendNotification
in interface INotifier
diff --git a/docs/org/puremvc/java/patterns/facade/package-frame.html b/docs/org/puremvc/java/patterns/facade/package-frame.html
index a55f724..4eca579 100644
--- a/docs/org/puremvc/java/patterns/facade/package-frame.html
+++ b/docs/org/puremvc/java/patterns/facade/package-frame.html
@@ -2,10 +2,10 @@
-
+
org.puremvc.java.patterns.facade
-
+
diff --git a/docs/org/puremvc/java/patterns/facade/package-summary.html b/docs/org/puremvc/java/patterns/facade/package-summary.html
index c014690..c2839e0 100644
--- a/docs/org/puremvc/java/patterns/facade/package-summary.html
+++ b/docs/org/puremvc/java/patterns/facade/package-summary.html
@@ -2,10 +2,10 @@
-
+
org.puremvc.java.patterns.facade
-
+
diff --git a/docs/org/puremvc/java/patterns/facade/package-tree.html b/docs/org/puremvc/java/patterns/facade/package-tree.html
index a3ae8df..5723351 100644
--- a/docs/org/puremvc/java/patterns/facade/package-tree.html
+++ b/docs/org/puremvc/java/patterns/facade/package-tree.html
@@ -2,10 +2,10 @@
-
+
org.puremvc.java.patterns.facade Class Hierarchy
-
+
diff --git a/docs/org/puremvc/java/patterns/mediator/Mediator.html b/docs/org/puremvc/java/patterns/mediator/Mediator.html
index d64048c..6540a6f 100644
--- a/docs/org/puremvc/java/patterns/mediator/Mediator.html
+++ b/docs/org/puremvc/java/patterns/mediator/Mediator.html
@@ -2,10 +2,10 @@
-
+
Mediator
-
+
@@ -148,7 +148,7 @@ Class Mediator
public class Mediator
extends Notifier
implements IMediator
-A base IMediator
implementation.
+A base IMediator
implementation.
- See Also:
View
@@ -355,10 +355,9 @@ mediatorName
-
NAME
public static final java.lang.String NAME
-The name of the Mediator
.
+The name of the Mediator
.
-
- Typically, a Mediator
will be written to serve
+
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.
@@ -393,7 +392,7 @@ Constructor Detail
-
Mediator
public Mediator()
-Constructor.
+Constructor.
@@ -403,7 +402,7 @@ Mediator
-
Mediator
public Mediator(java.lang.String mediatorName)
-Constructor.
+Constructor.
- Parameters:
mediatorName
- mediator name
@@ -418,7 +417,7 @@ Mediator
Mediator
public Mediator(java.lang.String mediatorName,
java.lang.Object viewComponent)
-Constructor.
+Constructor.
- Parameters:
mediatorName
- mediator name
@@ -443,7 +442,7 @@ Method Detail
-
getMediatorName
public java.lang.String getMediatorName()
-Get the name of the Mediator
.
+Get the name of the Mediator
.
- Specified by:
getMediatorName
in interface IMediator
@@ -459,10 +458,9 @@ getMediatorName
-
getViewComponent
public java.lang.Object getViewComponent()
-Get the Mediator
's view component.
+Get the Mediator
's view component.
-
- Additionally, an implicit getter will usually
+
Additionally, an implicit getter will usually
be defined in the subclass that casts the view
object to a type, like this:
@@ -487,12 +485,11 @@ getViewComponent
-
handleNotification
public void handleNotification(INotification notification)
-Handle INotification
s.
+Handle INotification
s.
-
- Typically this will be handled in a switch statement,
+
Typically this will be handled in a switch statement,
with one 'case' entry per INotification
- the Mediator
is interested in.
+ the Mediator
is interested in.
- Specified by:
handleNotification
in interface IMediator
@@ -508,8 +505,8 @@ handleNotification
-
listNotificationInterests
public java.lang.String[] listNotificationInterests()
-List the INotification
names this
- Mediator
is interested in being notified of.
+List the INotification
names this
+ Mediator
is interested in being notified of.
- Specified by:
listNotificationInterests
in interface IMediator
@@ -525,7 +522,7 @@ listNotificationInterests
-
onRegister
public void onRegister()
-Called by the View when the Mediator is registered
+Called by the View when the Mediator is registered
- Specified by:
onRegister
in interface IMediator
@@ -539,7 +536,7 @@ onRegister
-
onRemove
public void onRemove()
-Called by the View when the Mediator is removed
+Called by the View when the Mediator is removed
-
setViewComponent
public void setViewComponent(java.lang.Object viewComponent)
-Set the IMediator
's view component.
+Set the IMediator
's view component.
- Specified by:
setViewComponent
in interface IMediator
diff --git a/docs/org/puremvc/java/patterns/mediator/package-frame.html b/docs/org/puremvc/java/patterns/mediator/package-frame.html
index d08e69b..a88935f 100644
--- a/docs/org/puremvc/java/patterns/mediator/package-frame.html
+++ b/docs/org/puremvc/java/patterns/mediator/package-frame.html
@@ -2,10 +2,10 @@
-
+
org.puremvc.java.patterns.mediator
-
+
diff --git a/docs/org/puremvc/java/patterns/mediator/package-summary.html b/docs/org/puremvc/java/patterns/mediator/package-summary.html
index 512f986..1dacaa9 100644
--- a/docs/org/puremvc/java/patterns/mediator/package-summary.html
+++ b/docs/org/puremvc/java/patterns/mediator/package-summary.html
@@ -2,10 +2,10 @@
-
+
org.puremvc.java.patterns.mediator
-
+
diff --git a/docs/org/puremvc/java/patterns/mediator/package-tree.html b/docs/org/puremvc/java/patterns/mediator/package-tree.html
index eef4bda..6f2e8bc 100644
--- a/docs/org/puremvc/java/patterns/mediator/package-tree.html
+++ b/docs/org/puremvc/java/patterns/mediator/package-tree.html
@@ -2,10 +2,10 @@
-
+
org.puremvc.java.patterns.mediator Class Hierarchy
-
+
diff --git a/docs/org/puremvc/java/patterns/observer/Notification.html b/docs/org/puremvc/java/patterns/observer/Notification.html
index 5cd2160..ef76bb5 100644
--- a/docs/org/puremvc/java/patterns/observer/Notification.html
+++ b/docs/org/puremvc/java/patterns/observer/Notification.html
@@ -2,10 +2,10 @@
-
+
Notification
-
+
@@ -143,20 +143,17 @@ Class Notification
public class Notification
extends java.lang.Object
implements INotification
-A base INotification
implementation.
+A base INotification
implementation.
-
- PureMVC does not rely upon underlying event models such
+
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
+
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
+
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 Notification
s to
@@ -164,15 +161,14 @@
Class Notification
instances communicate with each other and IMediator
s
by broadcasting INotification
s.
-
- A key difference between Flash Event
s and PureMVC
+
A key difference between Flash Event
s and PureMVC
Notification
s is that Event
s follow the
'Chain of Responsibility' pattern, 'bubbling' up the display hierarchy
until some parent component handles the Event
, while
PureMVC Notification
s 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 Notification
s.
+ using Notification
s.
- See Also:
Observer
@@ -308,7 +304,7 @@ Constructor Detail
-
Notification
public Notification(java.lang.String name)
-Constructor.
+Constructor.
- Parameters:
name
- name of the Notification
instance.
@@ -323,7 +319,7 @@ Notification
Notification
public Notification(java.lang.String name,
java.lang.Object body)
-Constructor.
+Constructor.
- Parameters:
name
- name of the Notification
instance.
@@ -340,7 +336,7 @@ Notification
public Notification(java.lang.String name,
java.lang.Object body,
java.lang.String type)
-Constructor.
+Constructor.
- Parameters:
name
- name of the Notification
instance. (required)
@@ -366,7 +362,7 @@ Method Detail
-
getBody
public java.lang.Object getBody()
-Get the body of the Notification
instance.
+Get the body of the Notification
instance.
- Specified by:
getBody
in interface INotification
@@ -382,7 +378,7 @@ getBody
-
getName
public java.lang.String getName()
-Get the name of the Notification
instance.
+Get the name of the Notification
instance.
- Specified by:
getName
in interface INotification
@@ -398,7 +394,7 @@ getName
-
getType
public java.lang.String getType()
-Get the type of the Notification
instance.
+Get the type of the Notification
instance.
- Specified by:
getType
in interface INotification
@@ -414,7 +410,7 @@ getType
-
setBody
public void setBody(java.lang.Object body)
-Set the body of the Notification
instance.
+Set the body of the Notification
instance.
- Specified by:
setBody
in interface INotification
@@ -430,7 +426,7 @@ setBody
-
setType
public void setType(java.lang.String type)
-Set the type of the Notification
instance.
+Set the type of the Notification
instance.
- Specified by:
setType
in interface INotification
@@ -446,7 +442,7 @@ setType
-
toString
public java.lang.String toString()
-Get the string representation of the Notification
instance.
+Get the string representation of the Notification
instance.
- Specified by:
toString
in interface INotification
diff --git a/docs/org/puremvc/java/patterns/observer/Notifier.html b/docs/org/puremvc/java/patterns/observer/Notifier.html
index 270e6f3..a899ac8 100644
--- a/docs/org/puremvc/java/patterns/observer/Notifier.html
+++ b/docs/org/puremvc/java/patterns/observer/Notifier.html
@@ -2,10 +2,10 @@
-
+
Notifier
-
+
@@ -147,26 +147,21 @@ Class Notifier
public class Notifier
extends java.lang.Object
implements INotifier
-A Base INotifier
implementation.
+A Base INotifier
implementation.
-
- MacroCommand, Command, Mediator
and Proxy
all
- have a need to send Notifications
.
-
-
- The INotifier
interface provides a common method called
+
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
.
-
+ necessity to actually construct Notifications
.
-
- The Notifier
class, which all of the above mentioned classes
+
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.
-
+ to the facade anyway.
@@ -335,11 +330,10 @@ Method Detail
-
sendNotification
public void sendNotification(java.lang.String notificationName)
-Send an INotification
s.
+Send an INotification
s.
-
- Keeps us from having to construct new notification instances in our
- implementation code.
+ Keeps us from having to construct new notification instances in our
+ implementation code.
- Specified by:
sendNotification
in interface INotifier
@@ -356,11 +350,10 @@ sendNotification
sendNotification
public void sendNotification(java.lang.String notificationName,
java.lang.Object body)
-Send an INotification
s.
+Send an INotification
s.
-
- Keeps us from having to construct new notification instances in our
- implementation code.
+ Keeps us from having to construct new notification instances in our
+ implementation code.
- Specified by:
sendNotification
in interface INotifier
@@ -379,11 +372,10 @@ sendNotification
public void sendNotification(java.lang.String notificationName,
java.lang.Object body,
java.lang.String type)
-Send an INotification
s.
+Send an INotification
s.
-
- Keeps us from having to construct new notification instances in our
- implementation code.
+ Keeps us from having to construct new notification instances in our
+ implementation code.
- Specified by:
sendNotification
in interface INotifier
diff --git a/docs/org/puremvc/java/patterns/observer/Observer.html b/docs/org/puremvc/java/patterns/observer/Observer.html
index d463f27..303995d 100644
--- a/docs/org/puremvc/java/patterns/observer/Observer.html
+++ b/docs/org/puremvc/java/patterns/observer/Observer.html
@@ -2,10 +2,10 @@
-
+
Observer
-
+
@@ -143,15 +143,14 @@ Class Observer
public class Observer
extends java.lang.Object
implements IObserver
-A base IObserver
implementation.
+A base IObserver
implementation.
-
- An Observer
is an object that encapsulates information
+
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.
+ be called when a particular INotification
is broadcast.
+
+ In PureMVC, the Observer
class assumes these responsibilities:
-
- 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.
@@ -281,12 +280,10 @@ Constructor Detail
Observer
public Observer(java.util.function.Consumer<INotification> notifyMethod,
java.lang.Object notifyContext)
-Constructor.
+Constructor.
-
- The notification method on the interested object should take one
- parameter of type INotification
-
+ The notification method on the interested object should take one
+ parameter of type INotification
- Parameters:
notifyMethod
- the notification method of the interested object
@@ -311,7 +308,7 @@ Method Detail
-
compareNotifyContext
public boolean compareNotifyContext(java.lang.Object object)
-Compare an object to the notification context.
+Compare an object to the notification context.
- Specified by:
compareNotifyContext
in interface IObserver
@@ -330,7 +327,7 @@ compareNotifyContext
-
getNotifyContext
protected java.lang.Object getNotifyContext()
-Get the notification context.
+Get the notification context.
- Returns:
- the notification context (
this
) of the
@@ -345,7 +342,7 @@ getNotifyContext
-
getNotifyMethod
protected java.util.function.Consumer<INotification> getNotifyMethod()
-Get the notification method.
+Get the notification method.
- Returns:
- the notification (callback) consumer function of the interested object.
@@ -359,7 +356,7 @@ getNotifyMethod
-
notifyObserver
public void notifyObserver(INotification notification)
-Notify the interested object.
+Notify the interested object.
- Specified by:
notifyObserver
in interface IObserver
@@ -376,7 +373,7 @@ notifyObserver
-
setNotifyContext
public void setNotifyContext(java.lang.Object notifyContext)
-Set the notification context.
+Set the notification context.
- Specified by:
setNotifyContext
in interface IObserver
@@ -392,12 +389,10 @@ setNotifyContext
-
setNotifyMethod
public void setNotifyMethod(java.util.function.Consumer<INotification> notifyMethod)
-Set the notification method.
+Set the notification method.
-
- The notification method should take one parameter of type
- INotification
.
-
+ The notification method should take one parameter of type
+ INotification
.
- Specified by:
setNotifyMethod
in interface IObserver
diff --git a/docs/org/puremvc/java/patterns/observer/package-frame.html b/docs/org/puremvc/java/patterns/observer/package-frame.html
index bdfe468..df9c04c 100644
--- a/docs/org/puremvc/java/patterns/observer/package-frame.html
+++ b/docs/org/puremvc/java/patterns/observer/package-frame.html
@@ -2,10 +2,10 @@
-
+
org.puremvc.java.patterns.observer
-
+
diff --git a/docs/org/puremvc/java/patterns/observer/package-summary.html b/docs/org/puremvc/java/patterns/observer/package-summary.html
index 70f440a..6c4a671 100644
--- a/docs/org/puremvc/java/patterns/observer/package-summary.html
+++ b/docs/org/puremvc/java/patterns/observer/package-summary.html
@@ -2,10 +2,10 @@
-
+
org.puremvc.java.patterns.observer
-
+
diff --git a/docs/org/puremvc/java/patterns/observer/package-tree.html b/docs/org/puremvc/java/patterns/observer/package-tree.html
index 17833bd..e06059a 100644
--- a/docs/org/puremvc/java/patterns/observer/package-tree.html
+++ b/docs/org/puremvc/java/patterns/observer/package-tree.html
@@ -2,10 +2,10 @@
-
+
org.puremvc.java.patterns.observer Class Hierarchy
-
+
diff --git a/docs/org/puremvc/java/patterns/proxy/Proxy.html b/docs/org/puremvc/java/patterns/proxy/Proxy.html
index 087b5c2..c1bda08 100644
--- a/docs/org/puremvc/java/patterns/proxy/Proxy.html
+++ b/docs/org/puremvc/java/patterns/proxy/Proxy.html
@@ -2,10 +2,10 @@
-
+
Proxy
-
+
@@ -148,26 +148,20 @@ Class Proxy
public class Proxy
extends Notifier
implements IProxy
-A base IProxy
implementation.
+A base IProxy
implementation.
-
- In PureMVC, Proxy
classes are used to manage parts of the
- application's data model.
-
+ 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
+
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.
-
+ of its data in synchronous fashion.
-
- Proxy
classes are also used to encapsulate the application's
+
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.
-
+ sent when the Proxy
has retrieved the data from the service.
- See Also:
Model
@@ -233,7 +227,9 @@ Constructor Summary
Proxy()
Proxy(java.lang.String proxyName)
public Proxy()+
Constructor
public Proxy(java.lang.String proxyName)-
Constructor
proxyName
- Name of the Proxy
public Proxy(java.lang.String proxyName, java.lang.Object data)-
Constructor
proxyName
- proxy namepublic java.lang.Object getData()-
Get the data object
public java.lang.String getProxyName()-
Get the proxy name
getProxyName
in interface IProxy
public void onRegister()-
Called by the Model when the Proxy is registered
onRegister
in interface IProxy
public void onRemove()-
Called by the Model when the Proxy is removed
public void setData(java.lang.Object data)-
Set the data object
setData
in interface IProxy
IController
implementation.
*
- *
- * In PureMVC, the Controller
class follows the
+ *
+ *
In PureMVC, the Controller
class follows the
* 'Command and Controller' strategy, and assumes these
- * responsibilities:
+ * responsibilities:
ICommand
s
* are intended to handle which INotifications
.INotification
.
- * Your application must register ICommands
with the
- * Controller.
- *
- * The simplest way is to subclass Facade
,
+ *
+ *
Your application must register ICommands
with the
+ * Controller.
The simplest way is to subclass Facade
,
* and use its initializeController
method to add your
- * registrations.
+ * registrations.
- * This IController
implementation is a Singleton,
+ *
This IController
implementation is a Singleton,
* so you should not call the constructor
* directly, but instead call the static Singleton
- * Factory method Controller.getInstance()
+ * Factory method Controller.getInstance()
Controller
instance.
+ * Initialize the Singleton Controller
instance.
Called automatically by the constructor.
* @@ -93,21 +93,21 @@ public Controller() { * and override theinitializeController
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());
- * }
+ * + * {@code // ensure that the Controller is talking to my IView implementation + * override public function initializeController( ) : void + * { + * view = MyView.getInstance(() -> new MyView()); * } - * + * } + **/ public void initializeController() { view = View.getInstance(() -> new View()); } /** - *
Controller
Singleton Factory method.
+ * Controller
Singleton Factory method.
Controller
@@ -118,8 +118,8 @@ public synchronized static IController getInstance(SupplierICommand
has previously been registered
- * to handle a the given INotification
, then it is executed.
+ * If an ICommand
has previously been registered
+ * to handle a the given INotification
, then it is executed.
INotification
*/
@@ -131,16 +131,15 @@ public void executeCommand(INotification notification) {
}
/**
- * Register a particular ICommand
class as the handler
- * for a particular INotification
.
+ * Register a particular ICommand
class as the handler
+ * for a particular INotification
.
- * If an ICommand
has already been registered to
+ *
If an ICommand
has already been registered to
* handle INotification
s 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 theINotification
* @param commandSupplier the Class
of the ICommand
@@ -153,7 +152,7 @@ public void registerCommand(String notificationName, SupplierICommand
to INotification
mapping.
+ * Remove a previously registered ICommand
to INotification
mapping.
INotification
to remove the ICommand
mapping for
*/
@@ -165,7 +164,7 @@ public void removeCommand(String notificationName) {
}
/**
- * Check if a Command is registered for a given Notification
+ * Check if a Command is registered for a given Notification
* * @param notificationName notification name * @return whether a Command is currently registered for the givennotificationName
.
diff --git a/src/org/puremvc/java/core/Model.java b/src/main/java/org/puremvc/java/core/Model.java
similarity index 78%
rename from src/org/puremvc/java/core/Model.java
rename to src/main/java/org/puremvc/java/core/Model.java
index c76cff8..04076a0 100644
--- a/src/org/puremvc/java/core/Model.java
+++ b/src/main/java/org/puremvc/java/core/Model.java
@@ -15,14 +15,12 @@
import java.util.function.Supplier;
/**
- * A Singleton IModel
implementation.
+ * A Singleton IModel
implementation.
- * In PureMVC, the Model
class provides
- * access to model objects (Proxies) by named lookup.
+ *
In PureMVC, the Model
class provides
+ * access to model objects (Proxies) by named lookup.
- * The Model
assumes these responsibilities:
The Model
assumes these responsibilities:
IProxy
instances.IProxy
instances.
*
- * Your application must register 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.
Constructor.
* - *
- * This IModel
implementation is a Singleton,
+ *
This IModel
implementation is a Singleton,
* so you should not call the constructor
* directly, but instead call the static Singleton
- * Factory method Model.getInstance()
+ * Factory method Model.getInstance()
Model
instance.
+ * Initialize the Singleton Model
instance.
- * Called automatically by the constructor, this + *
Called automatically by the constructor, this * is your opportunity to initialize the Singleton * instance in your subclass without overriding the * constructor.
@@ -84,7 +79,7 @@ protected void initializeModel() { } /** - *Model
Singleton Factory method.
+ * Model
Singleton Factory method.
IProxy
with the Model
.
+ * Register an IProxy
with the Model
.
IProxy
to be held by the Model
.
*/
@@ -105,7 +100,7 @@ public void registerProxy(IProxy proxy) {
}
/**
- * Retrieve an IProxy
from the Model
.
+ * Retrieve an IProxy
from the Model
.
IProxy
instance previously registered with the given proxyName
.
@@ -115,7 +110,7 @@ public IProxy retrieveProxy(String proxyName) {
}
/**
- * Check if a Proxy is registered
+ * Check if a Proxy is registered
* * @param proxyName proxy name * @return whether a Proxy is currently registered with the givenproxyName
.
@@ -125,7 +120,7 @@ public boolean hasProxy(String proxyName) {
}
/**
- * Remove an IProxy
from the Model
.
+ * Remove an IProxy
from the Model
.
IProxy
instance to be removed.
* @return the IProxy
that was removed from the Model
diff --git a/src/org/puremvc/java/core/View.java b/src/main/java/org/puremvc/java/core/View.java
similarity index 86%
rename from src/org/puremvc/java/core/View.java
rename to src/main/java/org/puremvc/java/core/View.java
index 7cb2163..e091e82 100644
--- a/src/org/puremvc/java/core/View.java
+++ b/src/main/java/org/puremvc/java/core/View.java
@@ -21,10 +21,10 @@
import java.util.function.Supplier;
/**
- * A Singleton IView
implementation.
+ * A Singleton IView
implementation.
In PureMVC, the View
class assumes these responsibilities:
- * In PureMVC, the View
class assumes these responsibilities:
*
IMediator
instances.IMediators
.Constructor.
* - *
- * This IView
implementation is a Singleton,
+ *
This IView
implementation is a Singleton,
* so you should not call the constructor
* directly, but instead call the static Singleton
- * Factory method View.getInstance()
+ * Factory method View.getInstance()
View Singleton Factory method.
* * @param viewSupplier view supplier function * @return the Singleton instance ofView
@@ -85,21 +84,19 @@ public synchronized static IView getInstance(SupplierInitialize the Singleton View instance.
* - *- * Called automatically by the constructor, this + *
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 anIObserver
to be notified
- * of INotifications
with a given name.
+ * Register an IObserver
to be notified
+ * of INotifications
with a given name.
INotifications
to notify this IObserver
of
* @param observer the IObserver
to register
@@ -113,10 +110,9 @@ public void registerObserver(String notificationName, IObserver observer) {
}
/**
- * Notify the IObservers
for a particular INotification
.
+ * Notify the IObservers
for a particular INotification
.
- * All previously attached IObservers
for this INotification
's
+ *
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.
+ *
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 */ @@ -164,18 +160,17 @@ public void removeObserver(String notificationName, Object notifyContext) { } /** - * Register anIMediator
instance with the View
.
+ * Register an IMediator
instance with the View
.
- * Registers the IMediator
so that it can be retrieved by name,
+ *
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
+ *
+ *
If the IMediator
returns any INotification
* names to be notified about, an Observer
is created encapsulating
* the IMediator
instance's handleNotification
method
* and registering it as an Observer
for all INotifications
the
- * IMediator
is interested in.
IMediator
is interested in.
*
* @param mediator a reference to the IMediator
instance
*/
@@ -205,7 +200,7 @@ public void registerMediator(IMediator mediator) {
}
/**
- * Retrieve an IMediator
from the View
.
+ * Retrieve an IMediator
from the View
.
IMediator
instance to retrieve.
* @return the IMediator
instance previously registered with the given mediatorName
.
@@ -215,7 +210,7 @@ public IMediator retrieveMediator(String mediatorName) {
}
/**
- * Remove an IMediator
from the View
.
+ * Remove an IMediator
from the View
.
IMediator
instance to be removed.
* @return the IMediator
that was removed from the View
@@ -244,7 +239,7 @@ public IMediator removeMediator(String mediatorName) {
}
/**
- * Check if a Mediator is registered or not
+ * Check if a Mediator is registered or not
* * @param mediatorName mediator name * @return whether a Mediator is registered with the givenmediatorName
.
diff --git a/src/org/puremvc/java/interfaces/ICommand.java b/src/main/java/org/puremvc/java/interfaces/ICommand.java
similarity index 83%
rename from src/org/puremvc/java/interfaces/ICommand.java
rename to src/main/java/org/puremvc/java/interfaces/ICommand.java
index d3629f0..8a8c4d5 100644
--- a/src/org/puremvc/java/interfaces/ICommand.java
+++ b/src/main/java/org/puremvc/java/interfaces/ICommand.java
@@ -15,7 +15,7 @@
public interface ICommand extends INotifier {
/**
- * Execute the ICommand
's logic to handle a given INotification
.
+ * Execute the ICommand
's logic to handle a given INotification
.
INotification
to handle.
*/
diff --git a/src/org/puremvc/java/interfaces/IController.java b/src/main/java/org/puremvc/java/interfaces/IController.java
similarity index 77%
rename from src/org/puremvc/java/interfaces/IController.java
rename to src/main/java/org/puremvc/java/interfaces/IController.java
index d43341d..f2eee12 100644
--- a/src/org/puremvc/java/interfaces/IController.java
+++ b/src/main/java/org/puremvc/java/interfaces/IController.java
@@ -10,12 +10,12 @@
import java.util.function.Supplier;
/**
- * The interface definition for a PureMVC Controller.
+ * The interface definition for a PureMVC Controller.
* - *
- * In PureMVC, an IController
implementor
+ *
In PureMVC, an IController
implementor
* follows the 'Command and Controller' strategy, and
- * assumes these responsibilities:
+ * assumes these responsibilities:
ICommand
s
* are intended to handle which INotifications
.ICommand
class as the handler
- * for a particular INotification
.
+ * Register a particular ICommand
class as the handler
+ * for a particular INotification
.
INotification
* @param commandSupplier the Supplier Function of the ICommand
@@ -43,22 +43,22 @@ public interface IController {
void registerCommand(String notificationName, SupplierICommand
previously registered as the
- * handler for INotification
s with the given notification name.
+ * Execute the ICommand
previously registered as the
+ * handler for INotification
s with the given notification name.
INotification
to execute the associated ICommand
for
*/
void executeCommand(INotification notification);
/**
- * Remove a previously registered ICommand
to INotification
mapping.
+ * Remove a previously registered ICommand
to INotification
mapping.
INotification
to remove the ICommand
mapping for
*/
void removeCommand(String notificationName);
/**
- * Check if a Command is registered for a given Notification
+ * Check if a Command is registered for a given Notification
* * @param notificationName notification name * @return whether a Command is currently registered for the givennotificationName
.
diff --git a/src/org/puremvc/java/interfaces/IFacade.java b/src/main/java/org/puremvc/java/interfaces/IFacade.java
similarity index 71%
rename from src/org/puremvc/java/interfaces/IFacade.java
rename to src/main/java/org/puremvc/java/interfaces/IFacade.java
index c7a7331..6a4c917 100644
--- a/src/org/puremvc/java/interfaces/IFacade.java
+++ b/src/main/java/org/puremvc/java/interfaces/IFacade.java
@@ -10,20 +10,18 @@
import java.util.function.Supplier;
/**
- * The interface definition for a PureMVC Facade.
+ * The interface definition for a PureMVC Facade.
* - *- * The Facade Pattern suggests providing a single + *
The Facade Pattern suggests providing a single * class to act as a central point of communication - * for a subsystem.
+ * for a subsystem. * - *- * In PureMVC, the Facade acts as an interface between + *
In PureMVC, the Facade acts as an interface between * the core MVC actors (Model, View, Controller) and * the rest of your application.
* - * @see org.puremvc.java.interfaces.IModel IModel - * @see org.puremvc.java.interfaces.IView IView + * @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 @@ -31,14 +29,14 @@ public interface IFacade extends INotifier { /** - * Register anIProxy
with the Model
by name.
+ * Register an IProxy
with the Model
by name.
IProxy
to be registered with the Model
.
*/
void registerProxy(IProxy proxy);
/**
- * Retrieve a IProxy
from the Model
by name.
+ * Retrieve a IProxy
from the Model
by name.
IProxy
instance to be retrieved.
* @return the IProxy
previously regisetered by proxyName
with the Model
.
@@ -46,7 +44,7 @@ public interface IFacade extends INotifier {
IProxy retrieveProxy(String proxyName);
/**
- * Remove an IProxy
instance from the Model
by name.
+ * Remove an IProxy
instance from the Model
by name.
IProxy
to remove from the Model
.
* @return the IProxy
that was removed from the Model
@@ -54,7 +52,7 @@ public interface IFacade extends INotifier {
IProxy removeProxy(String proxyName);
/**
- * Check if a Proxy is registered
+ * Check if a Proxy is registered
* * @param proxyName proxy name * @return whether a Proxy is currently registered with the givenproxyName
.
@@ -62,7 +60,7 @@ public interface IFacade extends INotifier {
boolean hasProxy(String proxyName);
/**
- * Register an ICommand
with the Controller
.
+ * Register an ICommand
with the Controller
.
INotification
to associate the ICommand
with.
* @param commandSupplier a reference to the Command Supplier Function of the ICommand
.
@@ -70,14 +68,14 @@ public interface IFacade extends INotifier {
void registerCommand(String notificationName, SupplierICommand
to INotification
mapping from the Controller.
+ * Remove a previously registered ICommand
to INotification
mapping from the Controller.
INotification
to remove the ICommand
mapping for
*/
void removeCommand(String notificationName);
/**
- * Check if a Command is registered for a given Notification
+ * Check if a Command is registered for a given Notification
* * @param notificationName notification name * @return whether a Command is currently registered for the givennotificationName
.
@@ -85,14 +83,14 @@ public interface IFacade extends INotifier {
boolean hasCommand(String notificationName);
/**
- * Register an IMediator
instance with the View
.
+ * Register an IMediator
instance with the View
.
IMediator
instance
*/
void registerMediator(IMediator mediator);
/**
- * Retrieve an IMediator
instance from the View
.
+ * Retrieve an IMediator
instance from the View
.
IMediator
instance to retrievve
* @return the IMediator
previously registered with the given mediatorName
.
@@ -100,7 +98,7 @@ public interface IFacade extends INotifier {
IMediator retrieveMediator(String mediatorName);
/**
- * Remove a IMediator
instance from the View
.
+ * Remove a IMediator
instance from the View
.
IMediator
instance to be removed.
* @return the IMediator
instance previously registered with the given mediatorName
.
@@ -108,7 +106,7 @@ public interface IFacade extends INotifier {
IMediator removeMediator(String mediatorName);
/**
- * Check if a Mediator is registered or not
+ * Check if a Mediator is registered or not
* * @param mediatorName mediator name * @return whether a Mediator is registered with the givenmediatorName
.
@@ -116,14 +114,13 @@ public interface IFacade extends INotifier {
boolean hasMediator(String mediatorName);
/**
- * Notify the IObservers
for a particular INotification
.
+ * Notify the IObservers
for a particular INotification
.
- * All previously attached IObservers
for this INotification
's
+ *
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 + * + *
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.
* diff --git a/src/main/java/org/puremvc/java/interfaces/IMediator.java b/src/main/java/org/puremvc/java/interfaces/IMediator.java new file mode 100644 index 0000000..a7c7a0a --- /dev/null +++ b/src/main/java/org/puremvc/java/interfaces/IMediator.java @@ -0,0 +1,149 @@ +// +// PureMVC Java Standard +// +// Copyright(c) 2019 Saad ShamsThe interface definition for a PureMVC Mediator.
+ * + *In PureMVC, IMediator
implementors assume these responsibilities:
INotification
s
+ * the IMediator
has interest in.Additionally, IMediator
s typically:
INotifications
, interacting with of
+ * the rest of the PureMVC app.When an IMediator
is registered with the IView
,
+ * the IView
will call the IMediator
's
+ * listNotificationInterests
method. The IMediator
will
+ * return an Array
of INotification
names which
+ * it wishes to be notified about.
The IView
will then create an Observer
object
+ * encapsulating that IMediator
's (handleNotification
) method
+ * and register it as an Observer for each INotification
name returned by
+ * listNotificationInterests
.
A concrete IMediator implementor usually looks something like this:
+ * + *+ * {@code import org.puremvc.as3.multicore.patterns.mediator.*; + * import org.puremvc.as3.multicore.patterns.observer.*; + * import org.puremvc.as3.multicore.core.view.*; + * + * import com.me.myapp.model.*; + * import com.me.myapp.view.*; + * import com.me.myapp.controller.*; + * + * import javax.swing.JComboBox; + * import java.awt.event.ActionListener; + * + * public class MyMediator extends Mediator implements IMediator, ActionListener { + * + * public MyMediator( Object viewComponent ) { + * super( viewComponent ); + * combo.addActionListener( this ); + * } + * + * public String[] listNotificationInterests() { + * return [ MyFacade.SET_SELECTION, + * MyFacade.SET_DATAPROVIDER ]; + * } + * + * public void handleNotification( INotification notification ) { + * switch ( notification.getName() ) { + * case MyFacade.SET_SELECTION: + * setSelection(notification); + * break; + * case MyFacade.SET_DATAPROVIDER: + * setDataProvider(notification); + * break; + * } + * } + * + * // Set the data provider of the combo box + * protected void setDataProvider( INotification notification ) { + * combo.setModel(ComboBoxModel+ * + * @see org.puremvc.java.interfaces.INotification INotification + */ +public interface IMediator extends INotifier { + + /** + *(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; + * } + * + * } + * } + *
Get the IMediator
instance name
IMediator
instance name
+ */
+ String getMediatorName();
+
+ /**
+ * Get the IMediator
's view component.
Set the IMediator
's view component.
List INotification
interests.
Array
of the INotification
names this IMediator
has an interest in.
+ */
+ String[] listNotificationInterests();
+
+ /**
+ * Handle an INotification
.
INotification
to be handled
+ */
+ void handleNotification(INotification notification);
+
+ /**
+ * Called by the View when the Mediator is registered
+ */ + void onRegister(); + + /** + *Called by the View when the Mediator is removed
+ */ + void onRemove(); +} diff --git a/src/org/puremvc/java/interfaces/IModel.java b/src/main/java/org/puremvc/java/interfaces/IModel.java similarity index 73% rename from src/org/puremvc/java/interfaces/IModel.java rename to src/main/java/org/puremvc/java/interfaces/IModel.java index 08175f6..181e4bd 100644 --- a/src/org/puremvc/java/interfaces/IModel.java +++ b/src/main/java/org/puremvc/java/interfaces/IModel.java @@ -8,14 +8,12 @@ package org.puremvc.java.interfaces; /** - * The interface definition for a PureMVC Model. + *The interface definition for a PureMVC Model.
* - *
- * In PureMVC, IModel
implementors provide
+ *
In PureMVC, IModel
implementors provide
* access to IProxy
objects by named lookup.
- * An IModel
assumes these responsibilities:
An IModel
assumes these responsibilities:
IProxy
instancesIProxy
instance with the Model
.
+ * Register an IProxy
instance with the Model
.
Model
.
*/
void registerProxy(IProxy proxy);
/**
- * Retrieve an IProxy
instance from the Model.
+ * Retrieve an IProxy
instance from the Model.
IProxy
instance previously registered with the given proxyName
.
@@ -40,7 +38,7 @@ public interface IModel {
IProxy retrieveProxy(String proxyName);
/**
- * Remove an IProxy
instance from the Model.
+ * Remove an IProxy
instance from the Model.
IProxy
instance to be removed.
* @return the IProxy
that was removed from the Model
@@ -48,7 +46,7 @@ public interface IModel {
IProxy removeProxy(String proxyName);
/**
- * Check if a Proxy is registered
+ * Check if a Proxy is registered
* * @param proxyName proxy name * @return whether a Proxy is currently registered with the givenproxyName
.
diff --git a/src/org/puremvc/java/interfaces/INotification.java b/src/main/java/org/puremvc/java/interfaces/INotification.java
similarity index 67%
rename from src/org/puremvc/java/interfaces/INotification.java
rename to src/main/java/org/puremvc/java/interfaces/INotification.java
index e997e4b..27c8f15 100644
--- a/src/org/puremvc/java/interfaces/INotification.java
+++ b/src/main/java/org/puremvc/java/interfaces/INotification.java
@@ -8,20 +8,17 @@
package org.puremvc.java.interfaces;
/**
- * The interface definition for a PureMVC Notification.
+ * The interface definition for a PureMVC Notification.
* - *- * PureMVC does not rely upon underlying event models such + *
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 + *
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 + *
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 Notification
s to
@@ -29,59 +26,58 @@
* instances communicate with each other and IMediator
s
* by broadcasting INotification
s.
- * A key difference between Flash Event
s and PureMVC
+ *
A key difference between Flash Event
s and PureMVC
* Notification
s is that Event
s follow the
* 'Chain of Responsibility' pattern, 'bubbling' up the display hierarchy
* until some parent component handles the Event
, while
* PureMVC Notification
s 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 Notification
s.
+ * using Notification
s.
INotification
instance.
- * No setter, should be set by constructor only
+ * Get the name of the INotification
instance.
+ * No setter, should be set by constructor only
INotification
instance
+ * Set the body of the INotification
instance
INotification
instance
+ * Get the body of the INotification
instance
INotification
instance
+ * Set the type of the INotification
instance
INotification
instance
+ * Get the type of the INotification
instance
INotification
instance
+ * Get the string representation of the INotification
instance
INotification
*/
diff --git a/src/org/puremvc/java/interfaces/INotifier.java b/src/main/java/org/puremvc/java/interfaces/INotifier.java
similarity index 68%
rename from src/org/puremvc/java/interfaces/INotifier.java
rename to src/main/java/org/puremvc/java/interfaces/INotifier.java
index bf96e30..6dc3f8c 100644
--- a/src/org/puremvc/java/interfaces/INotifier.java
+++ b/src/main/java/org/puremvc/java/interfaces/INotifier.java
@@ -8,35 +8,31 @@
package org.puremvc.java.interfaces;
/**
- * The interface definition for a PureMVC Notifier.
+ * The interface definition for a PureMVC Notifier.
* - *
- * MacroCommand, Command, Mediator
and Proxy
- * all have a need to send Notifications
.
MacroCommand, Command, Mediator
and Proxy
+ * all have a need to send Notifications
.
- * The INotifier
interface provides a common method called
+ *
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
+ *
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.
INotification
.
+ * Send a INotification
.
- * Convenience method to prevent having to construct new + *
Convenience method to prevent having to construct new * notification instances in our implementation code.
* * @param notificationName the name of the notification to send @@ -46,10 +42,9 @@ public interface INotifier { void sendNotification(String notificationName, Object body, String type); /** - * Send aINotification
.
+ * Send a INotification
.
- * Convenience method to prevent having to construct new + *
Convenience method to prevent having to construct new * notification instances in our implementation code.
* * @param notificationName the name of the notification to send @@ -58,10 +53,9 @@ public interface INotifier { void sendNotification(String notificationName, Object body); /** - * Send aINotification
.
+ * Send a INotification
.
- * Convenience method to prevent having to construct new + *
Convenience method to prevent having to construct new * notification instances in our implementation code.
* * @param notificationName the name of the notification to send diff --git a/src/org/puremvc/java/interfaces/IObserver.java b/src/main/java/org/puremvc/java/interfaces/IObserver.java similarity index 72% rename from src/org/puremvc/java/interfaces/IObserver.java rename to src/main/java/org/puremvc/java/interfaces/IObserver.java index 634366c..95a4e53 100644 --- a/src/org/puremvc/java/interfaces/IObserver.java +++ b/src/main/java/org/puremvc/java/interfaces/IObserver.java @@ -10,10 +10,10 @@ import java.util.function.Consumer; /** - * The interface definition for a PureMVC Observer. + *The interface definition for a PureMVC Observer.
+ * + *In PureMVC, IObserver
implementors assume these responsibilities:
- * In PureMVC, IObserver
implementors assume these responsibilities:
*
- * PureMVC does not rely upon underlying event + *
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 + *
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 + *
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.
+ * acts as a proxy for notifying the interested object.
- * Observers can receive Notification
s by having their
+ *
Observers can receive Notification
s by having their
* notifyObserver
method invoked, passing
* in an object implementing the INotification
interface, such
* as a subclass of Notification
.
Set the notification method.
* - *
- * The notification method should take one parameter of type INotification
The notification method should take one parameter of type INotification
Set the notification context.
* * @param notifyContext the notification context (this) of the interested object */ void setNotifyContext(Object notifyContext); /** - * Notify the interested object. + *Notify the interested object.
* * @param notification theINotification
to pass to the interested object's notification method
*/
void notifyObserver(INotification notification);
/**
- * Compare the given object to the notificaiton context object.
+ * 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. diff --git a/src/org/puremvc/java/interfaces/IProxy.java b/src/main/java/org/puremvc/java/interfaces/IProxy.java similarity index 74% rename from src/org/puremvc/java/interfaces/IProxy.java rename to src/main/java/org/puremvc/java/interfaces/IProxy.java index d61c553..98fc0b7 100644 --- a/src/org/puremvc/java/interfaces/IProxy.java +++ b/src/main/java/org/puremvc/java/interfaces/IProxy.java @@ -8,16 +8,17 @@ package org.puremvc.java.interfaces; /** - * The interface definition for a PureMVC Proxy. + *The interface definition for a PureMVC Proxy.
+ * + *In PureMVC, IProxy
implementors assume these responsibilities:
- * In PureMVC, IProxy
implementors assume these responsibilities:
- * Additionally, IProxy
s typically:
Additionally, IProxy
s typically:
Get the Proxy name
* * @return the Proxy instance name */ String getProxyName(); /** - * Set the data object + *Set the data object
* * @param data the data object */ void setData(Object data); /** - * Get the data object + *Get the data object
* * @return the data as type Object */ Object getData(); /** - * Called by the Model when the Proxy is registered + *Called by the Model when the Proxy is registered
*/ void onRegister(); /** - * Called by the Model when the Proxy is removed + *Called by the Model when the Proxy is removed
*/ void onRemove(); } diff --git a/src/org/puremvc/java/interfaces/IView.java b/src/main/java/org/puremvc/java/interfaces/IView.java similarity index 74% rename from src/org/puremvc/java/interfaces/IView.java rename to src/main/java/org/puremvc/java/interfaces/IView.java index a8f5bd4..fe8a87a 100644 --- a/src/org/puremvc/java/interfaces/IView.java +++ b/src/main/java/org/puremvc/java/interfaces/IView.java @@ -8,13 +8,12 @@ package org.puremvc.java.interfaces; /** - * The interface definition for a PureMVC View. + *The interface definition for a PureMVC View.
* - *
- * In PureMVC, IView
implementors assume these responsibilities:
In PureMVC, IView
implementors assume these responsibilities:
In PureMVC, the View
class assumes these responsibilities:
- * In PureMVC, the View
class assumes these responsibilities:
*
IMediator
instances.IMediators
.IObserver
to be notified
- * of INotifications
with a given name.
+ * Register an IObserver
to be notified
+ * of INotifications
with a given name.
INotifications
to notify this IObserver
of
* @param observer the IObserver
to register
@@ -40,18 +39,17 @@ public interface IView {
void registerObserver(String notificationName, IObserver observer);
/**
- * Remove a group of observers from the observer list for a given Notification name.
- * + *
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 theIObservers
for a particular INotification
.
+ * Notify the IObservers
for a particular INotification
.
- * All previously attached IObservers
for this INotification
's
+ *
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.
IMediator
instance with the View
.
+ * Register an IMediator
instance with the View
.
- * Registers the IMediator
so that it can be retrieved by name,
+ *
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
+ *
+ *
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
@@ -78,7 +75,7 @@ public interface IView {
void registerMediator(IMediator mediator);
/**
- * Retrieve an IMediator
from the View
.
+ *
Retrieve an IMediator
from the View
.
IMediator
instance to retrieve.
* @return the IMediator
instance previously registered with the given mediatorName
.
@@ -86,7 +83,7 @@ public interface IView {
IMediator retrieveMediator(String mediatorName);
/**
- * Remove an IMediator
from the View
.
+ * Remove an IMediator
from the View
.
IMediator
instance to be removed.
* @return the IMediator
that was removed from the View
@@ -94,7 +91,7 @@ public interface IView {
IMediator removeMediator(String mediatorName);
/**
- * Check if a Mediator is registered or not
+ * Check if a Mediator is registered or not
* * @param mediatorName mediator name * @return whether a Mediator is registered with the givenmediatorName
.
diff --git a/src/org/puremvc/java/patterns/command/MacroCommand.java b/src/main/java/org/puremvc/java/patterns/command/MacroCommand.java
similarity index 75%
rename from src/org/puremvc/java/patterns/command/MacroCommand.java
rename to src/main/java/org/puremvc/java/patterns/command/MacroCommand.java
index 1cfb805..d180e27 100644
--- a/src/org/puremvc/java/patterns/command/MacroCommand.java
+++ b/src/main/java/org/puremvc/java/patterns/command/MacroCommand.java
@@ -15,28 +15,23 @@
import java.util.function.Supplier;
/**
- * A base ICommand
implementation that executes other ICommand
s.
+ * A base ICommand
implementation that executes other ICommand
s.
- * A MacroCommand
maintains an list of
+ *
A MacroCommand
maintains an list of
* ICommand
Class references called SubCommands.
- * When execute
is called, the MacroCommand
+ *
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
+ *
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
@@ -46,15 +41,13 @@ public class MacroCommand extends Notifier implements ICommand {
private Vector Constructor.
- * You should not need to define a constructor,
+ * You should not need to define a constructor,
* instead, override the
- * If your subclass does define a constructor, be
+ * If your subclass does define a constructor, be
* sure to call Initialize the
- * In your subclass, override this method to
+ * In your subclass, override this method to
* initialize the
- * Note that SubCommands may be any Note that SubCommands may be any Add a SubCommand.
- * The SubCommands will be called in First In/First Out (FIFO)
+ * The SubCommands will be called in First In/First Out (FIFO)
* order. Execute this
- * The SubCommands will be called in First In/First Out (FIFO)
- * order.
+ * The SubCommands will be called in First In/First Out (FIFO)
+ * order. A base
- * Your subclass should override the Your subclass should override the Fulfill the use-case initiated by the given
- * In the Command Pattern, an application use-case typically
+ * In the Command Pattern, an application use-case typically
* begins with some user action, which results in an A base Singleton In PureMVC, the
- * In PureMVC, the
- * Example usage:
+ *
+ * Example usage: Constructor.
- * This This Initialize the Singleton
- * Called automatically by the constructor. Override in your
+ * Called automatically by the constructor. Override in your
* subclass to do any subclass specific initializations. Be
* sure to call Facade Singleton Factory method Initialize the
- * Called by the Called by the If you don't want to initialize a different initializeMacroCommand
* method.super()
.MacroCommand
.
+ * MacroCommand
.MacroCommand
's SubCommand
* list with ICommand
class references like
* this:ICommand
implementor,
+ *
+ * ICommand
implementor,
* MacroCommand
s or SimpleCommands
are both acceptable.ICommand
.
@@ -103,11 +94,10 @@ protected void addSubCommand(SupplierMacroCommand
's SubCommands.
+ * MacroCommand
's SubCommands.INotification
object to be passsed to each SubCommand.
*/
diff --git a/src/org/puremvc/java/patterns/command/SimpleCommand.java b/src/main/java/org/puremvc/java/patterns/command/SimpleCommand.java
similarity index 73%
rename from src/org/puremvc/java/patterns/command/SimpleCommand.java
rename to src/main/java/org/puremvc/java/patterns/command/SimpleCommand.java
index 0c8bfab..52f225c 100644
--- a/src/org/puremvc/java/patterns/command/SimpleCommand.java
+++ b/src/main/java/org/puremvc/java/patterns/command/SimpleCommand.java
@@ -12,23 +12,21 @@
import org.puremvc.java.patterns.observer.Notifier;
/**
- * A base ICommand
implementation.
+ * ICommand
implementation.execute
- * method where your business logic will handle the INotification
. execute
+ * method where your business logic will handle the INotification
.INotification
.
+ * INotification
.INotification
being broadcast, which
* is handled by business logic in the execute
method of an
* ICommand
.IFacade
implementation.
+ * IFacade
implementation.Facade
class assumes these
+ * responsibilities:Facade
class assumes these
- * responsibilities:
*
*
- * Model
, View
* and Controller
Singletons.Commands
and notifying Observers
* {@code
* import org.puremvc.as3.patterns.facade.Facade;
@@ -126,9 +126,9 @@
* }
*
*
- * @see org.puremvc.java.core.Model Model
- * @see org.puremvc.java.core.View View
- * @see org.puremvc.java.core.Controller Controller
+ * @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
@@ -149,13 +149,12 @@ public class Facade implements IFacade {
protected final String SINGLETON_MSG = "Facade Singleton already constructed!";
/**
- * Constructor.
+ * IFacade
implementation is a Singleton,
+ * IFacade
implementation is a Singleton,
* so you should not call the constructor
* directly, but instead call the static Singleton
- * Factory method Facade.getInstance()
+ * Factory method Facade.getInstance()
Facade
instance.
+ * Facade
instance.super.initializeFacade()
, though.Controller
.
+ * Controller
.initializeFacade
method.
+ * initializeFacade
method.
* Override this method in your subclass of Facade
* if one or both of the following are true:
*
+ *
* IController
.Commands
to register with the Controller
at startup.IController
,
* call super.initializeController()
at the beginning of your
- * method, then register Command
s.
- * Command
s.
Model
.
+ * Initialize the Model
.
- * Called by the initializeFacade
method.
+ *
Called by the initializeFacade
method.
* Override this method in your subclass of Facade
- * if one or both of the following are true:
+ * if one or both of the following are true:
IModel
.Proxy
s to register with the Model that do not
* retrieve a reference to the Facade at construction time.IModel
,
+ *
+ * If you don't want to initialize a different IModel
,
* call super.initializeModel()
at the beginning of your
- * method, then register Proxy
s.
- *
- * Note: This method is rarely overridden; in practice you are more
+ * method, then register Proxy
s.
Note: This method is rarely overridden; in practice you are more
* likely to use a Command
to create and register Proxy
s
* with the Model
, since Proxy
s with mutable data will likely
* need to send INotification
s and thus will likely want to fetch a reference to
- * the Facade
during their construction.
- *
Facade
during their construction.
*/
protected void initializeModel() {
if(model != null) return;
@@ -241,26 +239,26 @@ protected void initializeModel() {
}
/**
- * Initialize the View
.
+ * Initialize the View
.
- * Called by the initializeFacade
method.
+ *
Called by the initializeFacade
method.
* Override this method in your subclass of Facade
- * if one or both of the following are true:
+ * if one or both of the following are true:
IView
.Observers
to register with the View
If you don't want to initialize a different IView
,
+ *
+ *
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
+ * 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 Mediator
s
* with the View
, since IMediator
instances will need to send
* INotification
s and thus will likely want to fetch a reference
- * to the Facade
during their construction.
- *
Facade
during their construction.
*/
protected void initializeView() {
if(view != null) return;
@@ -268,7 +266,7 @@ protected void initializeView() {
}
/**
- * Register an ICommand
with the Controller
by Notification name.
+ * Register an ICommand
with the Controller
by Notification name.
INotification
to associate the ICommand
with
* @param commandSupplier a reference to the Supplier Function of the ICommand
@@ -278,7 +276,7 @@ public void registerCommand(String notificationName, SupplierICommand
to INotification
mapping from the Controller.
+ * Remove a previously registered ICommand
to INotification
mapping from the Controller.
INotification
to remove the ICommand
mapping for
*/
@@ -287,7 +285,7 @@ public void removeCommand(String notificationName) {
}
/**
- * Check if a Command is registered for a given Notification
+ * Check if a Command is registered for a given Notification
* * @param notificationName notification name * @return whether a Command is currently registered for the givennotificationName
.
@@ -297,7 +295,7 @@ public boolean hasCommand(String notificationName) {
}
/**
- * Register an IProxy
with the Model
by name.
+ * Register an IProxy
with the Model
by name.
IProxy
instance to be registered with the Model
.
*/
@@ -306,7 +304,7 @@ public void registerProxy(IProxy proxy) {
}
/**
- * Retrieve an IProxy
from the Model
by name.
+ * Retrieve an IProxy
from the Model
by name.
IProxy
instance previously registered with the given proxyName
.
@@ -316,7 +314,7 @@ public IProxy retrieveProxy(String proxyName) {
}
/**
- * Remove an IProxy
from the Model
by name.
+ * Remove an IProxy
from the Model
by name.
IProxy
to remove from the Model
.
* @return the IProxy
that was removed from the Model
@@ -326,7 +324,7 @@ public IProxy removeProxy(String proxyName) {
}
/**
- * Check if a Proxy is registered
+ * Check if a Proxy is registered
* * @param proxyName proxy name * @return whether a Proxy is currently registered with the givenproxyName
.
@@ -336,7 +334,7 @@ public boolean hasProxy(String proxyName) {
}
/**
- * Register a IMediator
with the View
.
+ * Register a IMediator
with the View
.
IMediator
*/
@@ -345,7 +343,7 @@ public void registerMediator(IMediator mediator) {
}
/**
- * Retrieve an IMediator
from the View
.
+ * Retrieve an IMediator
from the View
.
IMediator
previously registered with the given mediatorName
.
@@ -355,7 +353,7 @@ public IMediator retrieveMediator(String mediatorName) {
}
/**
- * Remove an IMediator
from the View
.
+ * Remove an IMediator
from the View
.
IMediator
to be removed.
* @return the IMediator
that was removed from the View
@@ -365,7 +363,7 @@ public IMediator removeMediator(String mediatorName) {
}
/**
- * Check if a Mediator is registered or not
+ * Check if a Mediator is registered or not
* * @param mediatorName mediator name * @return whether a Mediator is registered with the givenmediatorName
.
@@ -375,11 +373,11 @@ public boolean hasMediator(String mediatorName) {
}
/**
- * Create and send an INotification
.
+ * Create and send an INotification
.
Keeps us from having to construct new notification + * instances in our implementation code.
* - *
- * 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
@@ -389,11 +387,11 @@ public void sendNotification(String notificationName, Object body, String type)
}
/**
- * Create and send an INotification
.
+ *
Create and send an INotification
.
Keeps us from having to construct new notification + * instances in our implementation code.
* - *
- * 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
*/
@@ -402,11 +400,11 @@ public void sendNotification(String notificationName, Object body) {
}
/**
- * Create and send an INotification
.
+ *
Create and send an INotification
.
Keeps us from having to construct new notification + * instances in our implementation code.
* - *
- * 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) {
@@ -414,13 +412,13 @@ public void sendNotification(String notificationName) {
}
/**
- * Notify Observer
s.
- *
- * This method is left public mostly for backward + *
Notify Observer
s.
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 + * + *
Usually you should just call sendNotification * and pass the parameters, never having to * construct the notification yourself.
* diff --git a/src/org/puremvc/java/patterns/mediator/Mediator.java b/src/main/java/org/puremvc/java/patterns/mediator/Mediator.java similarity index 74% rename from src/org/puremvc/java/patterns/mediator/Mediator.java rename to src/main/java/org/puremvc/java/patterns/mediator/Mediator.java index f79fe88..76a7e9b 100644 --- a/src/org/puremvc/java/patterns/mediator/Mediator.java +++ b/src/main/java/org/puremvc/java/patterns/mediator/Mediator.java @@ -12,17 +12,16 @@ import org.puremvc.java.patterns.observer.Notifier; /** - * A baseIMediator
implementation.
+ * A base IMediator
implementation.
Mediator
.
+ * The name of the Mediator
.
- * Typically, a Mediator
will be written to serve
+ *
Typically, a Mediator
will be written to serve
* one specific control or group controls and so,
* will not have a need to be dynamically named.
Constructor.
* * @param mediatorName mediator name * @param viewComponent view component @@ -46,7 +45,7 @@ public Mediator(String mediatorName, Object viewComponent) { } /** - * Constructor. + *Constructor.
* * @param mediatorName mediator name */ @@ -55,15 +54,15 @@ public Mediator(String mediatorName) { } /** - * Constructor. + *Constructor.
*/ public Mediator() { this(null, null); } /** - * List theINotification
names this
- * Mediator
is interested in being notified of.
+ * List the INotification
names this
+ * Mediator
is interested in being notified of.
INotification
names
*/
@@ -72,33 +71,33 @@ public String[] listNotificationInterests() {
}
/**
- * Handle INotification
s.
+ * Handle INotification
s.
- * Typically this will be handled in a switch statement, + *
Typically this will be handled in a switch statement,
* with one 'case' entry per INotification
- * the Mediator
is interested in.
+ * the Mediator
is interested in.
Called by the View when the Mediator is registered
*/ public void onRegister() { } /** - * Called by the View when the Mediator is removed + *Called by the View when the Mediator is removed
*/ public void onRemove() { } /** - * Get the name of theMediator
.
+ * Get the name of the Mediator
.
Mediator
's view component.
+ * Get the Mediator
's view component.
- * Additionally, an implicit getter will usually + *
Additionally, an implicit getter will usually * be defined in the subclass that casts the view * object to a type, like this:
* @@ -127,7 +125,7 @@ public Object getViewComponent() { } /** - * Set theIMediator
's view component.
+ * Set the IMediator
's view component.
INotification
implementation.
+ * A base INotification
implementation.
- * PureMVC does not rely upon underlying event models such + *
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 + *
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 + *
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 Notification
s to
@@ -31,17 +28,16 @@
* instances communicate with each other and IMediator
s
* by broadcasting INotification
s.
- * A key difference between Flash Event
s and PureMVC
+ *
A key difference between Flash Event
s and PureMVC
* Notification
s is that Event
s follow the
* 'Chain of Responsibility' pattern, 'bubbling' up the display hierarchy
* until some parent component handles the Event
, while
* PureMVC Notification
s 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 Notification
s.
+ * using Notification
s.
Constructor.
* * @param name name of theNotification
instance. (required)
* @param body the Notification
body.
@@ -69,7 +65,7 @@ public Notification(String name, Object body, String type) {
}
/**
- * Constructor.
+ * Constructor.
* * @param name name of theNotification
instance.
* @param body the Notification
body.
@@ -79,7 +75,7 @@ public Notification(String name, Object body) {
}
/**
- * Constructor.
+ * Constructor.
* * @param name name of theNotification
instance.
*/
@@ -88,7 +84,7 @@ public Notification(String name) {
}
/**
- * Get the name of the Notification
instance.
+ * Get the name of the Notification
instance.
Notification
instance.
*/
@@ -97,14 +93,14 @@ public String getName() {
}
/**
- * Set the body of the Notification
instance.
+ * Set the body of the Notification
instance.
Notification
instance.
+ * Get the body of the Notification
instance.
Notification
instance.
+ * Set the type of the Notification
instance.
Notification
instance.
+ * Get the type of the Notification
instance.
Notification
instance.
+ * Get the string representation of the Notification
instance.
Notification
instance.
*/
diff --git a/src/org/puremvc/java/patterns/observer/Notifier.java b/src/main/java/org/puremvc/java/patterns/observer/Notifier.java
similarity index 65%
rename from src/org/puremvc/java/patterns/observer/Notifier.java
rename to src/main/java/org/puremvc/java/patterns/observer/Notifier.java
index 287c892..f47caa8 100644
--- a/src/org/puremvc/java/patterns/observer/Notifier.java
+++ b/src/main/java/org/puremvc/java/patterns/observer/Notifier.java
@@ -12,28 +12,23 @@
import org.puremvc.java.patterns.facade.Facade;
/**
- * A Base INotifier
implementation.
+ * A Base INotifier
implementation.
- * MacroCommand, Command, Mediator
and Proxy
all
- * have a need to send Notifications
.
- *
- * The INotifier
interface provides a common method called
+ *
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
.
- *
Notifications
.
*
- *
- * The Notifier
class, which all of the above mentioned classes
+ *
The Notifier
class, which all of the above mentioned classes
* extend, provides an initialized reference to the Facade
* Singleton, which is required for the convienience method for sending
* Notifications
, but also eases implementation as these classes
* have frequent Facade
interactions and usually require access
- * to the facade anyway.
- *
Local reference to the Facade Singleton
*/ protected IFacade facade = Facade.getInstance(()-> new Facade()); /** - * Send anINotification
s.
+ * Send an INotification
s.
- * Keeps us from having to construct new notification instances in our - * implementation code. + *
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 @@ -62,11 +56,10 @@ public void sendNotification(String notificationName, Object body, String type) } /** - * Send anINotification
s.
+ * Send an INotification
s.
- * Keeps us from having to construct new notification instances in our - * implementation code. + *
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 @@ -76,11 +69,10 @@ public void sendNotification(String notificationName, Object body) { } /** - * Send anINotification
s.
+ * Send an INotification
s.
- * Keeps us from having to construct new notification instances in our - * implementation code. + *
Keeps us from having to construct new notification instances in our + * implementation code.
* * @param notificationName the name of the notiification to send */ diff --git a/src/org/puremvc/java/patterns/observer/Observer.java b/src/main/java/org/puremvc/java/patterns/observer/Observer.java similarity index 78% rename from src/org/puremvc/java/patterns/observer/Observer.java rename to src/main/java/org/puremvc/java/patterns/observer/Observer.java index 8bda34b..aa8fb33 100644 --- a/src/org/puremvc/java/patterns/observer/Observer.java +++ b/src/main/java/org/puremvc/java/patterns/observer/Observer.java @@ -13,15 +13,14 @@ import java.util.function.Consumer; /** - * A baseIObserver
implementation.
+ * A base IObserver
implementation.
- * An Observer
is an object that encapsulates information
+ *
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.
INotification
is broadcast.
+ *
+ * In PureMVC, the Observer
class assumes these responsibilities:
- * In PureMVC, the Observer
class assumes these responsibilities:
*
Constructor.
* - *
- * The notification method on the interested object should take one
- * parameter of type INotification
- *
The notification method on the interested object should take one
+ * parameter of type INotification
Compare an object to the notification context.
* * @param object the object to compare * @return boolean indicating if the object and the notification context are @@ -66,7 +63,7 @@ public boolean compareNotifyContext(Object object) { } /** - * Notify the interested object. + *Notify the interested object.
* * @param notification theINotification
to pass to the interested
* object's notification method.
@@ -76,7 +73,7 @@ public void notifyObserver(INotification notification) {
}
/**
- * Get the notification context.
+ * Get the notification context.
* * @return the notification context (this
) of the
* interested object.
@@ -86,7 +83,7 @@ protected Object getNotifyContext() {
}
/**
- * Set the notification context.
+ * Set the notification context.
* * @param notifyContext the notification context (this) of the interested object. */ @@ -95,7 +92,7 @@ public void setNotifyContext(Object notifyContext) { } /** - * Get the notification method. + *Get the notification method.
* * @return the notification (callback) consumer function of the interested object. */ @@ -104,12 +101,10 @@ protected ConsumerSet the notification method.
* - *
- * The notification method should take one parameter of type
- * INotification
.
- *
The notification method should take one parameter of type
+ * INotification
.
IProxy
implementation.
+ * A base IProxy
implementation.
- * In PureMVC, Proxy
classes are used to manage parts of the
- * application's data model.
- *
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
+ *
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
+ *
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.
- *
Proxy
has retrieved the data from the service.
*
* @see org.puremvc.java.core.Model Model
*/
@@ -46,7 +40,8 @@ public class Proxy extends Notifier implements IProxy {
protected Object data;
/**
- * Constructor
+ * Constructor
+ * * @param proxyName proxy name * @param data data object */ @@ -56,33 +51,38 @@ public Proxy(String proxyName, Object data) { } /** - * Constructor + *Constructor
+ * * @param proxyName Name of theProxy
*/
public Proxy(String proxyName) {
this(proxyName, null);
}
+ /**
+ * Constructor
+ */ public Proxy(){ this(null, null); } /** - * Called by the Model when the Proxy is registered + *Called by the Model when the Proxy is registered
*/ public void onRegister() { } /** - * Called by the Model when the Proxy is removed + *Called by the Model when the Proxy is removed
*/ public void onRemove() { } /** - * Get the proxy name + *Get the proxy name
+ * * @return the proxy name */ public String getProxyName() { @@ -90,7 +90,8 @@ public String getProxyName() { } /** - * Get the data object + *Get the data object
+ * * @return the data object */ public Object getData() { @@ -98,7 +99,8 @@ public Object getData() { } /** - * Set the data object + *Set the data object
+ * * @param data data object */ public void setData(Object data) { diff --git a/src/org/puremvc/java/interfaces/IMediator.java b/src/org/puremvc/java/interfaces/IMediator.java deleted file mode 100644 index 1f2c534..0000000 --- a/src/org/puremvc/java/interfaces/IMediator.java +++ /dev/null @@ -1,152 +0,0 @@ -// -// PureMVC Java Standard -// -// Copyright(c) 2019 Saad Shams
- * In PureMVC, IMediator
implementors assume these responsibilities:
INotification
s
- * the IMediator
has interest in.
- * Additionally, IMediator
s typically:
- *
INotifications
, interacting with of
- * the rest of the PureMVC app.
- *
- * When an IMediator
is registered with the IView
,
- * the IView
will call the IMediator
's
- * listNotificationInterests
method. The IMediator
will
- * return an Array
of INotification
names which
- * it wishes to be notified about.
- * The IView
will then create an Observer
object
- * encapsulating that IMediator
's (handleNotification
) method
- * and register it as an Observer for each INotification
name returned by
- * listNotificationInterests
.
- * A concrete IMediator implementor usually looks something like this:
- * - *- * {@code - * import org.puremvc.as3.multicore.patterns.mediator.*; - * import org.puremvc.as3.multicore.patterns.observer.*; - * import org.puremvc.as3.multicore.core.view.*; - * - * import com.me.myapp.model.*; - * import com.me.myapp.view.*; - * import com.me.myapp.controller.*; - * - * import javax.swing.JComboBox; - * import java.awt.event.ActionListener; - * - * public class MyMediator extends Mediator implements IMediator, ActionListener { - * - * public MyMediator( Object viewComponent ) { - * super( viewComponent ); - * combo.addActionListener( this ); - * } - * - * public String[] listNotificationInterests() { - * return [ MyFacade.SET_SELECTION, - * MyFacade.SET_DATAPROVIDER ]; - * } - * - * public void handleNotification( INotification notification ) { - * switch ( notification.getName() ) { - * case MyFacade.SET_SELECTION: - * setSelection(notification); - * break; - * case MyFacade.SET_DATAPROVIDER: - * setDataProvider(notification); - * break; - * } - * } - * - * // Set the data provider of the combo box - * protected void setDataProvider( INotification notification ) { - * combo.setModel(ComboBoxModel- * - * @see org.puremvc.java.interfaces.INotification INotification - */ -public interface IMediator extends INotifier { - - /** - * Get the(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; - * } - * - * } - * } - *
IMediator
instance name
- *
- * @return the IMediator
instance name
- */
- String getMediatorName();
-
- /**
- * Get the IMediator
's view component.
- *
- * @return Object the view component
- */
- Object getViewComponent();
-
- /**
- * Set the IMediator
's view component.
- *
- * @param viewComponent the view component
- */
- void setViewComponent(Object 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/tests/org/puremvc/java/core/ControllerTest.java b/src/test/java/org/puremvc/java/core/ControllerTest.java
similarity index 95%
rename from tests/org/puremvc/java/core/ControllerTest.java
rename to src/test/java/org/puremvc/java/core/ControllerTest.java
index 8d424d5..c476e9b 100644
--- a/tests/org/puremvc/java/core/ControllerTest.java
+++ b/src/test/java/org/puremvc/java/core/ControllerTest.java
@@ -38,13 +38,11 @@ public void testGetInstance() {
/**
* Tests Command registration and execution.
*
- * - * This test gets the Singleton Controller instance + *
This test gets the Singleton Controller instance * and registers the ControllerTestCommand class * to handle 'ControllerTest' Notifications.
* - *- * It then constructs such a Notification and tells the + *
It then constructs such a Notification and tells the * Controller to execute the associated Command. * Success is determined by evaluating a property * on an object passed to the Command, which will @@ -73,8 +71,7 @@ public void testRegisterAndExecuteCommand() { /** * Tests Command registration and removal. * - *
- * Tests that once a Command is registered and verified + *
Tests that once a Command is registered and verified * working, it can be removed from the Controller.
*/ @Test @@ -132,8 +129,7 @@ public void testHasCommand() { /** * Tests Removing and Reregistering a Command * - *- * Tests that when a Command is re-registered that it isn't fired twice. + *
Tests that when a Command is re-registered that it isn't fired twice. * This involves, minimally, registration with the controller but * notification via the View, rather than direct execution of * the Controller's executeCommand method as is done above in diff --git a/tests/org/puremvc/java/core/ControllerTestCommand.java b/src/test/java/org/puremvc/java/core/ControllerTestCommand.java similarity index 85% rename from tests/org/puremvc/java/core/ControllerTestCommand.java rename to src/test/java/org/puremvc/java/core/ControllerTestCommand.java index db7c519..3d0b8a3 100644 --- a/tests/org/puremvc/java/core/ControllerTestCommand.java +++ b/src/test/java/org/puremvc/java/core/ControllerTestCommand.java @@ -13,8 +13,8 @@ /** * A SimpleCommand subclass used by ControllerTest. * - * @see org.puremvc.java.core.ControllerTest ControllerTest - * @see org.puremvc.java.core.ControllerTestVO ControllerTestVO + * @see ControllerTest ControllerTest + * @see ControllerTestVO ControllerTestVO */ public class ControllerTestCommand extends SimpleCommand { diff --git a/tests/org/puremvc/java/core/ControllerTestCommand2.java b/src/test/java/org/puremvc/java/core/ControllerTestCommand2.java similarity index 77% rename from tests/org/puremvc/java/core/ControllerTestCommand2.java rename to src/test/java/org/puremvc/java/core/ControllerTestCommand2.java index 7a8f480..ad1c26c 100644 --- a/tests/org/puremvc/java/core/ControllerTestCommand2.java +++ b/src/test/java/org/puremvc/java/core/ControllerTestCommand2.java @@ -13,15 +13,15 @@ /** * A SimpleCommand subclass used by ControllerTest. * - * @see org.puremvc.java.core.ControllerTest ControllerTest - * @see org.puremvc.java.core.ControllerTestVO ControllerTestVO + * @see ControllerTest ControllerTest + * @see ControllerTestVO ControllerTestVO */ public class ControllerTestCommand2 extends SimpleCommand { /** * Fabricate a result by multiplying the input by 2 and adding to the existing result - *
- * This tests accumulation effect that would show if the command were executed more than once. + * + *
This tests accumulation effect that would show if the command were executed more than once.
* @param notification the note carrying the ControllerTestVO */ public void execute(INotification notification) { diff --git a/tests/org/puremvc/java/core/ControllerTestVO.java b/src/test/java/org/puremvc/java/core/ControllerTestVO.java similarity index 90% rename from tests/org/puremvc/java/core/ControllerTestVO.java rename to src/test/java/org/puremvc/java/core/ControllerTestVO.java index 87e8904..e57643c 100644 --- a/tests/org/puremvc/java/core/ControllerTestVO.java +++ b/src/test/java/org/puremvc/java/core/ControllerTestVO.java @@ -10,7 +10,7 @@ /** * A utility class used by ControllerTest. * - * @see org.puremvc.java.core.ControllerTest ControllerTest + * @see ControllerTest ControllerTest * @see org.puremvc.java.core.ControllerTestCommand ControllerTestCommand */ public class ControllerTestVO { diff --git a/tests/org/puremvc/java/core/ModelTest.java b/src/test/java/org/puremvc/java/core/ModelTest.java similarity index 97% rename from tests/org/puremvc/java/core/ModelTest.java rename to src/test/java/org/puremvc/java/core/ModelTest.java index b4d4eb4..fbecdd9 100644 --- a/tests/org/puremvc/java/core/ModelTest.java +++ b/src/test/java/org/puremvc/java/core/ModelTest.java @@ -31,8 +31,7 @@ public void testGetInstance() { /** * Tests the proxy registration and retrieval methods. * - *
- * Tests registerProxy
and retrieveProxy
in the same test.
+ *
Tests registerProxy
and retrieveProxy
in the same test.
* These methods cannot currently be tested separately
* in any meaningful way other than to show that the
* methods do not throw exception when called.
- * An Observer is created to callback the viewTestMethod of + *
An Observer is created to callback the viewTestMethod of * this ViewTest instance. This Observer is registered with * the View to be notified of 'ViewTestEvent' events. Such * an event is created, and a value set on its payload. Then * the View is told to notify interested observers of this * Event. * - *
- * The View calls the Observer's notifyObserver method + *
The View calls the Observer's notifyObserver method * which calls the viewTestMethod on this instance * of the ViewTest class. The viewTestMethod method will set * an instance variable to the value passed in on the Event diff --git a/tests/org/puremvc/java/core/ViewTestMediator.java b/src/test/java/org/puremvc/java/core/ViewTestMediator.java similarity index 94% rename from tests/org/puremvc/java/core/ViewTestMediator.java rename to src/test/java/org/puremvc/java/core/ViewTestMediator.java index 66f546a..e7d2651 100644 --- a/tests/org/puremvc/java/core/ViewTestMediator.java +++ b/src/test/java/org/puremvc/java/core/ViewTestMediator.java @@ -13,7 +13,7 @@ /** * A Mediator class used by ViewTest. * - * @see org.puremvc.java.core.ViewTest ViewTest + * @see ViewTest ViewTest */ public class ViewTestMediator extends Mediator implements IMediator { diff --git a/tests/org/puremvc/java/core/ViewTestMediator2.java b/src/test/java/org/puremvc/java/core/ViewTestMediator2.java similarity index 96% rename from tests/org/puremvc/java/core/ViewTestMediator2.java rename to src/test/java/org/puremvc/java/core/ViewTestMediator2.java index 91740c5..5da5add 100644 --- a/tests/org/puremvc/java/core/ViewTestMediator2.java +++ b/src/test/java/org/puremvc/java/core/ViewTestMediator2.java @@ -14,7 +14,7 @@ /** * A Mediator class used by ViewTest. * - * @see org.puremvc.java.core.ViewTest ViewTest + * @see ViewTest ViewTest */ public class ViewTestMediator2 extends Mediator implements IMediator { diff --git a/tests/org/puremvc/java/core/ViewTestMediator3.java b/src/test/java/org/puremvc/java/core/ViewTestMediator3.java similarity index 96% rename from tests/org/puremvc/java/core/ViewTestMediator3.java rename to src/test/java/org/puremvc/java/core/ViewTestMediator3.java index 4f51840..f738e86 100644 --- a/tests/org/puremvc/java/core/ViewTestMediator3.java +++ b/src/test/java/org/puremvc/java/core/ViewTestMediator3.java @@ -14,7 +14,7 @@ /** * A Mediator class used by ViewTest. * - * @see org.puremvc.java.core.ViewTest ViewTest + * @see ViewTest ViewTest */ public class ViewTestMediator3 extends Mediator implements IMediator { diff --git a/tests/org/puremvc/java/core/ViewTestMediator4.java b/src/test/java/org/puremvc/java/core/ViewTestMediator4.java similarity index 95% rename from tests/org/puremvc/java/core/ViewTestMediator4.java rename to src/test/java/org/puremvc/java/core/ViewTestMediator4.java index 454699e..9910ad3 100644 --- a/tests/org/puremvc/java/core/ViewTestMediator4.java +++ b/src/test/java/org/puremvc/java/core/ViewTestMediator4.java @@ -14,7 +14,7 @@ /** * A Mediator class used by ViewTest. * - * @see org.puremvc.java.core.ViewTest ViewTest + * @see ViewTest ViewTest */ public class ViewTestMediator4 extends Mediator implements IMediator { diff --git a/tests/org/puremvc/java/core/ViewTestMediator5.java b/src/test/java/org/puremvc/java/core/ViewTestMediator5.java similarity index 95% rename from tests/org/puremvc/java/core/ViewTestMediator5.java rename to src/test/java/org/puremvc/java/core/ViewTestMediator5.java index 1a13864..5591fd6 100644 --- a/tests/org/puremvc/java/core/ViewTestMediator5.java +++ b/src/test/java/org/puremvc/java/core/ViewTestMediator5.java @@ -14,7 +14,7 @@ /** * A Mediator class used by ViewTest. * - * @see org.puremvc.java.core.ViewTest ViewTest + * @see ViewTest ViewTest */ public class ViewTestMediator5 extends Mediator implements IMediator { diff --git a/tests/org/puremvc/java/core/ViewTestMediator6.java b/src/test/java/org/puremvc/java/core/ViewTestMediator6.java similarity index 95% rename from tests/org/puremvc/java/core/ViewTestMediator6.java rename to src/test/java/org/puremvc/java/core/ViewTestMediator6.java index 0eaf93b..5c00993 100644 --- a/tests/org/puremvc/java/core/ViewTestMediator6.java +++ b/src/test/java/org/puremvc/java/core/ViewTestMediator6.java @@ -13,7 +13,7 @@ /** * A Mediator class used by ViewTest. * - * @see org.puremvc.java.core.ViewTest ViewTest + * @see ViewTest ViewTest */ public class ViewTestMediator6 extends Mediator { diff --git a/tests/org/puremvc/java/core/ViewTestNote.java b/src/test/java/org/puremvc/java/core/ViewTestNote.java similarity index 90% rename from tests/org/puremvc/java/core/ViewTestNote.java rename to src/test/java/org/puremvc/java/core/ViewTestNote.java index 85771f7..68c5b71 100644 --- a/tests/org/puremvc/java/core/ViewTestNote.java +++ b/src/test/java/org/puremvc/java/core/ViewTestNote.java @@ -13,7 +13,7 @@ /** * A Notification class used by ViewTest. * - * @see org.puremvc.java.core.ViewTest ViewTest + * @see ViewTest ViewTest */ public class ViewTestNote extends Notification implements INotification { @@ -35,8 +35,7 @@ public ViewTestNote(String name, Object body) { /** * Factory method. * - *
- * This method creates new instances of the ViewTestNote class, + *
This method creates new instances of the ViewTestNote class, * automatically setting the note name so you don't have to. Use * this as an alternative to the constructor.
* diff --git a/tests/org/puremvc/java/patterns/command/MacroCommandTest.java b/src/test/java/org/puremvc/java/patterns/command/MacroCommandTest.java similarity index 88% rename from tests/org/puremvc/java/patterns/command/MacroCommandTest.java rename to src/test/java/org/puremvc/java/patterns/command/MacroCommandTest.java index 6047291..de65dd0 100644 --- a/tests/org/puremvc/java/patterns/command/MacroCommandTest.java +++ b/src/test/java/org/puremvc/java/patterns/command/MacroCommandTest.java @@ -23,30 +23,26 @@ public class MacroCommandTest { /** * Tests operation of aMacroCommand
.
*
- *
- * This test creates a new Notification
, adding a
+ *
This test creates a new Notification
, adding a
* MacroCommandTestVO
as the body.
* It then creates a MacroCommandTestCommand
and invokes
* its execute
method, passing in the
* Notification
.
- * The MacroCommandTestCommand
has defined an
+ *
The MacroCommandTestCommand
has defined an
* initializeMacroCommand
method, which is
* called automatically by its constructor. In this method
* the MacroCommandTestCommand
adds 2 SubCommands
* to itself, MacroCommandTestSub1Command
and
* MacroCommandTestSub2Command
.
*
- *
- * The MacroCommandTestVO
has 2 result properties,
+ *
The MacroCommandTestVO
has 2 result properties,
* one is set by MacroCommandTestSub1Command
by
* multiplying the input property by 2, and the other is set
* by MacroCommandTestSub2Command
by multiplying
* the input property by itself.
*
- *
- * Success is determined by evaluating the 2 result properties + *
Success is determined by evaluating the 2 result properties
* on the MacroCommandTestVO
that was passed to
* the MacroCommandTestCommand
on the Notification
* body.
execute
method of a SimpleCommand
.
*
- *
- * This test creates a new Notification
, adding a
+ *
This test creates a new Notification
, adding a
* SimpleCommandTestVO
as the body.
* It then creates a SimpleCommandTestCommand
and invokes
* its execute
method, passing in the note.
- * Success is determined by evaluating a property on the + *
Success is determined by evaluating a property on the * object that was passed on the Notification body, which will * be modified by the SimpleCommand
. * diff --git a/tests/org/puremvc/java/patterns/command/SimpleCommandTestCommand.java b/src/test/java/org/puremvc/java/patterns/command/SimpleCommandTestCommand.java similarity index 83% rename from tests/org/puremvc/java/patterns/command/SimpleCommandTestCommand.java rename to src/test/java/org/puremvc/java/patterns/command/SimpleCommandTestCommand.java index fce8191..fc706b0 100644 --- a/tests/org/puremvc/java/patterns/command/SimpleCommandTestCommand.java +++ b/src/test/java/org/puremvc/java/patterns/command/SimpleCommandTestCommand.java @@ -12,8 +12,8 @@ /** * A SimpleCommand subclass used by SimpleCommandTest. * - * @see org.puremvc.java.patterns.command.SimpleCommandTest SimpleCommandTest - * @see org.puremvc.java.patterns.command.SimpleCommandTestVO SimpleCommandTestVO + * @see SimpleCommandTest SimpleCommandTest + * @see SimpleCommandTestVO SimpleCommandTestVO */ public class SimpleCommandTestCommand extends SimpleCommand { diff --git a/tests/org/puremvc/java/patterns/command/SimpleCommandTestVO.java b/src/test/java/org/puremvc/java/patterns/command/SimpleCommandTestVO.java similarity index 89% rename from tests/org/puremvc/java/patterns/command/SimpleCommandTestVO.java rename to src/test/java/org/puremvc/java/patterns/command/SimpleCommandTestVO.java index a9dda26..36eb3c0 100644 --- a/tests/org/puremvc/java/patterns/command/SimpleCommandTestVO.java +++ b/src/test/java/org/puremvc/java/patterns/command/SimpleCommandTestVO.java @@ -10,7 +10,7 @@ /** * A utility class used by SimpleCommandTest. * - * @see org.puremvc.java.patterns.command.SimpleCommandTest SimpleCommandTest + * @see SimpleCommandTest SimpleCommandTest * @see org.puremvc.java.patterns.command.SimpleCommandTestCommand SimpleCommandTestCommand */ public class SimpleCommandTestVO { diff --git a/tests/org/puremvc/java/patterns/facade/FacadeTest.java b/src/test/java/org/puremvc/java/patterns/facade/FacadeTest.java similarity index 96% rename from tests/org/puremvc/java/patterns/facade/FacadeTest.java rename to src/test/java/org/puremvc/java/patterns/facade/FacadeTest.java index e71b50d..cd1446a 100644 --- a/tests/org/puremvc/java/patterns/facade/FacadeTest.java +++ b/src/test/java/org/puremvc/java/patterns/facade/FacadeTest.java @@ -39,13 +39,11 @@ public void testGetInstance() { /** * Tests Command registration and execution via the Facade. * - *- * This test gets the Singleton Facade instance + *
This test gets the Singleton Facade instance * and registers the FacadeTestCommand class * to handle 'FacadeTest' Notifcations.
* - *- * It then sends a notification using the Facade. + *
It then sends a notification using the Facade. * Success is determined by evaluating * a property on an object placed in the body of * the Notification, which will be modified by the Command.
@@ -71,13 +69,11 @@ public void testRegisterCommandAndSendNotification() { /** * Tests Command removal via the Facade. * - *- * This test gets the Singleton Facade instance + *
This test gets the Singleton Facade instance * and registers the FacadeTestCommand class * to handle 'FacadeTest' Notifcations. Then it removes the command.
* - *- * It then sends a Notification using the Facade. + *
It then sends a Notification using the Facade. * Success is determined by evaluating * a property on an object placed in the body of * the Notification, which will NOT be modified by the Command.
@@ -104,8 +100,7 @@ public void testRegisterAndRemoveCommandAndSendNotification() { /** * Tests the regsitering and retrieving Model proxies via the Facade. * - *
- * Tests registerProxy
and retrieveProxy
in the same test.
+ *
Tests registerProxy
and retrieveProxy
in the same test.
* These methods cannot currently be tested separately
* in any meaningful way other than to show that the
* methods do not throw exception when called.
- * Since the Observer encapsulates the interested object's + *
Since the Observer encapsulates the interested object's * callback information, there are no getters, only setters. * It is, in effect write-only memory.
* - *- * Therefore, the only way to test it is to set the + *
Therefore, the only way to test it is to set the * notification method and context and call the notifyObserver * method.
* @@ -35,7 +33,6 @@ public class ObserverTest { /** * Tests observer class when initialized by accessor methods. - * */ @Test public void testObserverAccessors() { @@ -60,7 +57,6 @@ public void testObserverAccessors() { /** * Tests observer class when initialized by constructor. - * */ @Test public void testObserverConstructor() { @@ -82,7 +78,6 @@ public void testObserverConstructor() { /** * Tests the compareNotifyContext method of the Observer class - * */ @Test public void testCompareNotifyContext() { diff --git a/tests/org/puremvc/java/patterns/proxy/ProxyTest.java b/src/test/java/org/puremvc/java/patterns/proxy/ProxyTest.java similarity index 97% rename from tests/org/puremvc/java/patterns/proxy/ProxyTest.java rename to src/test/java/org/puremvc/java/patterns/proxy/ProxyTest.java index 9869ba2..84e14ba 100644 --- a/tests/org/puremvc/java/patterns/proxy/ProxyTest.java +++ b/src/test/java/org/puremvc/java/patterns/proxy/ProxyTest.java @@ -14,7 +14,7 @@ * Test the PureMVC Proxy class. * * @see org.puremvc.java.interfaces.IProxy IProxy - * @see org.puremvc.java.patterns.proxy.Proxy Proxy + * @see Proxy Proxy */ public class ProxyTest {