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

Get Professional Cairngorm™ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.