Package puremvc :: Module core :: Class Model
[hide private]
[frames] | no frames]

type Model

source code

           object --+
                    |
interfaces.IModel --+
                    |
                   Model

A Singleton IModel implementation.

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

The Model assumes these responsibilities:

Maintain a cache of IProxy instances.

Provide methods for registering, retrieving, and removing IProxy instances.

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


See Also:
Proxy, IProxy
Instance Methods [hide private]
 
initializeModel(self)
Initialize the Singleton Model instance.
source code
 
registerProxy(self, proxy)
Register an IProxy with the Model.
source code
 
retrieveProxy(self, proxyName)
Retrieve an IProxy from the Model.
source code
 
hasProxy(self, proxyName)
Check if a Proxy is registered
source code
 
removeProxy(self, proxyName)
Remove an IProxy from the Model.
source code
Static Methods [hide private]
 
__new__(cls, *args, **kwargs)
This IModel implementation is a Singleton, so you should not call the constructor directly, but instead call the static Singleton method Model.getInstance()
source code
 
getInstance()
Model Singleton Static method.
source code
Class Variables [hide private]
  instance = None
  proxyMap = None
Method Details [hide private]

__new__(cls, *args, **kwargs)
Static Method

source code 

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

Overrides: object.__new__

getInstance()
Static Method

source code 

Model Singleton Static method.

Returns:
the Singleton instance of Model

initializeModel(self)

source code 

Initialize the Singleton Model instance.

Called automatically by the constructor.

registerProxy(self, proxy)

source code 

Register an IProxy with the Model.

Parameters:
  • proxy - an IProxy to be held by the Model.
Overrides: interfaces.IModel.registerProxy

retrieveProxy(self, proxyName)

source code 

Retrieve an IProxy from the Model.

Parameters:
  • proxyName - the name of the IProxy
Returns:
the IProxy instance previously registered with the given proxyName.
Overrides: interfaces.IModel.retrieveProxy

hasProxy(self, proxyName)

source code 

Check if a Proxy is registered

Parameters:
  • proxyName - the name of the IProxy
Returns:
whether a Proxy is currently registered with the given proxyName.
Overrides: interfaces.IModel.hasProxy

removeProxy(self, proxyName)

source code 

Remove an IProxy from the Model.

Parameters:
  • proxyName - name of the IProxy instance to be removed.
Returns:
the IProxy that was removed from the Model
Overrides: interfaces.IModel.removeProxy