JIDE 3.5.15

com.jidesoft.swing
Class DelayUndoManager

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by javax.swing.undo.CompoundEdit
          extended by javax.swing.undo.UndoManager
              extended by com.jidesoft.swing.DelayUndoManager
All Implemented Interfaces:
Serializable, EventListener, UndoableEditListener, UndoableEdit

public class DelayUndoManager
extends UndoManager

An undo manager that aggregates UndoableEdits into one CompoundEdit if they are executed very close to each other. By default, the gap is 500 ms. You can control it by passing in a different number in the constructor.

See Also:
Serialized Form

Field Summary
protected  Timer _timer
           
 
Fields inherited from class javax.swing.undo.CompoundEdit
edits
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary
DelayUndoManager()
           
DelayUndoManager(int delay)
           
 
Method Summary
 boolean addEdit(UndoableEdit anEdit)
           
 void addEditWithoutCaching()
          Calls super.addEdit without caching.
 boolean canRedo()
          Override to commit the cache before checking redo status.
 boolean canUndo()
          Override to commit the cache before checking undo status.
 void commitCache()
          Commits the cached edit.
 void discardAllEdits()
           
 void discardCache()
           
 boolean isCacheEmpty()
          Checks if there are pending edits in the DelayUndoManager.
 void redo()
          Override to commit the cache before redo.
 void undo()
          Override to commit the cache before undo.
 
Methods inherited from class javax.swing.undo.UndoManager
canUndoOrRedo, editToBeRedone, editToBeUndone, end, getLimit, getRedoPresentationName, getUndoOrRedoPresentationName, getUndoPresentationName, redoTo, setLimit, toString, trimEdits, trimForLimit, undoableEditHappened, undoOrRedo, undoTo
 
Methods inherited from class javax.swing.undo.CompoundEdit
die, getPresentationName, isInProgress, isSignificant, lastEdit
 
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
replaceEdit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_timer

protected Timer _timer
Constructor Detail

DelayUndoManager

public DelayUndoManager()

DelayUndoManager

public DelayUndoManager(int delay)
Method Detail

isCacheEmpty

public boolean isCacheEmpty()
Checks if there are pending edits in the DelayUndoManager.

Returns:
true if there are pending edits. Otherwise false.

commitCache

public void commitCache()
Commits the cached edit.


addEditWithoutCaching

public void addEditWithoutCaching()
Calls super.addEdit without caching.


discardCache

public void discardCache()

addEdit

public boolean addEdit(UndoableEdit anEdit)
Specified by:
addEdit in interface UndoableEdit
Overrides:
addEdit in class UndoManager

canUndo

public boolean canUndo()
Override to commit the cache before checking undo status.

Specified by:
canUndo in interface UndoableEdit
Overrides:
canUndo in class UndoManager
Returns:
true if an undo operation would be successful now, false otherwise

canRedo

public boolean canRedo()
Override to commit the cache before checking redo status.

Specified by:
canRedo in interface UndoableEdit
Overrides:
canRedo in class UndoManager
Returns:
true if an redo operation would be successful now, false otherwise

undo

public void undo()
          throws CannotUndoException
Override to commit the cache before undo.

Specified by:
undo in interface UndoableEdit
Overrides:
undo in class UndoManager
Throws:
CannotUndoException

redo

public void redo()
          throws CannotRedoException
Override to commit the cache before redo.

Specified by:
redo in interface UndoableEdit
Overrides:
redo in class UndoManager
Throws:
CannotRedoException

discardAllEdits

public void discardAllEdits()
Overrides:
discardAllEdits in class UndoManager

JIDE 3.5.15