com.tensegrity.generic.command
Class BaseCommand

java.lang.Object
  extended bycom.tensegrity.generic.command.BaseCommand
All Implemented Interfaces:
Command
Direct Known Subclasses:
CommonBaseCommand, EditAttributeEditorStateCommand, SetSortModeCommand, ToggleCategoriesCommand, ToggleExactMatchingCommand, ToggleMergeElementTypesCommand

public abstract class BaseCommand
extends java.lang.Object
implements Command

Abstract class BaseCommand is the common base class for all of our Command implementation classes because it consolidates shared code and provides a number of overloaded constructors that make subclasses easier to write. Because this class automatically registers itself with an instance of CommandRegistry, subclasses only have to override the method Command.perform(Object).

Version:
$Id: BaseCommand.java,v 1.23 2005/04/13 15:30:54 AndreasEbbert Exp $
Author:
Stepan Rutz

Constructor Summary
BaseCommand(CommandRegistry commandregistry, java.lang.String id)
          Constructor specifying the commandregistry to use and an id.
BaseCommand(CommandRegistry commandregistry, java.lang.String id, java.lang.String description)
          Constructor with additional description-parameter.
BaseCommand(CommandRegistry commandregistry, java.lang.String id, java.lang.String description, java.lang.String performDescription)
          Constructor with additional description- and perform-description parameter.
BaseCommand(CommandRegistry commandregistry, java.lang.String id, java.lang.String description, java.lang.String performDescription, boolean enabled)
          Constructor with additional parameter indicating whether this command is enabled or not.
 
Method Summary
 java.lang.String getDescription()
          Returns the description of this command.
 java.lang.String getId()
          Retrieves the unique identifier of the command.
 java.lang.String getPerformDescription()
          Returns a textual description of what the command does when it is invoked.
 boolean isEnabled()
          Returns true if this command is enabled.
 void setEnabled(boolean b)
          Specifies whether this command is enabled or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.tensegrity.generic.command.Command
perform
 

Constructor Detail

BaseCommand

public BaseCommand(CommandRegistry commandregistry,
                   java.lang.String id)
Constructor specifying the commandregistry to use and an id.

Parameters:
commandregistry - the registry to register the command with. (If it is null, then the command will not be registered.)
id - unique identifier for the command.

BaseCommand

public BaseCommand(CommandRegistry commandregistry,
                   java.lang.String id,
                   java.lang.String description)
Constructor with additional description-parameter.

Parameters:
commandregistry - the registry to register the command with.
id - unique identifier for the command.
description - a description describing what this command will do.

BaseCommand

public BaseCommand(CommandRegistry commandregistry,
                   java.lang.String id,
                   java.lang.String description,
                   java.lang.String performDescription)
Constructor with additional description- and perform-description parameter.

Parameters:
commandregistry - the registry to register the command with.
id - unique identifier for the command.
description - a String describing what this command will do.
performDescription - a String describing what this command does when it performs.

BaseCommand

public BaseCommand(CommandRegistry commandregistry,
                   java.lang.String id,
                   java.lang.String description,
                   java.lang.String performDescription,
                   boolean enabled)
Constructor with additional parameter indicating whether this command is enabled or not.

Parameters:
commandregistry - the registry to register the command with.
id - unique identifier for the command.
description - a String describing what this command will do.
performDescription - a String describing what this command does when it performs.
enabled - indicating whether this command is enabled.
Method Detail

getId

public java.lang.String getId()
Description copied from interface: Command
Retrieves the unique identifier of the command.

Specified by:
getId in interface Command
Returns:
the unique identifier of this command.

getDescription

public java.lang.String getDescription()
Description copied from interface: Command
Returns the description of this command. A desciption can be used as a tooltip-text, for example.

Specified by:
getDescription in interface Command
Returns:
the set description for this command, null otherwise.

getPerformDescription

public java.lang.String getPerformDescription()
Description copied from interface: Command
Returns a textual description of what the command does when it is invoked. The difference between Command.getDescription() is, that the returned String of this method describes what the Command does when it performs. The String returned by getDescription() describes what the command will do.

For example:
You specify a command that opens a document.

Specified by:
getPerformDescription in interface Command
Returns:
a String describing what this command does during performance, or null if it is not set.

isEnabled

public boolean isEnabled()
Description copied from interface: Command
Returns true if this command is enabled.

Specified by:
isEnabled in interface Command
Returns:
true if this command is enabled.

setEnabled

public void setEnabled(boolean b)
Description copied from interface: Command
Specifies whether this command is enabled or not.

Specified by:
setEnabled in interface Command
Parameters:
b - specifies whether this command is enabled.


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.