com.jaxfront.core.util.undo
Class JAXFrontUndoManager

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by javax.swing.undo.CompoundEdit
          extended by com.jaxfront.core.util.undo.UndoManagerWrapper
              extended by com.jaxfront.core.util.undo.JAXFrontUndoManager
All Implemented Interfaces:
java.io.Serializable, java.util.EventListener, javax.swing.event.UndoableEditListener, javax.swing.undo.UndoableEdit

public class JAXFrontUndoManager
extends UndoManagerWrapper

See Also:
Serialized Form

Constructor Summary
JAXFrontUndoManager(Document dom)
           
 
Method Summary
 void abortCompoundEdit()
           
 void addChangeSerializationUndoableEditEvent(java.lang.Object eventSource, Type target, boolean newValue, boolean oldValue)
           
 void addChoiceChangeUndoableEditEvent(java.lang.Object eventSource, Type target, Type newValue, Type oldValue, boolean isTemporary)
           
 void addListChangeEditEvent(java.lang.Object eventSource, ListType target, Type listItem, int index, short action)
           
 void addListItemMovedEvent(java.lang.Object eventSource, ListType target, int from, int to)
           
 void addListSortEvent(java.lang.Object eventSource, ListType target, int direction, int inverseDirection, java.lang.String actionName)
           
 void addMacroEdit(javax.swing.undo.UndoableEdit edit)
           
 void addPasteUndoableEditEvent(java.lang.Object eventSource, Type target, java.lang.String newValue, java.lang.String oldValue, boolean isTemporary)
           
 void addPropertyChangeEditEvent(java.lang.Object eventSource, SimpleType target, java.lang.String newValue, java.lang.String oldValue)
           
 void addRecursionEventUndoableEditWrapper(java.lang.Object eventSource, Type recursionType, short action)
           
 void addUndoableEditListener(javax.swing.event.UndoableEditListener listener)
          Adds an undo listener for notification of any changes.
 void blockInput(boolean blocked)
           
 boolean canMacroRedo()
           
 boolean canMacroRedo(int from)
           
 boolean canMacroUndo()
           
 boolean canMacroUndo(int from)
           
 void createFromSerialize(org.w3c.dom.Document serialDom)
           
 void discardAllEdits()
          Empty the undo manager, sending each edit a die message in the process.
 java.util.List getEditSteps()
           
 int getMaxEditIndex()
           
 int getNextEditIndex()
           
 javax.swing.event.UndoableEditListener[] getUndoableEditListeners()
          Returns an array of all the undoable edit listeners registered on this document.
 boolean isBlocked()
           
 boolean isInCompoundEditState()
           
 boolean isRedoing()
           
 boolean isUndoing()
           
 void macroRedo()
           
 void macroRedo(int from)
           
 void macroUndo()
           
 void macroUndo(int from)
           
static JAXFrontUndoableEdit parseEventObject(JAXFrontUndoManager manager, javax.swing.undo.UndoableEdit edit, Document dom, org.w3c.dom.Element event, java.util.List edits)
           
 void redo()
          If this UndoManager is inProgress, redoes the last significant UndoableEdit at indexOfNextAdd or after, and all insignificant edits up to it.
 void release()
           
 void removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
          Removes an undo listener.
 java.lang.String serializeUndoManager()
           
 void serializeUndoManager(java.io.File location)
           
 void serializeUndoManager(java.io.File location, java.util.List editList)
           
 void serializeUndoManager(java.io.PrintWriter writer)
           
 void serializeUndoManager(java.io.PrintWriter writer, java.util.List editList)
           
 void startCompoundEdit()
           
 void stopCompoundEdit()
           
 void undo()
          If this UndoManager is inProgress, undo the last significant UndoableEdit before indexOfNextAdd, and all insignificant edits back to it.
 void undoableEditHappened(javax.swing.event.UndoableEditEvent e)
          Called by the UndoabledEdit sources this UndoManager listens to.
 void write(java.lang.String url)
           
 
Methods inherited from class com.jaxfront.core.util.undo.UndoManagerWrapper
addEdit, canRedo, canUndo, canUndoOrRedo, end, getLimit, getRedoPresentationName, getUndoOrRedoPresentationName, getUndoPresentationName, setLimit, toString, undoOrRedo
 
Methods inherited from class javax.swing.undo.CompoundEdit
die, getPresentationName, isInProgress, isSignificant
 
Methods inherited from class javax.swing.undo.AbstractUndoableEdit
replaceEdit
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JAXFrontUndoManager

public JAXFrontUndoManager(Document dom)
Method Detail

undoableEditHappened

public void undoableEditHappened(javax.swing.event.UndoableEditEvent e)
Description copied from class: UndoManagerWrapper
Called by the UndoabledEdit sources this UndoManager listens to. Calls addEdit with e.getEdit().

Specified by:
undoableEditHappened in interface javax.swing.event.UndoableEditListener
Overrides:
undoableEditHappened in class UndoManagerWrapper
See Also:
UndoManagerWrapper.addEdit(javax.swing.undo.UndoableEdit)

addPropertyChangeEditEvent

public void addPropertyChangeEditEvent(java.lang.Object eventSource,
                                       SimpleType target,
                                       java.lang.String newValue,
                                       java.lang.String oldValue)

addListChangeEditEvent

public void addListChangeEditEvent(java.lang.Object eventSource,
                                   ListType target,
                                   Type listItem,
                                   int index,
                                   short action)

addListItemMovedEvent

public void addListItemMovedEvent(java.lang.Object eventSource,
                                  ListType target,
                                  int from,
                                  int to)

addListSortEvent

public void addListSortEvent(java.lang.Object eventSource,
                             ListType target,
                             int direction,
                             int inverseDirection,
                             java.lang.String actionName)

addChoiceChangeUndoableEditEvent

public void addChoiceChangeUndoableEditEvent(java.lang.Object eventSource,
                                             Type target,
                                             Type newValue,
                                             Type oldValue,
                                             boolean isTemporary)

addChangeSerializationUndoableEditEvent

public void addChangeSerializationUndoableEditEvent(java.lang.Object eventSource,
                                                    Type target,
                                                    boolean newValue,
                                                    boolean oldValue)

addRecursionEventUndoableEditWrapper

public void addRecursionEventUndoableEditWrapper(java.lang.Object eventSource,
                                                 Type recursionType,
                                                 short action)

addPasteUndoableEditEvent

public void addPasteUndoableEditEvent(java.lang.Object eventSource,
                                      Type target,
                                      java.lang.String newValue,
                                      java.lang.String oldValue,
                                      boolean isTemporary)

addUndoableEditListener

public void addUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Adds an undo listener for notification of any changes. Undo/Redo operations performed on the UndoableEdit will cause the appropriate DocumentEvent to be fired to keep the view(s) in sync with the model.

Parameters:
listener - the UndoableEditListener to add
See Also:
Document#addUndoableEditListener

removeUndoableEditListener

public void removeUndoableEditListener(javax.swing.event.UndoableEditListener listener)
Removes an undo listener.

Parameters:
listener - the UndoableEditListener to remove
See Also:
Document#removeDocumentListener

getUndoableEditListeners

public javax.swing.event.UndoableEditListener[] getUndoableEditListeners()
Returns an array of all the undoable edit listeners registered on this document.

Returns:
all of this document's UndoableEditListeners or an empty array if no undoable edit listeners are currently registered
Since:
1.4
See Also:
addUndoableEditListener(javax.swing.event.UndoableEditListener), removeUndoableEditListener(javax.swing.event.UndoableEditListener)

startCompoundEdit

public void startCompoundEdit()

isInCompoundEditState

public boolean isInCompoundEditState()

undo

public void undo()
          throws javax.swing.undo.CannotUndoException
Description copied from class: UndoManagerWrapper
If this UndoManager is inProgress, undo the last significant UndoableEdit before indexOfNextAdd, and all insignificant edits back to it. Updates indexOfNextAdd accordingly.

If not inProgress, indexOfNextAdd is ignored and super's routine is called.

Specified by:
undo in interface javax.swing.undo.UndoableEdit
Overrides:
undo in class UndoManagerWrapper
Throws:
javax.swing.undo.CannotUndoException
See Also:
CompoundEdit.end()

redo

public void redo()
          throws javax.swing.undo.CannotRedoException
Description copied from class: UndoManagerWrapper
If this UndoManager is inProgress, redoes the last significant UndoableEdit at indexOfNextAdd or after, and all insignificant edits up to it. Updates indexOfNextAdd accordingly.

If not inProgress, indexOfNextAdd is ignored and super's routine is called.

Specified by:
redo in interface javax.swing.undo.UndoableEdit
Overrides:
redo in class UndoManagerWrapper
Throws:
javax.swing.undo.CannotRedoException
See Also:
CompoundEdit.end()

stopCompoundEdit

public void stopCompoundEdit()

abortCompoundEdit

public void abortCompoundEdit()

blockInput

public void blockInput(boolean blocked)

isBlocked

public boolean isBlocked()

release

public void release()

serializeUndoManager

public java.lang.String serializeUndoManager()

serializeUndoManager

public void serializeUndoManager(java.io.PrintWriter writer)

serializeUndoManager

public void serializeUndoManager(java.io.PrintWriter writer,
                                 java.util.List editList)

serializeUndoManager

public void serializeUndoManager(java.io.File location)
                          throws java.io.IOException
Throws:
java.io.IOException

serializeUndoManager

public void serializeUndoManager(java.io.File location,
                                 java.util.List editList)
                          throws java.io.IOException
Throws:
java.io.IOException

createFromSerialize

public void createFromSerialize(org.w3c.dom.Document serialDom)

write

public void write(java.lang.String url)

discardAllEdits

public void discardAllEdits()
Description copied from class: UndoManagerWrapper
Empty the undo manager, sending each edit a die message in the process.

Overrides:
discardAllEdits in class UndoManagerWrapper

parseEventObject

public static JAXFrontUndoableEdit parseEventObject(JAXFrontUndoManager manager,
                                                    javax.swing.undo.UndoableEdit edit,
                                                    Document dom,
                                                    org.w3c.dom.Element event,
                                                    java.util.List edits)

canMacroUndo

public boolean canMacroUndo()
                     throws javax.swing.undo.CannotUndoException
Throws:
javax.swing.undo.CannotUndoException

canMacroRedo

public boolean canMacroRedo()

macroUndo

public void macroUndo()
               throws javax.swing.undo.CannotUndoException
Throws:
javax.swing.undo.CannotUndoException

macroRedo

public void macroRedo()

canMacroUndo

public boolean canMacroUndo(int from)
                     throws javax.swing.undo.CannotUndoException
Throws:
javax.swing.undo.CannotUndoException

canMacroRedo

public boolean canMacroRedo(int from)

macroUndo

public void macroUndo(int from)
               throws javax.swing.undo.CannotUndoException
Throws:
javax.swing.undo.CannotUndoException

macroRedo

public void macroRedo(int from)

getNextEditIndex

public int getNextEditIndex()

getMaxEditIndex

public int getMaxEditIndex()

getEditSteps

public java.util.List getEditSteps()

addMacroEdit

public void addMacroEdit(javax.swing.undo.UndoableEdit edit)

isUndoing

public boolean isUndoing()

isRedoing

public boolean isRedoing()