Skip to Main Content
Professional Cairngorm™
book

Professional Cairngorm™

by Jeremy Wischusen
November 2009
Intermediate to advanced content levelIntermediate to advanced
357 pages
8h 20m
English
Wrox
Content preview from Professional Cairngorm™

22.4. Revising Adding a Post

Adding a post is currently accomplished with the following classes:

  • AddPostEvent

  • AddPostDelegate

  • AddPostCommand

  • LoadCategoriesEvent

  • LoadCategoriesCommand

  • LoadCategoriesDelegate

The AddPostEvent will become a type of the new PostEvent class.

The addPost function of the AddPostDelegate will move to the new PostDelegate class.

The AddPostCommand will be updated to cast the event as a PostEvent and use the new PostDelegate.

The LoadCategoriesEvent will become a type of the CategoryEvent class.

The loadCategories function of the LoadCategoriesDelegate will be moved to the CategoryDelegate class.

The execute function of the LoadCategoriesCommand will be updated to use the CategoryDelegate.

Start with the new event class for posts. In the com.FlexBlog.events package create a new event class named PostEvent. Edit the class to match the following:

package com.FlexBlog.events
{
    import com.FlexBlog.valueobjects.PostVO;
    import com.adobe.cairngorm.control.CairngormEvent;
    public class PostEvent extends CairngormEvent
    {
        public static const ADD:String = 'addPostEvent';
        public var post:PostVO;
        public function PostEvent(type:String, post:PostVO = null,
        bubbles:Boolean=false, cancelable:Boolean=false)
        {
            super(type, bubbles, cancelable);
            this.post =post;
        }
    }
}

Now create the new post delegate class. In the com.FlexBlog.delegates package create a new delegate class named PostDelegate. Edit the class to match the following:

package com.FlexBlog.delegates { import com.FlexBlog.valueobjects.PostVO; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Professional Java® JDK®, 6th Edition

Professional Java® JDK®, 6th Edition

W. Clay Richardson, Jeff Scanlon, Donald Avondolio, Mark W. Mitchell, Scot Schrager

Publisher Resources

ISBN: 9780470497265Purchase book