Developping a contact manager application (CManager) – Part 1

Creating the View

To create a view, we add a MXML file using one of the available AS Foundry framework types (CanvasView, HBoxView, VBoxView…) as the top-level tag. Application consists in a view with several « State » (MainView.mxml) :

  • BASE_VIEW_STATE to allow for contact consulting and editing
  • ADD_CONTACT_VIEW_STATE to allow for contact adding.

We won’t dwell on the view’s source code, as it doesn’t contain anything but graphic component (its source code is supplied in the view’s package). We will focus on the ViewHelper which allows our view to interact with the rest of the application.


Using MXML files to describe your application views is not recommended. Even if it may sometimes appear easier on first sight, in most of cases the resulting source code will be confusing and hard to maintain. The AS Foundry framework offers separation between formatting and view-logic code. Each view is associated with a ViewHelper, which contains :

  • the view-logic
  • the calls to the controller
  • the events
  • the model-triggered notifications’ handling and data-binding

This way, the view can be depicted with MXML tags. The view-logic separation allows for easier code maintenance, reusability or extensibility. We create the MainViewHelper class which contains a binding to the contacts’ list. As an IObserver implementor, our ViewHelper can register to the ContactModel and be notified by overriding the update method.

View and ViewHelper as the View participant of the MVC paradigm.

View and ViewHelper as the View participant of the MVC paradigm.

${JAVA_HOME} = C:\Program Files\Java\jdk1.5.0_17

Please verify your imports.

Adding the view to the application

Before adding the view to the application, we must link it to its « helper ». We simply have to add this tag to the MXML code :

Path= ... ;%JAVA_HOME%\bin

We then add the view to our application, for example by setting it inside a « ViewStack » :

${CATALINA_HOME} = D:\Softs\apache-tomcat-6.0.16

Please verify your imports.

Page 1 Page 2 Page 3

Friday, April 24th, 2009 No Comments by Jeff Mathiot