type Observer
source code
object --+
|
interfaces.IObserver --+
|
Observer
A base IObserver
implementation.
An Observer
is an object that encapsulates information
about an interested object with a method that should be called when a
particular INotification
is broadcast.
In PureMVC, the Observer
class assumes these
responsibilities:
Encapsulate the notification (callback) method of the interested
object.
Encapsulate the notification context (this) of the interested
object.
Provide methods for setting the notification method and context.
Provide a method for notifying the interested object.
|
notify = None
|
|
context = None
|
__init__(self,
notifyMethod,
notifyContext)
(Constructor)
| source code
|
Constructor.
The notification method on the interested object should take one
parameter of type INotification
- Parameters:
notifyMethod - the notification method of the interested object
notifyContext - the notification context of the interested object
- Overrides:
object.__init__
|
Set the notification method.
The notification method should take one parameter of type
INotification .
- Parameters:
notifyMethod - the notification (callback) method of the interested object.
- Overrides:
interfaces.IObserver.setNotifyMethod
|
Get the notification method.
- Returns:
- the notification (callback) method of the interested object.
|
Get the notification context.
- Returns:
- the notification context (
this ) of the interested
object.
|
Notify the interested object.
- Parameters:
notification - the INotification to pass to the interested object's
notification method.
- Overrides:
interfaces.IObserver.notifyObserver
|
Compare an object to the notification context.
- Parameters:
obj - the object to compare
- Returns:
- boolean indicating if the object and the notification context are
the same
- Overrides:
interfaces.IObserver.compareNotifyContext
|