Class MapUndoManager

  • All Implemented Interfaces:
    java.io.Serializable, java.util.EventListener, javax.swing.event.UndoableEditListener, javax.swing.undo.UndoableEdit

    public class MapUndoManager
    extends javax.swing.undo.UndoManager
    A subclass of UndoManager that notifies about any edit to the subscribed ChangeListeners.
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class javax.swing.undo.CompoundEdit

        edits
      • Fields inherited from class javax.swing.undo.AbstractUndoableEdit

        RedoName, UndoName
    • Constructor Summary

      Constructors 
      Constructor Description
      MapUndoManager()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addChangeListener​(javax.swing.event.ChangeListener l)
      Adds a ChangeListener
      boolean addEdit​(javax.swing.undo.UndoableEdit anEdit)  
      void discardAllEdits()  
      int getNumberOfEdits()
      Returns the current number of edits
      void redo()  
      void removeChangeListener​(javax.swing.event.ChangeListener l)
      Removes the given ChangeListener
      boolean trimEdits​(javax.swing.undo.UndoableEdit from, boolean inclusiveFrom)  
      boolean trimEdits​(javax.swing.undo.UndoableEdit from, boolean inclusiveFrom, javax.swing.undo.UndoableEdit to, boolean inclusiveTo)
      Removes edits in the specified range.
      boolean trimEdits​(javax.swing.undo.UndoableEdit from, javax.swing.undo.UndoableEdit to)
      Removes edits in the specified range.
      void undo()  
      boolean undoORredoPerfomed()
      Returns true if an undo or redo action was performed
      • Methods inherited from class javax.swing.undo.UndoManager

        canRedo, canUndo, 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
    • Constructor Detail

      • MapUndoManager

        public MapUndoManager()
    • Method Detail

      • addEdit

        public boolean addEdit​(javax.swing.undo.UndoableEdit anEdit)
        Specified by:
        addEdit in interface javax.swing.undo.UndoableEdit
        Overrides:
        addEdit in class javax.swing.undo.UndoManager
      • trimEdits

        public boolean trimEdits​(javax.swing.undo.UndoableEdit from,
                                 boolean inclusiveFrom)
      • trimEdits

        public boolean trimEdits​(javax.swing.undo.UndoableEdit from,
                                 javax.swing.undo.UndoableEdit to)
        Removes edits in the specified range.
        Parameters:
        from - the minimum UndoableEdit to remove
        to - the maximum UndoableEdit to remove
        Returns:
      • trimEdits

        public boolean trimEdits​(javax.swing.undo.UndoableEdit from,
                                 boolean inclusiveFrom,
                                 javax.swing.undo.UndoableEdit to,
                                 boolean inclusiveTo)
        Removes edits in the specified range.
        Parameters:
        from - the minimum UndoableEdit to remove
        inclusiveFrom - true if the 'from' UndoableEdit has to be included
        to - the maximum UndoableEdit to remove
        inclusiveTo - true if the 'to' UndoableEdit has to be included
        Returns:
      • discardAllEdits

        public void discardAllEdits()
        Overrides:
        discardAllEdits in class javax.swing.undo.UndoManager
      • undo

        public void undo()
                  throws javax.swing.undo.CannotUndoException
        Specified by:
        undo in interface javax.swing.undo.UndoableEdit
        Overrides:
        undo in class javax.swing.undo.UndoManager
        Throws:
        javax.swing.undo.CannotUndoException
      • redo

        public void redo()
                  throws javax.swing.undo.CannotRedoException
        Specified by:
        redo in interface javax.swing.undo.UndoableEdit
        Overrides:
        redo in class javax.swing.undo.UndoManager
        Throws:
        javax.swing.undo.CannotRedoException
      • undoORredoPerfomed

        public boolean undoORredoPerfomed()
        Returns true if an undo or redo action was performed
        Returns:
      • addChangeListener

        public void addChangeListener​(javax.swing.event.ChangeListener l)
        Adds a ChangeListener
        Parameters:
        l -
      • removeChangeListener

        public void removeChangeListener​(javax.swing.event.ChangeListener l)
        Removes the given ChangeListener
        Parameters:
        l -
      • getNumberOfEdits

        public int getNumberOfEdits()
        Returns the current number of edits
        Returns: