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

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

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