cib.util.cmd
Class CmdMgr

java.lang.Object
  extended by cib.util.cmd.CmdMgr

public class CmdMgr
extends java.lang.Object

The Command Manager does, undoes und redoes Commands. The command history is recorded.

Version:
$Revision: 1684 $, $Author: svn-firmenich $, $Date: 2011-08-12 16:55:42 +0200 (Fri, 12 Aug 2011) $
Author:
Berthold Firmenich

Field Summary
static int CAN_REDO_MORE
           
static int CAN_UNDO_MORE
           
protected  java.util.LinkedList<Cmd> m_cmdHistory
           
protected  int m_cmdHistoryIndex
           
protected  int m_maximumSize
           
 
Constructor Summary
CmdMgr()
           
 
Method Summary
 boolean canRedoMore()
          Check if at least one more redo is possible
 boolean canUndoMore()
          Check if at least one more undo is possible
 void clear()
          Clears the command history
 int doCmd(Cmd cmd)
          Does a command that has been previously created.
 int doCmd(Cmd cmd, java.lang.Object context)
          Does a command that has been previously created.
 void dumpCmdHistory()
          Dumps the command history to the standard output stream
protected  int getFlags()
           
 int getMaximumSize()
          Gets the maximum number of stored commands
 boolean isEmpty()
          Checks whether any commands are stored
 java.util.Iterator<Cmd> redoableCommandsIterator()
          Returns an interator over the redoable commands
 int redoCmd()
          Redoes the next command.
 int redoCmd(java.lang.Object context)
          Redoes the next command.
 void setMaximumSize(int n)
          Sets the maximum number of stored commands
 java.util.Iterator<Cmd> undoableCommandsIterator()
          Returns an interator over the undoable commands
 int undoCmd()
          Undoes the next command.
 int undoCmd(java.lang.Object context)
          Undoes the next command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CAN_UNDO_MORE

public static final int CAN_UNDO_MORE
See Also:
Constant Field Values

CAN_REDO_MORE

public static final int CAN_REDO_MORE
See Also:
Constant Field Values

m_cmdHistory

protected java.util.LinkedList<Cmd> m_cmdHistory

m_cmdHistoryIndex

protected int m_cmdHistoryIndex

m_maximumSize

protected int m_maximumSize
Constructor Detail

CmdMgr

public CmdMgr()
Method Detail

setMaximumSize

public void setMaximumSize(int n)
Sets the maximum number of stored commands


getMaximumSize

public int getMaximumSize()
Gets the maximum number of stored commands

Returns:
maximum number of commands

clear

public void clear()
Clears the command history


isEmpty

public boolean isEmpty()
Checks whether any commands are stored

Returns:
true if no commands are stored

doCmd

public int doCmd(Cmd cmd,
                 java.lang.Object context)
Does a command that has been previously created.

Parameters:
cmd - the command object
context - an application specific context object
Returns:
Flags indicating if more undos or redos are possible

doCmd

public int doCmd(Cmd cmd)
Does a command that has been previously created.

Parameters:
cmd - the command object
Returns:
Flags indicating if more undos or redos are possible

undoCmd

public int undoCmd(java.lang.Object context)
Undoes the next command.

Parameters:
context - an application specific context object
Returns:
Flags indicating if more undos or redos are possible

undoCmd

public int undoCmd()
Undoes the next command.

Returns:
Flags indicating if more undos or redos are possible

redoCmd

public int redoCmd(java.lang.Object context)
Redoes the next command.

Parameters:
context - an application specific context object
Returns:
Flags indicating if more undos or redos are possible

redoCmd

public int redoCmd()
Redoes the next command.

Returns:
Flags indicating if more undos or redos are possible

canUndoMore

public boolean canUndoMore()
Check if at least one more undo is possible

Returns:
true if at least one more undo is possible

canRedoMore

public boolean canRedoMore()
Check if at least one more redo is possible

Returns:
true if at least one more redo is possible

undoableCommandsIterator

public java.util.Iterator<Cmd> undoableCommandsIterator()
Returns an interator over the undoable commands

Returns:
Iterator an iterator over the string representations

redoableCommandsIterator

public java.util.Iterator<Cmd> redoableCommandsIterator()
Returns an interator over the redoable commands

Returns:
Iterator an iterator over the string representations

dumpCmdHistory

public void dumpCmdHistory()
Dumps the command history to the standard output stream


getFlags

protected int getFlags()