venice
Class Command

java.lang.Object
  |
  +--venice.Command
Direct Known Subclasses:
ClosePackageCommand, CreateVisualizationTreeCommand, ExportGXLFileCommand, FitToScreenCommand, HideInterfaceContentCommand, HideOfferedInterfacesCommand, HideRequiredInterfacesCommand, HideVRelationshipLabelsCommand, ImportGXLCommand, LoadCommand, MakePackageTransparentCommand, MoveRelationshipsDownCommand, MoveRelationshipsUpCommand, OpenPackageCommand, PrintCurrentViewCommand, SaveCommand, ShowInterfaceContentCommand, ShowOfferedInterfacesCommand, ShowRequiredInterfacesCommand, ShowVRelationshipLabelsCommand, ZoomToSelectionCommand

public abstract class Command
extends java.lang.Object

Command is an abstract base class for a hierarchy of commands. They implement the idea behind the design pattern Command. This base class stores a reference to the current instance of AppModule as a class variable, so it can be used in various subclasses without being given as a parameter.

Command is a part of the design pattern Command. GUI and other objects have instances of Command subclasses. When necessary, these objects can execute the Command instance they have to perform activities. This is a nice of way of abstracting the actual actions and actors of the objects that initiate these actions.

Subclasses probably should have a constructor that takes as parameters all references (to other objects) that are needed for that particular command to do its duties.

Command has a static setAppModule method, which can be used to set the static AppModule reference to point to the current AppModule instance. Subclasses can use getAppModule to get this reference to access any data they need in the system.

Author:
Petteri Kamppuri

Field Summary
private static AppModule stAppModule
          A class variable to hold a reference to the current instance of AppModule.
 
Constructor Summary
Command()
           
 
Method Summary
abstract  void execute()
          This abstract method is overridden in subclasses.
protected static AppModule getAppModule()
          Returns a reference to the saved stAppModule class variable.
static void setAppModule(AppModule inAppModule)
          Takes the given object and puts a reference to that in the stAppModule class variable.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

stAppModule

private static AppModule stAppModule
A class variable to hold a reference to the current instance of AppModule. Subclasses can take advantage of this reference.
Constructor Detail

Command

public Command()
Method Detail

execute

public abstract void execute()
This abstract method is overridden in subclasses. The overridden version does whatever the Command is supposed to do.

Users of these subclasses can rely on the Command interface, and just call execute() when they want the given subclass to perform an operation.


setAppModule

public static void setAppModule(AppModule inAppModule)
Takes the given object and puts a reference to that in the stAppModule class variable. Subclasses of Command can then use the saved AppModule reference for their purposes.
Parameters:
inAppModule - the reference to save

getAppModule

protected static AppModule getAppModule()
Returns a reference to the saved stAppModule class variable. Subclasses of Command can then use the saved AppModule reference for their purposes.
Parameters:
inAppModule - the reference to save