com.dlsc.flexgantt.command

## Interface ICommandStack

- All Known Implementing Classes:
    DefaultCommandStack

      public interface ICommandStack

  A command stack interface that can be used by a Gantt chart to execute, undo, and redo commands. Additionally the last executed (equals next undoable) command and the next redoable command can be queried from the stack.
  Since:
    1.0
  Version:
    $Revision: 1.4 $
  Author:
    Dirk Lemmermann

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addCommandStackListener(ICommandStackListener l)` Adds a listener to the command stack.
    `void` | `clear()` Clears the command stack's list of executed and undone commands.
    `void` | `execute(ICommand cmd, IProgressMonitor monitor)` Executes the given command.
    `ICommand` | `getRedoableCommand()` Returns the command, which will be redone if the `redo` method gets called.
    `ICommand` | `getUndoableCommand()` Returns the command, which will be undone if the `undo` method gets called.
    `boolean` | `isRedoable()` Returns true if the command stack currently supports a call to it's redo method.
    `boolean` | `isUndoable()` Returns true if the command stack currently supports a call to it's undo method.
    `void` | `redo(IProgressMonitor monitor)` Redos the last undone command (if it is redoable).
    `void` | `removeCommandStackListener(ICommandStackListener l)` Removes a listener from the command stack.
    `void` | `undo(IProgressMonitor monitor)` Undos the last executed command (if it is undoable).

- - ### Method Detail

    - #### execute

          void execute(ICommand cmd,
                       IProgressMonitor monitor)

      Executes the given command. A command stack implementation should inform its listeners about the execution after it has terminated.
      Parameters:
        `cmd` - the command to execute
        `monitor` - a progress monitor used for displaying information during command execution (for example: percentage complete, current task, current subtask).
      Since:
        1.0

    - #### undo

          void undo(IProgressMonitor monitor)

      Undos the last executed command (if it is undoable). A command stack implementation should inform its listeners about the undo after it has terminated.
      Parameters:
        `monitor` - a progress monitor used for displaying information during command execution (for example: percentage complete, current task, current subtask).
      Since:
        1.0

    - #### redo

          void redo(IProgressMonitor monitor)

      Redos the last undone command (if it is redoable). A command stack implementation should inform its listeners about the redo after it has terminated.
      Parameters:
        `monitor` - a progress monitor used for displaying information during command execution (for example: percentage complete, current task, current subtask).
      Since:
        1.0

    - #### clear

          void clear()

      Clears the command stack's list of executed and undone commands.
      Since:
        1.0

    - #### isUndoable

          boolean isUndoable()

      Returns true if the command stack currently supports a call to it's undo method.
      Returns:
        true if the command stack can be undone
      Since:
        1.0

    - #### isRedoable

          boolean isRedoable()

      Returns true if the command stack currently supports a call to it's redo method.
      Returns:
        true if the command stack can be redone
      Since:
        1.0

    - #### getUndoableCommand

          ICommand getUndoableCommand()

      Returns the command, which will be undone if the `undo` method gets called. This method is useful for providing feedback to the user via, for example, an undo menu item.
      Returns:
        ICommand the next command to be undone
      Since:
        1.0

    - #### getRedoableCommand

          ICommand getRedoableCommand()

      Returns the command, which will be redone if the `redo` method gets called. This method is useful for providing feedback to the user via, for example, an undo menu item.
      Returns:
        ICommand the next command to be redone
      Since:
        1.0

    - #### addCommandStackListener

          void addCommandStackListener(ICommandStackListener l)

      Adds a listener to the command stack. Command stack listeners will be informed about executed, undone and redone commands.
      Parameters:
        `l` - ICommandStackListener
      Since:
        1.0

    - #### removeCommandStackListener

          void removeCommandStackListener(ICommandStackListener l)

      Removes a listener from the command stack.
      Parameters:
        `l` - ICommandStackListener
      Since:
        1.0

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