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 ILcdUndoable
s 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 ILcdUndoable
s 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
ConstructorDescriptionCreates an undo manager with a default limit.TLcdUndoManager
(int aLimit) Creates an undo manager with the specified limit. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChangeListener
(ILcdChangeListener aChangeListener) Adds a status listener to this manager that will be notified when anything about the undo manager changes.void
addUndoable
(ILcdUndoable aUndoable) Adds an ILcdUndoable to this undo manager.void
Discards allILcdUndoable
objects managed by thisTLcdUndoManager
.Returns theILcdUndoable
that will be triggered upon the next redo.Returns theILcdUndoable
that will be triggered upon the next undo.int
getLimit()
Returns the limit that is set on this manager.boolean
Deprecated.This method has been deprecated.void
redo()
Redoes the significantILcdUndoable
that was undone last.void
removeChangeListener
(ILcdChangeListener aChangeListener) Removes the specified change listener from this manager.void
removeStatusListener
(ILcdChangeListener aChangeListener) Deprecated.The name of this method is wrong.static void
setClassTraceOn
(boolean aClassTraceOn) Deprecated.This method has been deprecated.void
setLimit
(int aLimit) Sets an upper limit for the amount ofILcdUndoable
s thisTLcdUndoManager
can hold.void
setTraceOn
(boolean aTraceOn) Deprecated.This method has been deprecated.void
undo()
Undoes the significantILcdUndoable
that was added or redone last.void
undoableHappened
(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 significantILcdUndoable
s 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 istrue
then 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 eithertrue
orfalse
as argument automatically turns off tracing for all other class instances for whichsetTraceOn
has not been called. If the argument isfalse
then 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.Returnstrue
if 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. UseremoveChangeListener
instead.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 theILcdUndoable
contained inaEvent
to this manager.- Specified by:
undoableHappened
in interfaceILcdUndoableListener
- Parameters:
aEvent
- The event describing the newILcdUndoable
.
-
getCurrentUndo
Returns theILcdUndoable
that will be triggered upon the next undo.- Returns:
- The
ILcdUndoable
that will be triggered upon the next undo.
-
getCurrentRedo
Returns theILcdUndoable
that will be triggered upon the next redo.- Returns:
- The
ILcdUndoable
that will be triggered upon the next redo.
-
undo
public void undo()Undoes the significantILcdUndoable
that was added or redone last.- See Also:
-
redo
public void redo()Redoes the significantILcdUndoable
that was undone last.- See Also:
-
addUndoable
Adds an ILcdUndoable to this undo manager. This discards allILcdUndoable
s that could be redone by invokingILcdUndoable.die()
on them.- Parameters:
aUndoable
- The undoable to add to the manager.
-
discardAll
public void discardAll()Discards allILcdUndoable
objects managed by thisTLcdUndoManager
. -
setLimit
public void setLimit(int aLimit) Sets an upper limit for the amount ofILcdUndoable
s thisTLcdUndoManager
can 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
ILcdUndoable
s this manager can hold.
-