com.dlsc.flexgantt.command

## Class AbstractCommand

- java.lang.Object
- - com.dlsc.flexgantt.command.AbstractCommand

- All Implemented Interfaces:
    ICommand, Serializable
  Direct Known Subclasses:
    AbstractCompoundCommand, AbstractDragAndDropCommand, DefaultAddLayerCommand, DefaultChangeCapacityCommand, DefaultChangeEventlineObjectTimeSpanCommand, DefaultChangeKeyCommand, DefaultChangePercentageCommand, DefaultChangeSpreadsheetValueCommand, DefaultChangeTimelineObjectTimeSpanCommand, DefaultChangeTimeZoneCommand, DefaultChangeValueCommand, DefaultCreateConstraintCommand, DefaultCreateEventlineObjectCommand, DefaultCreateNodeCommand, DefaultCreateRelationshipCommand, DefaultCreateTimelineObjectCommand, DefaultDeleteEventlineObjectCommand, DefaultDeleteNodeCommand, DefaultDeleteRelationshipCommand, DefaultDeleteTimelineObjectCommand, DefaultInsertNodeCommand, DefaultNodeDragAndDropCommand, DefaultReassignNodesCommand, DefaultRemoveLayerCommand, DefaultRowResizeCommand

      public abstract class AbstractCommand
      extends 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
  Version:
    $Revision: 1.10 $
  Author:
    Dirk Lemmermann
  See Also:
    `ICommand`, Serialized Form

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractCommand(String name)` Creates a new abstract command (can only be called by the subclass constructor).

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.
    `void` | `setName(String name)` Sets the (display) name of the command.

    - ### 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(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 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()`, `setName(String)`

    - #### setName

          public void setName(String name)

      Sets the (display) name of the command.
      Parameters:
        `name` - the name to be used for the command
      Since:
        2.0
      See Also:
        `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)
                           throws CommandException

      Executes the command again after a call to the command's undo method.
      Specified by:
        `redoCommand` in interface `ICommand`
      Parameters:
        `monitor` - a progress monitor
      Throws:
        `CommandException` - if anything during the execution of the command has gone wrong
      Since:
        1.0
      See Also:
        `ICommand.redoCommand(IProgressMonitor)`

Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.