com.dlsc.flexgantt.command
Class AbstractCommand

java.lang.Object
  extended by com.dlsc.flexgantt.command.AbstractCommand
All Implemented Interfaces:
ICommand, java.io.Serializable
Direct Known Subclasses:
AbstractDragAndDropCommand, CompoundCommand, DefaultAddLayerCommand, DefaultChangeCapacityCommand, DefaultChangeEventlineObjectTimeSpanCommand, DefaultChangeKeyCommand, DefaultChangePercentageCommand, DefaultChangeTimelineObjectTimeSpanCommand, DefaultChangeTimeZoneCommand, DefaultChangeValueCommand, DefaultCreateEventlineObjectCommand, DefaultCreateRelationshipCommand, DefaultCreateTimelineObjectCommand, DefaultDeleteEventlineObjectCommand, DefaultDeleteTimelineObjectCommand, DefaultNodeCreateCommand, DefaultNodeDeleteCommand, DefaultNodeDragAndDropCommand, DefaultRemoveLayerCommand, DefaultRowResizeCommand

public abstract class AbstractCommand
extends java.lang.Object
implements ICommand

An abstract superclass implementation to facilitate the creation of new commands. This class handles the naming of commands and provides a default implementation of the redo functionality by simply calling the execution method again.

Since:
1.0
Author:
Dirk Lemmermann
See Also:
ICommand, Serialized Form

Constructor Summary
protected AbstractCommand(java.lang.String name)
          Creates a new abstract command (can only be called by the subclass constructor).
 
Method Summary
 java.lang.String getName()
          Returns the (display) name of the command.
 boolean isRedoable()
          Returns TRUE if the command can be redone.
 boolean isRelevant()
          Returns TRUE if the command is relevant and should be considered for undo / redo operations.
 boolean isUndoable()
          Returns TRUE if the command can be undone.
 void redoCommand(IProgressMonitor monitor)
          Executes the command again after a call to the command's undo method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.dlsc.flexgantt.command.ICommand
executeCommand, undoCommand
 

Constructor Detail

AbstractCommand

protected AbstractCommand(java.lang.String name)
Creates a new abstract command (can only be called by the subclass constructor). The command name will be used by some actions in order to create menu items and toolbar buttons, hence it should be a human readable and internationalized name.

Parameters:
name - the name of the command
Since:
1.0
Method Detail

getName

public java.lang.String getName()
Returns the (display) name of the command.

Specified by:
getName in interface ICommand
Returns:
the name of the command
Since:
1.0
See Also:
ICommand.getName()

isRedoable

public boolean isRedoable()
Returns TRUE if the command can be redone. The default implementation always returns TRUE.

Specified by:
isRedoable in interface ICommand
Returns:
true if the command can be redone
Since:
1.0
See Also:
ICommand.isRedoable()

isRelevant

public boolean isRelevant()
Returns TRUE if the command is relevant and should be considered for undo / redo operations. The default implementation always returns TRUE.

Specified by:
isRelevant in interface ICommand
Returns:
true if the command is relevant
Since:
1.0
See Also:
ICommand.isRelevant()

isUndoable

public boolean isUndoable()
Returns TRUE if the command can be undone. The default implementation always return TRUE.

Specified by:
isUndoable in interface ICommand
Returns:
true if the command can be undone
Since:
1.0
See Also:
ICommand.isUndoable()

redoCommand

public void redoCommand(IProgressMonitor monitor)
Executes the command again after a call to the command's undo method.

Specified by:
redoCommand in interface ICommand
Parameters:
monitor - a progress monitor
Since:
1.0
See Also:
ICommand.redoCommand(IProgressMonitor)