You use the IBM notification framework to implement event and
attribute notification for visual and nonvisual parts. You can
also use it in code you are writing by hand if the code is based
on the IBM Open Class Library.
The notification framework is different from the previously
existing event-handler framework. Handlers can block the
dispatching of events to the remaining handlers in the chain.
This is unsatisfactory for a notification framework, where
registered observer objects must always be notified of an event
regardless of how the event was handled.
The notification framework contains the following entities:
- Notifiers, which broadcast changes in their internal
state. Notifier instances support a protocol defined by
the INotifier class.
- Observers, which register themselves as dependent upon
the occurrence of a specific change in state. Observer
instances support a protocol defined by the IObserver
class.
- Events, which identify what state has changed in which
notifier instance. Event instances support a protocol
defined by the INotificationEvent class. An event
instance can also contain the new value of the state that
was changed (event data).
- Notification IDs, static strings in a notifier's
interface that specify which events are supported by the
notifier class. Each notification ID is in the form of
the notifier-class name followed by the event name, such
as IStaticText::backgroundColorId.
- Interests, which act as common currency among notifier,
observer, and event instances. An instance of the
IInterest class, each interest associates a notifier
instance with a notification ID. This pairing uniquely
identifies an event so that only interested observers
respond to the event signaled.
Notifiers and Observers
About Implementing Notification