Interface UndoDelegateContext

  • All Superinterfaces:
    Changeable

    public interface UndoDelegateContext
    extends Changeable

    Used to take control of the undo/redo stack. Normally, undo/redo is done by registering an Object "context" with the UndoManager, and then adding undo actions. The context is normally an opaque object used only for equality purposes to keep the undo stacks of different parts of the UI separate.

    If the context you register with the undo manager just so happens to implement this interface, however, then the undo stack and undo actions are not used. Instead, the undo actions delegate to the methods defined on this interface. Note that this interface extends from Changeable, and should fire change events when the "answers" to the can* methods has changed.

    Since:
    7.8.0
    • Method Detail

      • canUndo

        boolean canUndo()
        Controls whether or not the undo action will be enabled.
        Returns:
        true if the undo action is currently available.
      • canRedo

        boolean canRedo()
        Controls whether or not the redo action will be enabled.
        Returns:
        true if the redo action is currently available.
      • undo

        void undo()
        Perform the undo action.
      • redo

        void redo()
        Perform the redo action.
      • getUndoDescription

        java.lang.String getUndoDescription()
        Returns:
        A description of the next undo action that would be performed, or empty string if unable to compute.
      • getRedoDescription

        java.lang.String getRedoDescription()
        Returns:
        A description of the next redo action that would be performed, or empty string if unable to compute.