Flash_and_Flex_03_2009

Flex Application Architecture

View The View is one or more Flex components such as a button, panel, data grid, combo box, etc. all bundled together as one component. This is what the user will see when using the application, data that is displayed is bound to the Model Locator or other Bindable variables that essential get bound to the model, views also generate events, Cairngorm Events.

If the values match, then the command sets the workflowState variable inside of the model to the static variable located also inside the model, thus changing the view of the application. Controller The Controller is the most sophisticated part of the Cairngorm architecture. The Controller layer is implemented as a singleton FrontController. The FrontController instance, which receives every View-generated event, dispatches the events to the assigned Command class based on the event's declared type. The FrontController is a central placewhere all the commands aremapped to the relevant events. Once an event is dispatched, the Front Controller finds the corresponding command to execute.

• Identify – Front Controller: • Catches dispatched

events and forwards each event to the appropriate Command for processing

• Views dispatch events to this layer • All commands and events are registered with the controller • Create FlexContactsController.as . see (Listing 8). • Discuss – Front Controller: In the Front Controllers constructor it is calling on the initialize method that is handling all of the registering events to commands, this is accomplished by using the addCommand() method inherited from the Cairngorm controller to link events and corresponding commands.

• Identify:

The view of the application is what the user will interact with, you as the programmer need to understand some of the gestures a user might use to.

Listing 10. ContactsList.mxml

height="100%" width="100%" creationComplete="getContacts()" styleName="padding" xmlns:mx="http://www.adobe.com/2006/mxml">

]]>

dataProvider="{ model.contactsCollection }">

}

03/2009 (5)

59

Made with FlippingBook HTML5