18.8. Summary

In this chapter you created the load posts feature and did a little restructuring of your views. Let's take a moment to review how you used Cairngorm to create this feature and how you restructured the views.

You used the existing PostVO class in the PostList view to display the titles of recent posts and to allow the user to select a post. You did this by updating the currentPost property of the ModelLocator with the selectedItem from the list. The PostDisplay view used the PostVO object referenced in the currentPost property of the ModelLocator to display the details of the selected post.

You created ApplicationInitializeEvent, LoadRecentPostsEvent, and SetCurrentPostEvent event classes. The ApplicationInitializeEvent will now be triggered when the main application loads, keeping you from having to list all the events that need to be triggered in your main view. The LoadRecentPostsEvent event was triggered in the ApplicationInitializeEvent (along with the loading of the categories), causing the posts to be loaded when the application loaded. The SetCurrentPostEvent will be triggered in your PostList view when the user selects an item from the list. It will take the PostVO from selectedItem from the list and pass it to the SetCurrentPostCommand.

You created a LoadRecentPostsDelegate that accessed the getRecentPosts method of the FlexBlogDatabaseManager, returning an array of PostVO objects that was passed back to the command via the result object of the ResultEvent. ...

Get Professional Cairngorm™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.