Package com.luciad.gui
Class TLcdUndoManager
java.lang.Object
com.luciad.gui.TLcdUndoManager
- All Implemented Interfaces:
ILcdUndoableListener,EventListener
This class is a manager for classes that implement the ILcdUndoable interface.
One can add ILcdUndoables to this manager which can then later be undone and redone
using the methods undo() and redo().
For convenience, it implements ILcdUndoableListener. This allows to add a
TLcdUndoManager as a listener to any class that supports undo/redo (e.g. the TLcdGXYZoomController). Any ILcdUndoables that are
emitted by this class will then be added to this manager.
The public methods of this class are synchronized, and should be safe to call from multiple
threads. This should make TLcdUndoManager a convenient marshall for classes that
support the undo/redo mechanism.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an undo manager with a default limit.TLcdUndoManager(int aLimit) Creates an undo manager with the specified limit. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChangeListener(ILcdChangeListener aChangeListener) Adds a status listener to this manager that will be notified when anything about the undo manager changes.voidaddUndoable(ILcdUndoable aUndoable) Adds an ILcdUndoable to this undo manager.voidDiscards allILcdUndoableobjects managed by thisTLcdUndoManager.Returns theILcdUndoablethat will be triggered upon the next redo.Returns theILcdUndoablethat will be triggered upon the next undo.intgetLimit()Returns the limit that is set on this manager.booleanDeprecated.This method has been deprecated.voidredo()Redoes the significantILcdUndoablethat was undone last.voidremoveChangeListener(ILcdChangeListener aChangeListener) Removes the specified change listener from this manager.voidremoveStatusListener(ILcdChangeListener aChangeListener) Deprecated.The name of this method is wrong.static voidsetClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated.voidsetLimit(int aLimit) Sets an upper limit for the amount ofILcdUndoables thisTLcdUndoManagercan hold.voidsetTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated.voidundo()Undoes the significantILcdUndoablethat was added or redone last.voidundoableHappened(TLcdUndoableEvent aEvent) Implementation ofILcdUndoableListener.undoableHappened(TLcdUndoableEvent).
-
Constructor Details
-
TLcdUndoManager
public TLcdUndoManager()Creates an undo manager with a default limit. -
TLcdUndoManager
public TLcdUndoManager(int aLimit) Creates an undo manager with the specified limit.- Parameters:
aLimit- The number of significantILcdUndoables this manager should keep track of.- See Also:
-
-
Method Details
-
setClassTraceOn
public static void setClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for all instances of this class. If the argument istruethen all log messages are recorded, otherwise only the informative, warning and error messages are recorded.- Parameters:
aClassTraceOn- if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
-
setTraceOn
public void setTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for this class instance. Calling this method with eithertrueorfalseas argument automatically turns off tracing for all other class instances for whichsetTraceOnhas not been called. If the argument isfalsethen only the informative, warning and error log messages are recorded.- Parameters:
aTraceOn- if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
-
isTraceOn
public boolean isTraceOn()Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Returnstrueif tracing is enabled for this class.- Returns:
- true if tracing is enabled for this class, false otherwise.
-
addChangeListener
Adds a status listener to this manager that will be notified when anything about the undo manager changes.- Parameters:
aChangeListener- The status listener that will be notified when the undo manager changes.
-
removeChangeListener
Removes the specified change listener from this manager. This change listener will no longer be notified when the undo manager changes.- Parameters:
aChangeListener- The change listener that should no longer be notified of changes in the undo manager.
-
removeStatusListener
Deprecated.The name of this method is wrong. UseremoveChangeListenerinstead.Removes the specified change listener from this manager. This change listener will no longer be notified when the undo manager changes.- Parameters:
aChangeListener- The change listener that should no longer be notified of changes in the undo manager.
-
undoableHappened
Implementation ofILcdUndoableListener.undoableHappened(TLcdUndoableEvent). Adds theILcdUndoablecontained inaEventto this manager.- Specified by:
undoableHappenedin interfaceILcdUndoableListener- Parameters:
aEvent- The event describing the newILcdUndoable.
-
getCurrentUndo
Returns theILcdUndoablethat will be triggered upon the next undo.- Returns:
- The
ILcdUndoablethat will be triggered upon the next undo.
-
getCurrentRedo
Returns theILcdUndoablethat will be triggered upon the next redo.- Returns:
- The
ILcdUndoablethat will be triggered upon the next redo.
-
undo
public void undo()Undoes the significantILcdUndoablethat was added or redone last.- See Also:
-
redo
public void redo()Redoes the significantILcdUndoablethat was undone last.- See Also:
-
addUndoable
Adds an ILcdUndoable to this undo manager. This discards allILcdUndoables that could be redone by invokingILcdUndoable.die()on them.- Parameters:
aUndoable- The undoable to add to the manager.
-
discardAll
public void discardAll()Discards allILcdUndoableobjects managed by thisTLcdUndoManager. -
setLimit
public void setLimit(int aLimit) Sets an upper limit for the amount ofILcdUndoables thisTLcdUndoManagercan hold. Use -1 to indicate there is no upper limit. This limit only applies to the number of significant undoables that can be held.- Parameters:
aLimit- The new upper limit, or -1 to disable the upper limit.
-
getLimit
public int getLimit()Returns the limit that is set on this manager.- Returns:
- The amount of
ILcdUndoables this manager can hold.
-