org.fopps.share
Class UndoManager

java.lang.Object
  |
  +--org.fopps.share.UndoManager

public class UndoManager
extends java.lang.Object

UndoManager saves compensating transactions. This may be a single property change or a bunch of changes. If you want to undo more than one operation in one shot, these changes must be sorrounded by beginCompoundUndo and endCompoundUndo. Nested compound undos are allowed.


Nested Class Summary
static interface UndoManager.Undoable
          Common interface for undo entries
 
Field Summary
static boolean VERBOSE_UNDO
           
 
Constructor Summary
UndoManager()
           
 
Method Summary
static void beginCompoundUndo()
          Begins a compund undo.
static boolean canUndo()
          Returns true, if undo items are available
static void clear()
          Drops the complete undo and redo stack (e. g. after loading a new file)
static void endCompoundUndo()
          Finish a previous opened compound undo
static java.util.Stack getUndoStack()
          Returns a copy the current contents of the undo stack
static boolean isStarted()
           
static void push(java.lang.Object pInstance, java.lang.String pMethod)
          Stores a compensating tx
static void push(java.lang.Object pInstance, java.lang.String pMethod, boolean pArgument)
          Stores a compensating tx
static void push(java.lang.Object pInstance, java.lang.String pMethod, byte pArgument)
          Stores a compensating tx
static void push(java.lang.Object pInstance, java.lang.String pMethod, char pArgument)
          Stores a compensating tx
static void push(java.lang.Object pInstance, java.lang.String pMethod, int pArgument)
          Stores a compensating tx
static void push(java.lang.Object pInstance, java.lang.String pMethod, long pArgument)
          Stores a compensating tx
static void push(java.lang.Object pInstance, java.lang.String pMethod, java.lang.Object pArgument)
          Stores a compensating tx
static void push(java.lang.Object pInstance, java.lang.String pMethod, short pArgument)
          Stores a compensating tx
static void rollback()
          Drops last element from push action
static void start()
          Activates undo
static void suspend()
          Suspends undo
static void undo()
          Executes the compensting transaction, if any.
static int undoCount()
          Returns the current number of undo objects
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERBOSE_UNDO

public static final boolean VERBOSE_UNDO
See Also:
Constant Field Values
Constructor Detail

UndoManager

public UndoManager()
Method Detail

start

public static void start()
Activates undo


suspend

public static void suspend()
Suspends undo


isStarted

public static boolean isStarted()

clear

public static void clear()
Drops the complete undo and redo stack (e. g. after loading a new file)


rollback

public static void rollback()
                     throws UndoException
Drops last element from push action

UndoException

push

public static void push(java.lang.Object pInstance,
                        java.lang.String pMethod,
                        java.lang.Object pArgument)
                 throws UndoException
Stores a compensating tx

UndoException

push

public static void push(java.lang.Object pInstance,
                        java.lang.String pMethod,
                        boolean pArgument)
                 throws UndoException
Stores a compensating tx

UndoException

push

public static void push(java.lang.Object pInstance,
                        java.lang.String pMethod,
                        int pArgument)
                 throws UndoException
Stores a compensating tx

UndoException

push

public static void push(java.lang.Object pInstance,
                        java.lang.String pMethod,
                        long pArgument)
                 throws UndoException
Stores a compensating tx

UndoException

push

public static void push(java.lang.Object pInstance,
                        java.lang.String pMethod,
                        short pArgument)
                 throws UndoException
Stores a compensating tx

UndoException

push

public static void push(java.lang.Object pInstance,
                        java.lang.String pMethod,
                        byte pArgument)
                 throws UndoException
Stores a compensating tx

UndoException

push

public static void push(java.lang.Object pInstance,
                        java.lang.String pMethod,
                        char pArgument)
                 throws UndoException
Stores a compensating tx

UndoException

push

public static void push(java.lang.Object pInstance,
                        java.lang.String pMethod)
                 throws UndoException
Stores a compensating tx

UndoException

undo

public static void undo()
                 throws UndoException
Executes the compensting transaction, if any.

Throws:
UndoException, - if no undo available or tx cannot be executed
UndoException

getUndoStack

public static java.util.Stack getUndoStack()
Returns a copy the current contents of the undo stack


beginCompoundUndo

public static void beginCompoundUndo()
Begins a compund undo. All following pushes will be collected in a list. Call endCompoundUndo to finish this list. Compound undo's are useful, if you like to restore a complex operation in one shot. Nested class of beginCompoundUndo are allowed as far as the number endCompundUndo matches


endCompoundUndo

public static void endCompoundUndo()
Finish a previous opened compound undo

Throws:
UndoException, - if not compound undo was begun

undoCount

public static int undoCount()
Returns the current number of undo objects


canUndo

public static boolean canUndo()
Returns true, if undo items are available



Fopps 0.19 - Copyright © 2002 Oliver Wieland. All Rights Reserved.