Class TLcdUndoManager

java.lang.Object
com.luciad.gui.TLcdUndoManager
All Implemented Interfaces:
ILcdUndoableListener, EventListener

public class TLcdUndoManager extends Object implements ILcdUndoableListener

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 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 significant ILcdUndoables 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 is true 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 either true or false as argument automatically turns off tracing for all other class instances for which setTraceOn has not been called. If the argument is false 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.
      Returns true if tracing is enabled for this class.
      Returns:
      true if tracing is enabled for this class, false otherwise.
    • addChangeListener

      public void addChangeListener(ILcdChangeListener aChangeListener)
      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

      public void removeChangeListener(ILcdChangeListener aChangeListener)
      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

      public void removeStatusListener(ILcdChangeListener aChangeListener)
      Deprecated.
      The name of this method is wrong. Use removeChangeListener 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

      public void undoableHappened(TLcdUndoableEvent aEvent)
      Implementation of ILcdUndoableListener.undoableHappened(TLcdUndoableEvent). Adds the ILcdUndoable contained in aEvent to this manager.
      Specified by:
      undoableHappened in interface ILcdUndoableListener
      Parameters:
      aEvent - The event describing the new ILcdUndoable.
    • getCurrentUndo

      public ILcdUndoable getCurrentUndo()
      Returns the ILcdUndoable that will be triggered upon the next undo.
      Returns:
      The ILcdUndoable that will be triggered upon the next undo.
    • getCurrentRedo

      public ILcdUndoable getCurrentRedo()
      Returns the ILcdUndoable 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 significant ILcdUndoable that was added or redone last.
      See Also:
    • redo

      public void redo()
      Redoes the significant ILcdUndoable that was undone last.
      See Also:
    • addUndoable

      public void addUndoable(ILcdUndoable aUndoable)
      Adds an ILcdUndoable to this undo manager. This discards all ILcdUndoables that could be redone by invoking ILcdUndoable.die() on them.
      Parameters:
      aUndoable - The undoable to add to the manager.
    • discardAll

      public void discardAll()
      Discards all ILcdUndoable objects managed by this TLcdUndoManager.
    • setLimit

      public void setLimit(int aLimit)
      Sets an upper limit for the amount of ILcdUndoables this TLcdUndoManager 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 ILcdUndoables this manager can hold.