Package at.jku.ssw.fp.sect04_4.cmd_nofp
Class CmdHandler
- java.lang.Object
-
- at.jku.ssw.fp.sect04_4.cmd_nofp.CmdHandler
-
public class CmdHandler extends Object
Handler for commands. Allows undo and redo of commands.- Author:
- Herbert Prähofer
-
-
Constructor Summary
Constructors Constructor Description CmdHandler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doCmd(Command cmd)
Executes the command and stores it in the undo stack.static CmdHandler
getInstance()
Gets the singleton command handler.void
redoCmd()
Undoes the last command from the redo stack.void
undoCommand()
Undoes the last command from the undo stack.
-
-
-
Field Detail
-
instance
private static CmdHandler instance
Singleton command handler
-
-
Method Detail
-
getInstance
public static CmdHandler getInstance()
Gets the singleton command handler.- Returns:
- the singleton command handler
-
doCmd
public void doCmd(Command cmd)
Executes the command and stores it in the undo stack.- Parameters:
cmd
- the command to execute
-
undoCommand
public void undoCommand()
Undoes the last command from the undo stack.
-
redoCmd
public void redoCmd()
Undoes the last command from the redo stack.
-
-