- Object Interactions
- Object Interaction Scenario in IT Management
- Example of a Mediator
- Mediator Base Class
- Mediator Subclass
- Widget Class
- Two Widget Subclasses
- LspDirector Implementation
- Widget Class Implementation
- PathWidget Class Implementation
- Putting It All Together
- Conclusion
- Additional Reading
Widget Class
Listing 4 illustrates the Widget base class. Notice that this class is very clean and generic just as was the case for ConnectionDirector.
Listing 4 Widget Base Class
class Widget { public: explicit Widget(ConnectionDirector*); virtual void Changed(); protected: ConnectionDirector* _director; };
Each widget contains a pointer to its director (or mediator), which is what enables it to inform the director (or mediator) of changes to the widget. Because we have two widget subclasses (for paths and QoS entities), let’s now see how to subclass the Widget.