10.2. Summary
In this chapter you examined how the pieces of Cairngorm work together by examining a simple login application. The basic Cairngorm logic flow and corresponding classes from the sample application can be seen in the table below:
Cairngorm Logic Flow | Sample Application Class(es) | Triggered By |
---|---|---|
Cairngorm event is broadcast. | LoginEvent, LoginForm view | The user clicks the Login button. |
The FrontController intercepts the event, locates the corresponding command, and triggers the execute function. | LoginControl | The Cairngorm event is dispatched. |
The command class decides how to handle the event. This may be by simply updating the ModelLocator, or by calling a remote service, perhaps using a delegate. | LoginCommand | The FrontController finds a command class for the event and calls the execute function. |
If a delegate is being used, it contacts the service and registers a responder. | LoginDelegate | Implemented by a command class that calls the desired function. |
The command class updates the ModelLocator with any data from the remote service, or updates it based on the success of the remote service call. | LoginCommand | The responder functions are triggered when the remote call has completed. |
The ModelLocator notifies views of changes via data binding. | CairngormLoginModel | Data binding triggers updating of views. |
Get Professional Cairngorm™ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.