EF.ObserverIntf
This unit defines the interfaces and support classes that implement a particular EF-specific flavour of the GoF Observer pattern.
This flavour introduces context strings and is designed to handle interfaces that disable reference counting, as all EF interfaces do.
IEFObserver interface
The observer interface. See GoF. This particular implementation allows for one observer to handle many subjects (and have the sender subject passed to the Update method), and manage different kinds of updates based on a context string parameter.
procedure UpdateObserver(const ASubject: IEFSubject;Called by a subject to notify this observer of an update. ASubject is the sender and AContext an optional string describing the kind of update.
IEFSubject interface
The subject interface. See GoF.
procedure AttachObserver(const AObserver: IEFObserver);Registers AObserver so that it receives this subject's notifications.
procedure DetachObserver(const AObserver: IEFObserver);Unregisters a previously attached observer.
procedure NotifyObservers(const AContext: string = '');Notifies all attached observers, passing the optional AContext string.
TEFSubjectAndObserver class
A default implementation of IEFObserver and IEFSubject. Inherit from this class whenever you need to create an observer or subject and don't have any inheritance constraint.
This class can also be embedded in order to delegate implementation to it.
procedure AfterConstruction;Creates the internal list used to track attached observers.
destructor Destroy;Frees the internal observer list and destroys the object.
procedure UpdateObserver(const ASubject: IEFSubject;Default (empty) observer handler. Override to react to notifications when this object is used as an observer.
procedure AttachObserver(const AObserver: IEFObserver);Registers AObserver (once) so that it receives this subject's notifications.
procedure DetachObserver(const AObserver: IEFObserver);Unregisters a previously attached observer.
procedure NotifyObservers(const AContext: string = '');Notifies all attached observers on behalf of this subject, passing the optional AContext string.
procedure NotifyObserversOnBehalfOf(const ASubject: IEFSubject;Notifies all attached observers on behalf of ASubject, allowing this object to forward notifications for another subject it embeds.
