Command (GWT Javadoc)

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.gwt.user.client
Interface Command

All Superinterfaces:
  Scheduler.ScheduledCommand

    public interface Command

extends Scheduler.ScheduledCommand

Encapsulates an action for later execution, often from a different context.

The Command interface provides a layer of separation between the code specifying some behavior and the code invoking that behavior. This separation aids in creating reusable code. For example, a `MenuItem` can have a Command associated with it that it executes when the menu item is chosen by the user. Importantly, the code that constructed the Command to be executed when the menu item is invoked knows nothing about the internals of the MenuItem class and vice-versa.

The Command interface is often implemented with an anonymous inner class. For example,

     Command sayHello = new Command() {
       public void execute() {
         Window.alert("Hello");
       }
     };
     sayHello.execute();

This type extends ScheduledCommand to help migrate from DeferredCommand API.

Method Summary
`void` | `execute()` Causes the Command to perform its encapsulated behavior.

Method Detail

### execute

    void execute()

  Causes the Command to perform its encapsulated behavior.

  Specified by:
    `execute` in interface `Scheduler.ScheduledCommand`

Overview | Package | Class | Use | Deprecated | Help
| GWT 2.7.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD