O'Reilly logo

Professional Cairngorm™ by Jeremy Wischusen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

28.3. Event Generators

Another one of the major features of the Cairngorm Extensions is the ability to generate events via a class called the EventGenerator. This is conceptually similar to the SequenceCommand class from the Cairngorm framework (Chapters 7 and 24) in that it enables you to specify a chain of logic. However, the EventGenerator class goes beyond the capabilities of the SequenceCommand class in that it enables you to specify a sequence of events that can then be triggered in series or parallel and do not require any special implementation in the command classes.

The source code for the EventGenerator class (com.universalmind.cairngorm.events.generator) contains the following example of an EventGenerator implemented in MXML:

<generator:EventGenerator id="startUpEvents"
xmlsn:generator="com.universalmind.cairngorm.events.generator.*">
  <generator:EventGenerator trigger="sequence" result="onUserLoaded(event);" >
      <events:LoadResourcesEvent
xmlsn:events="com.mercer.mercerOnline.control.events.*" /> <events:GetLoggedInUserEvent xmlsn:events="com.mercer.mercerOnline.control.events.login.*" /> <events:LoadClassesOfBusinessEvent xmlsn:events="com.mercer.mercerOnline.control.events.questionnaire.*"/> </generator:EventGenerator> <generator:EventGenerator trigger="parallel"> <events:LoadRolesForFeaturesEvent xmlsn:events="com.mercer.mercerOnline.control.events.login.*" /> <events:LoadAssociatedUsersEvent xmlsn:events="com.mercer.common.control.events.*" /> </generator:EventGenerator> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required