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

7.2. What Do They Look Like?

The classes and interfaces associated with the Cairngorm commands are located in the com.adobe.cairngorm.commands package. This package contains the following classes and interfaces:

  • Interfaces

    • Command: Enforces the contract between the FrontController and concrete command classes in your application. Deprecated as of Cairngorm 2.1 and replaced by com.adobe.cairngorm.commands.ICommand

    • ICommand: Enforces the contract between the FrontController and concrete command classes in your application

  • Classes

    • SequenceCommand: Provided as a "pseudo-abstract" (since ActionScript has no real concept of abstract classes) base class that can be extended when you wish to chain commands together for a single user gesture, or establish some simple form of decision-based workflow

The Command interface has been deprecated in favor of the ICommand interface. The code for the ICommand interface is as follows:

package com.adobe.cairngorm.commands
{
   import com.adobe.cairngorm.control.CairngormEvent;
   public interface ICommand
   {
      function execute( event : CairngormEvent ) : void;
   }
}

This is the interface responsible for enforcing the implementation of the command design pattern. It defines a single method, execute, that takes in a CairngormEvent class.

The SequenceCommand class is more or less a utility class that enables you to chain calls of commands together. The code for this class is as follows:

package com.adobe.cairngorm.commands { import com.adobe.cairngorm.control.CairngormEvent; ...

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