Datasheet

Chapter 1: Introducing Cairngorm
8
A view (or in some cases some other event, such as the loading of the application) dispatches a
Cairngorm event. When this occurs, the FrontController intercepts the event and triggers the command
class registered for that event. At this point the command class can do one of several things.
If no communication with the backend is required, the command may simply update the ModelLocator,
causing the views to be updated via data binding.
If delegate classes are being used, a function on the delegate class will be called to perform actions on the
backend via a remoting class found in the ServiceLocator. In this case the command acts as a responder
to the remote call by registering itself with the delegate class. When the delegate function completes its
call, the command class is passed the status of the call and any data returned from it via responder
functions.
If the command class is directly calling the remote service, it performs the lookup on the ServiceLocator
class and directly registers itself as a responder on the remote service. Once again, the results of the call
are handled via responder functions defined in the command class.
CairngormEvent
dispatched
Delegate
locates service
SeviceLocator returns
service
Delegate
calls service
Backend
returns result
FrontController finds command
class and calls execute function
Yes
Command executes
Command
updates ModelLocator
ModelLocator
updates views via data
binding
Views updated
Accesses
remote
data?
Figure 1 - 1
c01.indd 8c01.indd 8 10/20/09 12:26:42 PM10/20/09 12:26:42 PM