O'Reilly logo

Professional Cairngorm™ by Jeremy Wischusen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

17.8. Summary

In this chapter you created the add post feature. Let's take a moment to review how you used Cairngorm to do it.

You created PostVO and CategoryVO value object classes to represent posts and post categories. These, again, formed the basis for passing data between classes. Additionally, you used a collection of CategoryVO objects as the dataProvider for a combo box in your PostEditor view, allowing the user to select a category and enabling the categoryId to be retrieved by means of the selectedItem property of the combo box.

You created LoadCategoriesEvent and AddPostEvent event classes. The LoadCategoriesEvent simply triggered the corresponding command class. You triggered this event in the main application by creating an init function that was triggered on the creationComplete event of the MainView component. The AddPostEvent took in a PostVO as a parameter and passed it on to the command class.

You created LoadCategoriesDelegate and AddPostDelegate delegate classes. The LoadCategoriesDelegate called the getCategories method of the FlexBlogDatabaseManager, which returned an array of CategoryVO objects. These were then passed back to the command class via the result object of the ResultEvent. The AddPostDelegate addPost method took in a PostVO and passed it to the addPost method of the FlexBlogDatabaseManager, which indicated success by returning the number of rows inserted into the database. The number of rows was passed back to the command class via the result ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required