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.7. Revising Searching

Currently the search feature is accomplished with the following classes:

  • CategorySearchEvent

  • KeyWordSearchEvent

  • ClearSearchResultsEvent

  • CategorySearchDelegate

  • KeyWordSearchDelegate

  • CategorySearchCommand

  • ClearSearchResultsCommand

  • KeyWordSearchCommand

The CategorySearchEvent, KeyWordSearchEvent, and ClearSearchResultsEvent classes will become types of the SearchEvent class. Again, since these events currently expect different types of data to be passed, you will have to construct the event to allow for multiple data types.

The CategorySearchDelegate and the KeyWordSearchDelegate will be consolidated into a SearchDelegate class. However, in this case the functions that exist on both delegates are named search, and they will have to be renamed when they are moved to the new delegate.

The execute functions of the CategorySearchCommand and KeyWordSearchCommand commands will have to be updated to cast the data passed by the SearchEvent and to use the new SearchDelegate.

The ClearSearchResultsCommand does not use any data passed from the event, nor does it use a delegate, so this class can remain as it is.

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

package com.FlexBlog.events { import com.adobe.cairngorm.control.CairngormEvent; public class SearchEvent extends CairngormEvent { public static const KEYWORD_SEARCH:String = 'keywordSearchEvent'; public static ...
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