Dr. Dobb's Journal - August 2008 - (Page 43) To wire all of these MXML components together, Task List uses ActionScript 3.0 functions within Tasks.mxml that act as event handlers. These event handlers define what actions are taken when users indicate task completion or click the “OK” button to add a new task. They also handle real-time task updates received from the server; see Listing Five. With event handlers in place, the client-side Flex application is ready to be used. Creating the ColdFusion Service Layer A Flex RIA is the client-side component of the application. It only runs within the browser, requiring a server-side component for interaction with databases and message queues. For the Task List application, the service layer is provided by ColdFusion running within a local JBoss environment. To create the ColdFusion infrastructure, I downloaded and installed the free developer edition of ColdFusion 8 from the Adobe website, selecting a JEE-style installation that results in a WAR file. After expanding the WAR into a directory structure, I copied it to my JBoss server’s deployment directory, using a context-root of /tasks. Visiting http:// localhost:8080/tasks/CFIDE/administrator completed my installation and displayed the ColdFusion management application. While I could have used PHP, .NET, or other server-side technologies, I chose ColdFusion because it makes real-time messaging straightforward. When you’re in the management application, you’re ready to perform the single-step process of configuring the real-time messaging infrastructure. This consists of creating an “Event Gateway,” providing a conduit from ColdFusion to an external system such as the Flex messaging infrastructure. Task List uses a gateway instance named taskGateway that lets ColdFusion code send real-time messages to the Flex application via the configuredby-convention ColdFusionGateway destination. The point-and-click UI in the ColdFusion administrator lets you create this real-time messaging bus without having to find and install dependency JARs, edit XML files, or deal with other complicated configuration chores. Just as with the front end, designing the back end begins with the construction of a Task model. Next, you design an interface and implementation of a Data Access Object for persisting and recalling Tasks. Finally, you develop a simple Façade pattern implementation exposing coarse-grained functions such as listTasks() and saveTask() to your Flex application. CFEclipse provides an ideal development environment for writing ColdFusionpowered Flex applications. Because it is an Eclipse plug-in, CFEclipse acts as an add-on to Flex Builder 3, letting you work in a single IDE as you work with both the server and client sides of Task List. With CFEclipse installed, you’re ready to edit CFML files. Like Flex Builder 3, CFEclipse provides a wizard for creating new projects. The serverside code for Task List is contained in {JBoss root}/tass.war/com/firemoss/tasks. Because ColdFusion uses the filesystem for its packaging scheme, instructing the wizard to create a new package in this directory creates a com.firemoss.tasks package. Inside this package there is a ColdFusion component (the ColdFusion version of a class or object) named Task.cfc. This model of a task (Listing Six) is visible to the ColdFusion class loader as com.firemoss.tasks.model.Task. Because this is equivalent to the RemoteClass alias to which you earlier pointed your ActionScript 3.0 Task, any ActionScript 3.0 Task instances sent to ColdFusion are automatically turned Listing One package com.firemoss.tasks.model { import mx.utils.UIDUtil; // Alias'd to server-side class / component [RemoteClass(alias="com.firemoss.tasks.model.Task")] // Bindable makes this class a subject for data binding [Bindable] /** Model of a Task. */ public class Task { /** Unique Id. */ public var id:String = UIDUtil.createUID(); /** Name of the task. */ public var task:String; /** Is the task complete? */ public var complete:Boolean; } } Listing Two Listing Three August 2008 l www.ddj.com l Dr. Dobb’s Journal 43 http://www.ddj.com
Table of Contents Feed for the Digital Edition of Dr. Dobb's Journal - August 2008 Dr. Dobb's Journal - August 2008 Contents Friday Night Fish Fry Alia Vox Developer Diaries Developer’s Notebook A Conversation with Christos Papadimitriou OpenGL and Mobile Devices: Round 2 Ellipse Specification Using Vectors Embed Custom GUIs in WPF Building RIAs on J2EE Foundations Disentangling Concepts in Object-Oriented Systems The Agile Edge Effective Concurrency Swaine’s Flames Dr. Dobb's Journal - August 2008 Dr. Dobb's Journal - August 2008 - Dr. Dobb's Journal - August 2008 (Page Cover1) Dr. Dobb's Journal - August 2008 - Dr. Dobb's Journal - August 2008 (Page Cover2) Dr. Dobb's Journal - August 2008 - Dr. Dobb's Journal - August 2008 (Page 1) Dr. Dobb's Journal - August 2008 - Dr. Dobb's Journal - August 2008 (Page 2) Dr. Dobb's Journal - August 2008 - Dr. Dobb's Journal - August 2008 (Page 3) Dr. Dobb's Journal - August 2008 - Contents (Page 4) Dr. Dobb's Journal - August 2008 - Contents (Page 5) Dr. Dobb's Journal - August 2008 - Friday Night Fish Fry (Page 6) Dr. Dobb's Journal - August 2008 - Friday Night Fish Fry (Page 7) Dr. Dobb's Journal - August 2008 - Friday Night Fish Fry (Page 8) Dr. Dobb's Journal - August 2008 - Friday Night Fish Fry (Page 9) Dr. Dobb's Journal - August 2008 - Alia Vox (Page 10) Dr. Dobb's Journal - August 2008 - Alia Vox (Page 11) Dr. Dobb's Journal - August 2008 - Developer Diaries (Page 12) Dr. Dobb's Journal - August 2008 - Developer Diaries (Page 13) Dr. Dobb's Journal - August 2008 - Developer’s Notebook (Page 14) Dr. Dobb's Journal - August 2008 - Developer’s Notebook (Page 15) Dr. Dobb's Journal - August 2008 - A Conversation with Christos Papadimitriou (Page 16) Dr. Dobb's Journal - August 2008 - A Conversation with Christos Papadimitriou (Page 17) Dr. Dobb's Journal - August 2008 - A Conversation with Christos Papadimitriou (Page 18) Dr. Dobb's Journal - August 2008 - A Conversation with Christos Papadimitriou (Page 19) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 20) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 21) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 22) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 23) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 24) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 25) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 26) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 27) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 28) Dr. Dobb's Journal - August 2008 - OpenGL and Mobile Devices: Round 2 (Page 29) Dr. Dobb's Journal - August 2008 - Ellipse Specification Using Vectors (Page 30) Dr. Dobb's Journal - August 2008 - Ellipse Specification Using Vectors (Page 31) Dr. Dobb's Journal - August 2008 - Ellipse Specification Using Vectors (Page 32) Dr. Dobb's Journal - August 2008 - Ellipse Specification Using Vectors (Page 33) Dr. Dobb's Journal - August 2008 - Ellipse Specification Using Vectors (Page 34) Dr. Dobb's Journal - August 2008 - Ellipse Specification Using Vectors (Page 35) Dr. Dobb's Journal - August 2008 - Embed Custom GUIs in WPF (Page 36) Dr. Dobb's Journal - August 2008 - Embed Custom GUIs in WPF (Page 37) Dr. Dobb's Journal - August 2008 - Embed Custom GUIs in WPF (Page 38) Dr. Dobb's Journal - August 2008 - Embed Custom GUIs in WPF (Page 39) Dr. Dobb's Journal - August 2008 - Building RIAs on J2EE Foundations (Page 40) Dr. Dobb's Journal - August 2008 - Building RIAs on J2EE Foundations (Page 41) Dr. Dobb's Journal - August 2008 - Building RIAs on J2EE Foundations (Page 42) Dr. Dobb's Journal - August 2008 - Building RIAs on J2EE Foundations (Page 43) Dr. Dobb's Journal - August 2008 - Building RIAs on J2EE Foundations (Page 44) Dr. Dobb's Journal - August 2008 - Building RIAs on J2EE Foundations (Page 45) Dr. Dobb's Journal - August 2008 - Disentangling Concepts in Object-Oriented Systems (Page 46) Dr. Dobb's Journal - August 2008 - Disentangling Concepts in Object-Oriented Systems (Page 47) Dr. Dobb's Journal - August 2008 - Disentangling Concepts in Object-Oriented Systems (Page 48) Dr. Dobb's Journal - August 2008 - Disentangling Concepts in Object-Oriented Systems (Page 49) Dr. Dobb's Journal - August 2008 - The Agile Edge (Page 50) Dr. Dobb's Journal - August 2008 - The Agile Edge (Page 51) Dr. Dobb's Journal - August 2008 - The Agile Edge (Page 52) Dr. Dobb's Journal - August 2008 - Effective Concurrency (Page 53) Dr. Dobb's Journal - August 2008 - Effective Concurrency (Page 54) Dr. Dobb's Journal - August 2008 - Effective Concurrency (Page 55) Dr. Dobb's Journal - August 2008 - Swaine’s Flames (Page 56) Dr. Dobb's Journal - August 2008 - Swaine’s Flames (Page Cover3) Dr. Dobb's Journal - August 2008 - Swaine’s Flames (Page Cover4)
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.