A simple contact manager — a Flex-Cairngorm application

I finally got around to blogging a simple Cairngorm application that I had written a few months back just after completing my Flex Trainers’ training.

The application is a simple contact manager that allows for contacts to be listed, added, edited and searched. The backend uses ColdFusion to store information in memory. For the sake of simplicity of this application, I have deliberately not used a database and used session variables instead.

I wrote this app to get my head around key Cairngorm concepts. I found this really helped to understand the basics of the framework. This application uses Cairngorm 2.0.

If you are new to Cairngorm, have a look at cairngormdocs.org, especially the Cairngorm diagram.

To use this application you need Flex Builder 2 and ColdFusionMX 7.0.2.

Installation instructions:

  1. Unzip CFCairngormContacts.zip in the webroot of your ColdFusion server. This will create two folders:
    • CFCairngormContacts (containing the Flex code for the application and Cairngorm 2.0 SWC)
    • com (which contains ColdFusion code)
  2. Check ColdFusion backend by browsing to: http://yourserver/com/nagpals/examples/contact/index.cfm.If you see a couple of dumps and a message saying “Successfully retrieved contact list”, ColdFusion is setup correctly.If not, then you need to make sure this works first.
  3. Set up the app in Flex Builder.
    1. Create a new Flex project in Flex Builder.
    2. Select “ColdFusion Flash Remoting Service”
    3. Specify Root Folder as the the filesystem path to the ColdFusion server webroot.
      In my case: D:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\
    4. Specify Root URL as the URL to the ColdFusion server.
      In my case: http://localhost:8300/
    5. Specify Project Name: CFCairngormContacts
    6. For Project Contents, uncheck the “Use default location” and select the location as the filesystem path to the ColdFusion server webroot.
      In my case: D:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\
    7. Add a SWC to the project by going to Project > Properties > Flex Build Path > Library Path (tab) > Add SWC.
      Select the Cairngorm.swc in /CFCairngormContacts/com/adobe/cairngorm directory.
    8. Also make sure that the Flex Compiler arguments are setup to look at the correct services-config.xml. Project > Properties > Flex Compiler. The arguments are specified in the “Additional compiler arguments” field. In my case they read: -services “D:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\flex\services-config.xml” -locale en_US
    9. Run the application and you should see the Contact Manager load up in a browser.

TODO:

  • Add a running version of the application (my current host is not running CF 7.0.2)
  • Migrate it to Cairngorm 2.1
  • Add more information on how the application is structured

Do let me know if you get any issues in getting the app to run.
PS: The UI of the application is based on a similar application created by Robin Hilliard @ Rocketboots using Flex 1.5.

Completed Flex 2.0 Training Course

So, last week I completed the Flex 2.0 course for trainers. The course was held in Sydney, at the Adobe office in Chatswood. Spread over 5 days, the training comprised of two courses run consecutively. The first course, Flex 2: Developing Rich Client Applications, was spread over the first 3 days. The last two days covered Flex 2: Data and Communcations.

It was good to go over all the basics in the first 3 days. Even though most of the trainees of the course were fairly comfortable with a lot of the concepts in Flex, all felt that that it was good to put all the various concepts together. The labs at the end of the day were very well thought out and consolidated the concepts and learnings.I am a trainer for ColdFusion and ShadoCMS (a content management system written in ColdFusion). I often encounter a sense of wonder — the “oooh” feeling — that the trainees feel when they are able accomplish seemingly complex tasks with little effort. The second course, Flex 2: Data and Communications, had a lot of “oooh” moments for everyone, including me.

It covered areas like web services, remote objects (CFCs and Java), data validation and working with complex data (ArrayCollectiosn). A significant time was spent on more exciting areas like, Flex Data Services, Flex Message Service, Flex Data Management Service, and E4X. And all this generated a lot of ooohs. The ease with which one can architect apps with real-time chat and collaboration between different users is quite amazing. And so was the relative simplicity by which one can synchronize data between a Flex client and a web application’s data tier.

Robin Hilliard (of Rocketboots) was the instructor. And usual, he made the course very interesting by providing lots of real-life examples of concepts and his distinct sense of humor! Some of us were familiar with the basic concepts of Cairngorm 2. But we wanted to work on a simple Cairngorm 2 app. For those of you who don’t know, Robin is Cairngorm king down under. So he took out some extra time during lunch and evenings and we started building a simple contact manager using Cairngorm. (Rocketboots had built a simple contact manager in Flex 1.5.) Although there wasn’t enough time finish the app during the training, I’ve been working on it over the past few days and am almost through. I’ll post here in the next few days.

For me, the consolidation of all the Flex 2.0 concepts, the introduction to the data and communication capabilities flex, and working on a Cairngorm app made the training very useful.