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.6. Revising Commenting

The commenting system is currently accomplished with the following classes:

  • AddCommentEvent

  • AddCommentDelegate

  • AddCommentCommand

  • LoadCommentsEvent

  • LoadCommentsDelegate

  • LoadCommentsCommand

The AddCommentEvent and LoadCommentsEvent will become properties of the CommentEvent class. As mentioned earlier, these two types of events currently expect different value objects, so the type of the property holding the data to be passed will have to be typed as Object to accommodate different types of value objects.

The addComment function of the AddCommentDelegate and the loadComments function of the LoadCommentsDelegate will be moved to the CommentDelegate class.

The AddCommentCommand will be updated to cast the event as a CommentEvent and both the AddCommentCommand and the LoadCommentsCommand will be updated to use the CommentDelegate class.

Start by creating the new comment event. In the com.FlexBlog.events package create a new event class named CommentEvent. Edit the class to match the following:

package com.FlexBlog.events
{
    import com.adobe.cairngorm.control.CairngormEvent;
    public class CommentEvent extends CairngormEvent
    {
        public static const ADD:String = 'addCommentEvent';
        public static const LOAD:String = 'loadCommentsEvent';
        public function CommentEvent(type:String, data:Object = null,
bubbles:Boolean=false, cancelable:Boolean=false)
        {
            super(type, bubbles, cancelable);
            this.data = data;
        }
    }
}

Here is the first case in which the constructor is being designed ...

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