Flex with java

September 19, 2008
Adobe Flex With Java
Overview
Anatole Tartakovsky interview :: Answering Tough Questions About Enterprise Development
Bruce Eckel :: Hybridizing Java
Christophe Coenraets :: Building database-driven Flex applications without writing (Client- or server-side) code :: Introduces a SimpleJDBCAssembler FDMS adapter
Christophe Coenraets :: Flex Test Drive Server for Java Developers (Tomcat-based)
Daniel Harfleet :: Calling Java remote objects and handling results
Daniel Harfleet :: Passing complex parameters and results
Jeff Vroom :: Architecting RIAs with Flex Data Management Services
Yakov Fain :: Yakov’s Gas Station – introducing Flex
Automated Code Generation
Farata Systems :: daoFlex :: Automated generation of Java, ActionScript, MXML, & Config file code
XDoclet2 :: Automatically generate ActionScript classes (and much more) based on Java classes
Debugging
Apache :: Tomcat FAQ: Development :: How to do remote debugging with Eclipse & Tomcat
Daniel Harfleet :: Debugging Flex and Java at the same time
James Ward :: Debug Flex & Java Together in Flex Builder 2
Peter Martin :: FDS Plugin for Eclipse Web Tools Platform (FDS) :: Debug Flex and FDS Java in the same project on Tomcat and other non-JRun servlet containers :: More info
EJBs
Marco Casario :: How to install and develop using Flex 2 (FDS) and EJB3 projects :: Part 1
Hibernate
James Brundege :: Don’t Let Hibernate Steal Your Identity :: And some (rather critical) comments
Marcel Boucher :: My First Hibernate Enabled Flex Application :: Part 1 :: Part 2
Victor Rubba :: Default generator class in Hibernate Code Generator
Victor Rubba :: Flex Data Services – CRM Sample using Hibernate
Victor Rubba :: How to keep db connections alive in FDS/Hibernate
Victor Rubba :: Many-to-Many using FDS & Hibernate
Victor Rubba :: Pointing Hibernate to MySQL
Victor Rubba :: Why Hibernate with Flex Data Services 2?
JBoss
Daniel Harfleet :: Debugging Flex and Java at the same time
Daniel Harfleet :: Installing Flex Data Services on JBoss
Daniel Harfleet :: Java Development in Flex Builder
Jove Shi :: Use Flex Message Service with JBoss
Marco Casario :: How to install and develop using Flex 2 (FDS) and EJB3 projects :: Part 1
Victor Rubba :: Installing FDS with JBoss and IIS
JMS
Christophe Coenraets :: Flex and JMS: Portfolio Viewer :: More info
Jove Shi :: Use Flex Message Service with JBoss
JRun
Jared Rypka-Hauer :: Get Flex to Use the JRun Logs
JSP
Adobe :: Flex 2 Tag Library for JSP
Mapping
Mansour Raad :: Making Great Mapping Mashups Using Adobe Flex
Spring
Christophe Coenraets :: Using Flex With Spring :: Includes 3 examples with source code
Tomcat
Adobe :: Tomcat-Specific FDS Install Instructions
Christophe Coenraets :: Flex Test Drive Server for Java Developers (Tomcat-based)
Daniel Harfleet :: Flex Messaging in Tomcat
Douglas McCarroll :: Setting Up A Windows Apache/Tomcat/FDS Server
llin :: Using FDS 2 with Tomcat
Marco Casario :: Flex 2 applications deployed under J2EE: Tomcat vs WebLogic
Peter Martin :: FDS Plugin for Eclipse Web Tools Platform :: Version 2 Beta :: Debug Flex and FDS Java in the same project on Tomcat and other non-JRun servlet containers
WebSphere
Peter Martin :: Deploying Flex on WebSphere Application Server

flex help

November 24, 2008

container topicFlex Programming Elements

Protected: Flex Examples

October 30, 2008

This content is password protected. To view it please enter your password below:

Flex Explorers

October 25, 2008

 

Flex Style Explorer
Flex Style Creator
Easing Effects Explorer
Flex Filter Explorer
Color Explorer
Charting Components Explorer
Flex Chart Explorer
Adobe Flex 2 Component Explorer
Adobe Flex 3 Component Explorer
Flex Samples Explorer
Flex 2.0 Samples Explorer
Cairngorm Diagram Explorer
Flex Primitive Explorer
Flex Enhanced Button Skin Explorer
Flex Text Effects Explorer
Reflection Explorer
Distortion Effects Explorer
FlexBox

Resize Manager
Flex Games
Flex Sports Clothing Uniform
Random Walk
Flex Super Panel
DataGrid Row Color
Chart Range Selection Component
Dual Slider
Advance Form
Drag Tile
Word Information
FlexLib Component List
Flex Samples
Flex Samples
Flex Applications
Scrawl Example
Display Shelf
Rating Component

flex comp

October 25, 2008
Adobe Flex :: Rich Internet Applications
Adobe ::
2007 Amgen Tour of California TourTracker 2.0 :: More info
Adobe ::
Dashboard :: Sales data analysis :: More info
Adobe ::
FlexStore :: More info
Adobe ::
Hybrid Store :: Flex working with HTML :: More info
Adobe ::
Photo Viewer :: More info
Adobe ::
Restaurant Finder :: More info
Fauxto :: Photoshop-like image editor
Alex Styler ::
Flex, Yahoo! Maps & RSS Feeds :: See the day’s earthquakes, and more!
Amit Gupta ::
E41ST :: Amazon/Library mashup :: More info
Andrew Muller ::
Video Show & Snapp App :: More info
Andrew Trice ::
Census Data Mashup :: More info
Andrew Wason ::
MotionBox :: Video sharing
Ben Robinson ::
CFMonitor
Bill Brittain ::
Is2 Quickbooks Web Client :: More info
Christophe Coenraets ::
Flex and JMS: Portfolio Viewer :: More info
Christophe Coenraets ::
Google Maps Collaboration using Flex, Flash Media Server and AJAX
Coker Isaac, James Mark, William Ukoh :: Premeet Collaborative Portal :: An interactive RIA developed to foster collaboration and break-the-ice between conference attendees before the actual physical meeting
Daniel Hai ::
Onyx :: Video Mixer :: More info
DAD.be ::
Belgecom TV
Darin Kohles ::
Diamond Selector
Darron Schall ::
Just Freakin’ Cool :: Commodore 64 emulator
David Brannan ::
Exam Professor
Digital Positions ::
Mednikow.com :: Online jewelery store :: More info
Ely Greenfield ::
Flickr Roulette :: More info
Erik Loehfelm ::
Haworth Product Catalog
EyeJot ::
Video Messaging Service :: More info
Fairfax Business Media ::
AFR Access :: Investment tool for Australian Financial Review
Fidelity ::
Trading Knowledge Center :: More info
Flip.com :: A social networking site that allows users to create “personal pages where you can post pictures, upload video or audio and even draw or write stuff”
FTDG & StarNetSys ::
Dow Jones Averages Interactive Learning Center
Gary Gilbert ::
Photo Album
Graham Weldon ::
Weather Information Service :: More info
Hilary Bridel ::
Australian Weather Observations :: More info
in2M ::
Mvelopes :: Personal budgeting
James Ward ::
Flex Paint
Joe Berkovitz ::
ReviewTube :: YouTube videos with time-bases captions – “a graffiti wall for YouTube” :: More info :: Source code
Joh. Enschedé ::
Amsterdam Airport Noise Monitoring System :: More info
John Grden ::
Xray Flash Debugger :: Start this test swf 1st :: More info
Josh Tynjala ::
MXNA Dashboard :: More info
Kevin Ewoldt ::
Quik-Schema Data Modeler
Kevin Kazmierczak ::
SQLAdmin :: Open source on SourceForge
Laura Arguella ::
ToDo List :: More info
Matthew Bergsma ::
FlexPM :: Project management :: More info
MediaCatalyst :: Sony Ericsson :: Phone Store
Mindomo ::
Mind Mapping
Mingjie Zhu ::
Jawbreaker Game
Nahuel Forenda :: HomeLocator :: More info
Nationwide ::
Savings & Investment Navigator
Renaun Erickson ::
Flex Search Mashup :: More info
Richard Brownell ::
A Short RPG Adventure
Rick Englert ::
PicFindr :: Find copyleft picts :: More info
ScrapBlog
Simon Barber :: MXNA Viewer
Stanley Marrder ::
Xotel Frontdest :: Hotel reservation app
Ted Patrick ::
TagTV :: Dev time = 8 hours
Thomas Gonzalez ::
BrightPoint Dashboard :: Sales & profit analysis :: More info
Tim McLeod & Kevin Harris ::
Lesson Builder :: More info
Tim Scollick ::
Flickr / YouTube Tag Search
Tony Kirman ::
I-Ching
Trenitalia ::
Real-Time Italian Train Info
Yahoo :: Yahoo Maps
Zilun Gong :: Country Finder

Flex Favourites

October 25, 2008
Ready Skinned Flex Components:
Scalenine
Flex Examples:
Flex Examples
Flex Styles
Adobe :: Style Explorer

Compilations
Flex.org’s Showcase Page
Favourites

· Adobe :: Dashboard :: Sales data analysis :: More info :: Note that this RIA is a collaborative application (many users, any user can make choices, all users see results) but Adobe has disabled this functionality for this demo
· Adobe :: FlexStore :: More info
· Amit Gupta :: E41ST :: Amazon/Library mashup :: More info
· Christophe Coenraets :: Flex and JMS: Portfolio Viewer :: More info
· Christophe Coenraets :: Google Maps Collaboration using Flex, Flash Media Server and Ajax
· David Brannan :: Exam Professor
· Ely Greenfield :: FishEye Component :: More info
· Ely Greenfield :: Interactive Bubble Chart :: More info
· EyeJot :: Video Messaging Service :: More info
· Fidelity :: Trading Knowledge Center :: More info
· Flip.com :: A social networking site that allows users to create “personal pages where you can post pictures, upload video or audio and even draw or write stuff”
· FTDG & StarNetSys :: Dow Jones Averages Interactive Learning Center
· Joe Berkovitz :: ReviewTube :: YouTube videos with time-bases captions – “a graffiti wall for YouTube” :: More info :: Source code
· Joh. Enschedé :: Amsterdam Airport Noise Monitoring System :: More info
· Kevin Kazmierczak :: SQLAdmin :: Open source on SourceForge
· MediaCatalyst :: Sony Ericsson :: Phone Store
· Mindomo :: Mind Mapping
· Nahuel Forenda :: HomeLocator :: More info
· Nationwide :: Savings & Investment Navigator
· Rick Englert :: PicFindr :: Find copyleft picts :: More info
· ScrapBlog
· Trenitalia :: Real-Time Italian Train Info
· Yahoo :: Web-based IM App
· Yahoo :: Yahoo Maps

Flex Coding

October 25, 2008
FLEX CODING
APIs
AS3 Library For Amazon’s S3 Service
Digg :: Flash toolkit
Ebay
Flickr
Google Analytics PHP API
Google Gears :: Also, see the Google Gears section below
Mappr
MapQuest
ODEO
Yahoo Answers
Yahoo Mail
Yahoo Maps
Yahoo Search
Yahoo Weather
YouTube
Architecture
Cliff Hall :: PureMVC
Joe Berkovitz :: An architectural blueprint for Flex applications
Sean Levy :: Complete component communication solution for Flex :: Using ALON (Autonomous Linking Object Network Design Pattern)
Automated Code Generation
See the Automated Code Generation section on our Testing, Debugging & Agile Methods page.
Binding
Daniel Rinehart :: Programmatic Bindings
Bugs
Ralph Hauwert :: Autocomplete component memory leak
Charting Components
Adobe :: Chart data drill down examples
Doug McCune :: Why I LOVE Flex – Charting example
Coding Conventions
DClick :: Adobe Flex Coding Guidelines
Collections, Libraries & Frameworks
Adobe :: corelib :: MD5 hashing, JSON serialization, advanced string and date parsing, and more
Adobe :: Flex Cookbook beta
Adobe :: Flex Scheduling Framework
Adobe :: Quick Starts :: Great stuff
Adobe :: RSS and Atom Libraries
Danny Patterson :: AS3 Lightweight Remoting Framework :: “a simple yet robust framework for handling remoting calls”
Faranta Systems :: daoFlex :: Automated generation of Java data access code
ifbin.com
JAM :: Just ActionScript & MXML
SourceForge::FlexApps
Components
Ely Greenfield :: Some thoughts on Flex vs. HTML (or…”how I made my Flex List Images stop flickering.”)
Stephen Gilson :: Creating Resizable and Draggable Flex Components
Context Menus
Kevin Hoyt :: Context Menus Revisited
Database Connectivity
Lukasz Blachowicz :: Asql :: Actionscript MySQL Driver
Matt MacLean :: asSQL :: Actionscript MySQL Driver
Drawing Etc.
Andrew Trice :: Flex 2 BitmapData Tricks and Techniques
Andrew Trice :: Realtime Thumbnails of Flex UIComponents :: More info
Jason Hawryluk :: Primitive Explorer :: More info
Ted Patrick :: Developing in Trees :: Adding sprites to the DisplayList :: Part 1 :: Part 2
E4X
Bruce Phillips :: Filtering an XML Object In ActionScript to Create Related Combo Boxes in Flex
Mike Morearty :: Common E4X pitfalls
Events
Oliver Merk :: Flex Custom Events – Part 1
Tink :: Custom Events in AS 3.0 (don’t forget to override the clone method)
Google Gears
Google Gears :: “Three modules that address the core challenges in making web applications work offline”
LocalServer :: Cache and serve application resources (HTML, JavaScript, images, etc.) locally
Database :: Store data locally in a fully-searchable relational database
WorkerPool :: Make your web applications more responsive by performing resource-intensive operations asynchronously
http://code.google.com/p/as3mapprlib Christophe Coenraets :: Flex-based SQLAdmin for Google Gears
Mapping
Alex Styler :: Flex, Yahoo! Maps & RSS Feeds
Menus
David Coletta :: Accelorator Decorations on Menus
Modularization, RSLs, Etc.
James Ward :: Faster Flex Applications: Shrink Your RSLs
Performance
James Ward :: Ajax and Flex Data Loading Benchmarks
Mark Piller :: Flex RemoteObject vs WebService benchmark
Nico Lierman :: Flex performance component
Physics Engines
Andre Michelle
Moto Flash Physics Engine
Scope
Timothée Groleau :: Scope Chain and Memory waste in Flash MX
Uncategorized Code Examples & Tips
Alastair Dawson :: Multiple File Upload with Flash and Ruby on Rails
Andrew Trice :: Benefits of defining a custom event type for data binding :: E.g. “[Bindable(event=”MyEvent”)]”
Andrew Trice :: Flex Search Mashup :: Uses AJAX Bridge :: More info
Andrew Trice :: Gantt Charts in Flex DataGrids in less than 1 hour!
Angus Johnson :: Datagrid Label Function Demo
Arpit Mathur :: Showing XML structure in a Tree
Ben Clinkinbeard :: Item Renderers in DataGrids – A Primer for Predictable Behavior
Ben Clinkinbeard :: Creating truly reusable renderers with ClassFactory
Brian Deitte :: Embedding HTML in a Flex application using an IFrame
Bruce Phillips :: Creating A Flex ButtonBar That Displays Tool Tips
Bruce Phillips :: Creating Web Page and Email Links In A Flex Application
Bruce Phillips :: Dynamically Create CheckBoxes, Their Labels, And Their Select Values In Flex
Bruce Phillips :: Example Of Using Modules In Flex 2.01
Bruce Phillips :: How To Create A FlexBook Component That Includes Content Pulled From A Database
Bruce Phillips :: How To Get Text To Wrap Correctly In A Flex DataGrid Column
Bruce Phillips :: Sort An ArrayCollection By Multiple Fields and Filter An ArrayCollection By Multiple Fields In Flex
Bruce Phillips :: Using the TileList Control :: Dragging Items From a TileList Control To A Container
Christophe Coenraets :: Building Collaborative Applications with Flex Data Services and Flash Media Server
Daniel Wanja :: Flex introspection API: describeType(value:*):XML :: Find a class’s superclass, methods, etc.
Darron Schall :: Convert Generic Objects into Class Instances
Dave Rangel :: A Form Validation Tool in Flex 2
David Coletta :: Call validateNow() after setting enabled to false
Derrick Grigg :: DataGrid ItemRenderer with filtering
Doug McCune :: Multi-line strings in Actionscript 3
Ely Greenfield :: Howdjoo do that? An interactive walkthrough of the DisplayShelf 3D tilting effect
Ely Greenfield :: Using Custom Data-Based Renderers in Charts
Ely Greenfield :: Dashed Lines
Fain, Rasputnis & Tartakovsky :: Advanced DataGrid Code Samples
Jesse Warden :: Checkbox Item Renderer :: Discusses how to catch their bubbling events
Joe Berkovitz :: An architectural blueprint for Flex applications
Joe Rinehart :: Semantically encapsulating effect sequences in Flex 2
Kelly Brown :: Accessing the Local File System with Flex
Mark Piller :: Mixing HTML and Flex using IFrame
Michael Labriolla :: Displaying XML-based DataGrids using dynamic E4X expressions
Michael Ramirez :: Flex DataGrid Paging Example with Source
Michael Ritchie :: Adding Drag-and-Drop & Drop Deny to DataGrid
Mike Morearty :: Transparent Flex Apps
Mike Teoti :: Flex 2 :: Tree :: Walking the Tree Method :: “the dataProvider rocks”
Paul Williams :: The World’s Smallest Tag? ::
Peter Elst :: Working with mx.core.Repeater
Peter Ent :: Coloring the Background of [DataGrid] Cells
Peter Ent :: Data Binding Tip :: “A simple way to enable/disable controls based on selection”
Peter Ent :: Filtering Collections
Peter Ent :: Tree Drag and Drop
Sergey Kovalyov :: Text control with truncateToFit property support
Renaun Erickson :: Flex 2 and Red 5 Chat Example :: Live example
Ted Patrick :: Code-Behind in Flex 2
Tink :: Drag & Drop
Tom Cornilliac :: Flex Builder Tip: Saving the generated AS3 code :: Use the compilers -keep option, examine your MXML’s AS3 code conversion!
Tracy Spratt :: Add components programmatically with addChild()
Tracy Spratt :: Hide-Show DataGrid Columns programmatically
Tracy Spratt :: Dynamic DataGrid columns
Victor Rubba :: DataGrid Search with Highlighted Matches
Yakov Fain :: Event-driven programming in Flex with Custom Events

Displaying charts in AdvancedDataGrid

October 19, 2008


Using charts as itemRenderers in DG and ADG is easy. Find the sample files here The sample uses a LineChart as itemRenderer for the third column and a PieChart in the child area. The column-spanning option available through RendererProviders is used to make the PieChart occupy the whole row. The sample shows use of HierarchicalData but even without that All chart types can be used as itemRenderes.

Programming ActionScript 3.0

October 16, 2008
  Programming ActionScript 3.0

Cairngorm Architecture

October 3, 2008

Understand the design challenges that Cairngorm addresses best, and the types of projects for which it is an appropriate skeleton for development.

cairngrom

October 3, 2008

I am trying to learn Cairngorm and am finding the resources severely lacking. I thought I’d document my experiences trying to learn Cairngorm with hopes someone will be able to tread the pass more easily than I.

Where do you go.

First off, where do you go to start reading about Cairngorm? Well, you can start at the Adobe Labs page on the framework. That will most likely lead you to Steven Webster’s 6 part series on developing Cairngorm apps. Let’s start with that series of articles.

Part 1 talks about frameworks in general, and gives a history of Cairngorm. It is a nice introduction and an easy read, but was unfortunately lacking any implementation details. It’s not a complete waste of time if you’re unfamiliar with frameworks.

Value Objects.

The second article starts to get a little meatier. How do you maintain state in a Rich Internet Application built with Flex? In a web app, you are trying to force state on a stateless system by using URL variables or cookies. With Flex, you are not dealing with a stateless client. The flash player can deal with state.

Steven comes up with an interesting way to describe state in an RIA. The state is the model (of Model View Controller). When you’re accessing a shopping cart, or user object you shouldn’t be accessing them stored on a web server somewhere. You should access this data stored as part of the client.

The next part of the article talks about the Value Object. A Value Object is a design pattern, where the object represents a single entity. That entity may be a product, a person, a company, an address, or anything you need. Steven says that these objects are now called Data Transfer Objects. Conceptually, they sound exactly like what most CF Developers call a Bean. You can check out this Blog entry for more info on Value Objects, Coldfusion, and Flex.

With Cairngorm you can use Value Objects to help easily keep the state on your server in sync with the state on your client. I can understand that, although the article doesn’t go into enough code detail for me to understand how to implement this.

Model Locator.

The second part of the article ends off by explaining the model locator pattern. This is a brand new pattern designed strictly for Flex RIA apps. Steven explains that model locators don’t apply to traditional web development or Java Development.

One powerful feature of Flex is data binding. When data changes, so does the display that uses the data. I got to admit it’s pretty powerful. When developing Flex with lots of components and relationships between the components, you have a problem of how to find the component that needs the data. You could start at the top level application and work down to the data, like this:

mx.core.Application.application.storeView.textualList.productGrid

That will get the productGrid values from the textualList component which is in the storeView component. It can get to be pretty tedious. I can honestly say I’ve never used this approach in a Flex app, and I’m not sorry about it.

An alternate method is that you could pass lots of parameters in and out of your component. In the example above, the productList value would be a property in textualList, which would then be a property in storeView. You do a lot of coding to specify the properties and components. It seems like a waste of time since many components will do nothing other define the property and pass it’s value up or down. Unfortunately, this is a mistake I’ve made.

The model locator design pattern addresses the problem of how to access disparate data buried within different components that don’t have an easy link between them. It is a single component that components use to access data. For all data and binding there is a single entry point across your application. This does address the two problems above.

The model locator component of Cairngorm is implemented as a Singleton. A Singleton is a design pattern, where only a single instance of the object is created for your application.

Summary So, after reading the first two parts of this article, I can tell you that Cairngorm uses Value Objects and a Model Locator. I like both of those ideas, although do not yet understand how I put this knowledge into practice when building a Flex application. I will continue to write more as I learn more.

Learning Cairngorm ( Part 5)

October 3, 2008

In the fifth part of this series on Cairngorm, I’m going to talk about how Cairngorm handles remote data calls. This, once again, is following along with the fifth part of Steven Webster’s Adobe Center Articles.

A Recap

In the last article I wrote in this series I spoke about how Cairngorm handles user gestures. A user gesture is anything that the user will do to interact with your application. This is the general procedure:

  • Dispatch a custom event (AKA User Gesture).
  • The Event goes to a controller and figures out what command to execute.
  • Execute the Command
  • Command updates Model data, which updates the user views

We are missing is getting live data, probably from a database, using some intermediary software like ColdFusion (my choice) or PHP. (Or Java or Ruby, or .NET, or whatever).

3 Types of Services, one Location

There are three ways to get data from within Flex. You can use an HTTPService, a WebService, or a RemoteObject. Based on their names, it is probably pretty obvious what each tag does (Right?). My preferred method is RemoteObject because it ties into ColdFusion so nicely, but I’ve also done some work with HTTPService for integrating with remote systems beyond my control. Cairngorm uses a ServiceLocator to help you find services. This is, conceptually, not much different than a Model Locator. It is a singleton class that allows you to store your services in a central location, and access them anywhere from the application. This would be a sample ServiceLocator:

<cairngorm:ServiceLocator
xmlns:mx=http://www.adobe.com/2006/mxml
xmlns:cairngorm=http://www.adobe.com/2006/cairngorm>

<mx:HTTPService id=“sampleHHTTPService” url=http://mysite.com/myservice method=“POST” resultFormat=“xml” contentType=“application/xml” />

<mx:RemoteObject id=“sampleRemoteObject” destination=“ColdFusion” source=“com.dotcomit.service” />

<mx:WebService id=“sampleWebService” wsdl=http://mysite.com/myservice.wsdl />

</cairngorm:ServiceLocator>

I have three (fake) services, one of each type. If you’ve used any of these tags before, you’ll notice that I left out the ‘result’ and ‘fault’ events. Result and Fault methods are known as responder methods. They get called when the remote service sends data back to Flex. Cairngorm puts the responder methods in the Command, and calls the Service using a Delegate.

Delegates

A Delegate is a class that does nothing but call the service. Here is a simple example:

package com.tempApp.fooDelegate{

public class MyCustomDelegate{
private var responder : IResponder;
private var service : Object;

public function MyCustomDelegate ( responder : IResponder )
{
this.service = ServiceLocator.getInstance().getRemoteObject( ” sampleRemoteObject “ );
this.responder = responder;
}
}

public function getFoo ([foo arguments]):void{
var call : Object = service.getFoo([foo arguments]);
call.addResponder(responder);
}
}

Cairngorm keeps the delegates and the services file in a business folder. I guess this ties into “Business Logic”. Really this is just a layer to reach the backend business logic, though. I don’t do a lot of work in the delegates. They just make calls. To me it makes sense to do data parsing in the responder, and as such in the command. ( Although this approach has been contested ). We can modify our command, Part 4, to handle make the delegate call.

package com.tempApp.command{

import com.adobe.cairngorm.control.CairngormEvent;
import com.adobe.cairngorm.commands.ICommand;
import com.tempApp.event. MyCustomEvent
import com.tempApp.business. MyCustomDelegate
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;

public class MyCustomCommand implements ICommand
, IResponder{

public function execute(event:CairngormEvent):void{
var e : MyCustomEvent = event as MyCustomEvent;
var delegate : MyCustomDelegate = new MyCustomDelegate ( this );
delegate.getFoo([instance variables from event]);
}

public function result( event : ResultEvent) : void
{
[do stuff with results]
}

public function fault( event : FaultEvent ) : void
{
[Do error processing]
}

}
}

The first change is that the code implements an IResponder interface in addition to the ICommand. The second change is that the execute method actually creates an instance of the delegate (passing in the instance of this object), and calls a method on the delegate. This modified class also includes a result event and a fault event. These are the responder methods called by the service when results are returned. Most likely the result event will be performing some actions on the ModelLocator, which will change some other aspect of the app via data binding.

A recap of Today

So, our updated process is this:

  • Dispatch a custom event (AKA User Gesture).
  • The Event goes to a controller and figures out what command to execute.
  • Execute the Command
  • Command creates instance of Delegate.
  • Delegate gets Service Object from Service Locator
  • Delegate calls the Service Object Method
  • Remote Service does stuff and sends data back to the respond methods in the Command
  • Command updates Model data, which updates the user views
Follow

Get every new post delivered to your Inbox.