Package kiyut.sketsa.undo
Class DOMUndoManager
- java.lang.Object
-
- javax.swing.undo.AbstractUndoableEdit
-
- javax.swing.undo.CompoundEdit
-
- javax.swing.undo.UndoManager
-
- kiyut.sketsa.undo.DOMUndoManager
-
- All Implemented Interfaces:
Serializable,EventListener,UndoableEditListener,UndoableEdit
public class DOMUndoManager extends UndoManager
DOMUndoManager. Note: This is not a thread safe class.- Author:
- KIYUT
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classDOMUndoManager.EntryUndo EntryclassDOMUndoManager.ExtendedCompoundEdit
-
Field Summary
Fields Modifier and Type Field Description protected DOMUndoManager.EntrycurrentEntryprotected org.w3c.dom.svg.SVGDocumentdocumentprotected EventListenerdomListenerprotected booleanendprotected booleaninProgressprotected intlimitprotected EventListenerListlistenerListprotected List<DOMUndoManager.Entry>redoListprotected List<DOMUndoManager.Entry>undoList-
Fields inherited from class javax.swing.undo.CompoundEdit
edits
-
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
-
-
Constructor Summary
Constructors Constructor Description DOMUndoManager()Creates a new instance of DOMUndoManager.DOMUndoManager(int limit)Creates a new instance of DOMUndoManager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddDOMEventListener(EventTarget et)voidaddUndoableEditListener(UndoableEditListener listener)Registers an UndoableEditListener.voidcancel()Cancel the recording of changebooleancanRedo()booleancanUndo()voiddiscardAllEdits()protected voiddomNodeHandleEvent(Event evt)voidend()Stop recording the changeprotected voidfireUndoableEditHappened()Notifies all listeners that have registered interest for notification on this event type.intgetLimit()StringgetRedoPresentationName()StringgetUndoOrRedoPresentationName()StringgetUndoPresentationName()voidredo()protected voidremoveDOMEventListener(EventTarget et)voidremoveUndoableEditListener(UndoableEditListener listener)Removes an UndoableEditListener.voidsetLimit(int limit)voidsetSVGDocument(org.w3c.dom.svg.SVGDocument doc)setSVGDocumentto be monitoredvoidstart(String name)Start recording the changevoidundo()-
Methods inherited from class javax.swing.undo.UndoManager
addEdit, canUndoOrRedo, editToBeRedone, editToBeUndone, redoTo, 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
-
-
-
-
Field Detail
-
domListener
protected EventListener domListener
-
document
protected org.w3c.dom.svg.SVGDocument document
-
listenerList
protected EventListenerList listenerList
-
limit
protected int limit
-
undoList
protected List<DOMUndoManager.Entry> undoList
-
redoList
protected List<DOMUndoManager.Entry> redoList
-
currentEntry
protected DOMUndoManager.Entry currentEntry
-
end
protected boolean end
-
inProgress
protected boolean inProgress
-
-
Method Detail
-
addUndoableEditListener
public void addUndoableEditListener(UndoableEditListener listener)
Registers an UndoableEditListener. The listener is notified whenever an edit occurs which can be undone.- Parameters:
listener- Listener to be added
-
removeUndoableEditListener
public void removeUndoableEditListener(UndoableEditListener listener)
Removes an UndoableEditListener.- Parameters:
listener- Listener to be removed
-
fireUndoableEditHappened
protected void fireUndoableEditHappened()
Notifies all listeners that have registered interest for notification on this event type.
-
getLimit
public int getLimit()
- Overrides:
getLimitin classUndoManager
-
setLimit
public void setLimit(int limit)
- Overrides:
setLimitin classUndoManager
-
start
public void start(String name)
Start recording the change- Parameters:
name- The name of the Undoable
-
end
public void end()
Stop recording the change- Overrides:
endin classUndoManager
-
cancel
public void cancel()
Cancel the recording of change
-
discardAllEdits
public void discardAllEdits()
- Overrides:
discardAllEditsin classUndoManager
-
canUndo
public boolean canUndo()
- Specified by:
canUndoin interfaceUndoableEdit- Overrides:
canUndoin classUndoManager
-
canRedo
public boolean canRedo()
- Specified by:
canRedoin interfaceUndoableEdit- Overrides:
canRedoin classUndoManager
-
undo
public void undo() throws CannotUndoException- Specified by:
undoin interfaceUndoableEdit- Overrides:
undoin classUndoManager- Throws:
CannotUndoException
-
redo
public void redo() throws CannotRedoException- Specified by:
redoin interfaceUndoableEdit- Overrides:
redoin classUndoManager- Throws:
CannotRedoException
-
setSVGDocument
public void setSVGDocument(org.w3c.dom.svg.SVGDocument doc)
setSVGDocumentto be monitored- Parameters:
doc-SVGDocument
-
getUndoOrRedoPresentationName
public String getUndoOrRedoPresentationName()
- Overrides:
getUndoOrRedoPresentationNamein classUndoManager
-
getUndoPresentationName
public String getUndoPresentationName()
- Specified by:
getUndoPresentationNamein interfaceUndoableEdit- Overrides:
getUndoPresentationNamein classUndoManager
-
getRedoPresentationName
public String getRedoPresentationName()
- Specified by:
getRedoPresentationNamein interfaceUndoableEdit- Overrides:
getRedoPresentationNamein classUndoManager
-
addDOMEventListener
protected void addDOMEventListener(EventTarget et)
-
removeDOMEventListener
protected void removeDOMEventListener(EventTarget et)
-
domNodeHandleEvent
protected void domNodeHandleEvent(Event evt)
-
-