Class CommandManager


  • public class CommandManager
    extends Object
    The central class for the command manager
    • Constructor Detail

      • CommandManager

        public CommandManager()
        Default constructor.
      • CommandManager

        public CommandManager​(CommandManager orig)
        Copy constructor, because "clone()" idiom is badly broken and only version number is preserved anyway.
        Parameters:
        orig - the original command manager
    • Method Detail

      • getVersion

        public int getVersion()
        Get the version number
        Returns:
        the version number
      • execute

        public void execute​(Command command)
        Execute a command. Increases the version number.
        Parameters:
        command - - The command line
      • execute

        public void execute​(Command... commands)
        Execute the commands
        Parameters:
        commands - - The commands
      • getLastCommand

        public Command getLastCommand()
        Returns the most recent command executed
        Returns:
        - the most recent executed command or null if no such command
      • canUndo

        public boolean canUndo()
        Can undo
        Returns:
        - Undo list is empty
      • canRedo

        public boolean canRedo()
        Can redo
        Returns:
        - Redo list is empty
      • addCommandListener

        public void addCommandListener​(CommandListener listener)
        Adds editing command listener
        Parameters:
        listener - - command listener
      • removeCommandListener

        public void removeCommandListener​(CommandListener listener)
        removes editing command listener
        Parameters:
        listener - - command listener