Articles Comments

Flex Certification » Flex Frameworks » Flex MVC & Views in Cairngorm

Flex MVC & Views in Cairngorm


VIEWS:
Views are visual representation of the application.  They should typically only represent the application layout and should not contain any code, except for referencing the data model and data binding elements.  Control events should call method on presentation model that will dispatch corresponding Cairngorm event and call corresponding command.

View Locator and View:

View Locator and View Helper are used to isolate command classes from the implementation details of a view.

Model-View-Controller (MVC) best practices specify that command classes should interact with the view using the model (see the ModelLocator class), but, in some instances, command classes may require to both interrogate and update the view directly.  Prior to performing any business logic, the command class may require to fetch values that have been set on the view; following completion of any business logic, the final task may be for a command class to update the View (user interface) with any results returned, or perhaps to switch the View entirely (to a different screen).

By encapsulating all the logic necessary for interrogating and

updating a particular View into a single helper class, we remove

the need for the command classes to have any knowledge about the

implementation of the View.  The ViewHelper class decouples our

presentation from the control of the application.
A ViewHelper belongs to a particular View in the application; whena ViewHelper is created, its id is used to register against a particular View component (such as a particular tab in a TabNavigator, or a particular screen in a ViewStack).  The developer then uses the ViewLocator to locate the particular ViewHelper for interrogation or update of a particular View.

Written by admin

Filed under: Flex Frameworks

Leave a Reply

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>