org.jhotdraw.undo
Class UndoRedoManager
- java.lang.Object
-
- javax.swing.undo.AbstractUndoableEdit
-
- javax.swing.undo.CompoundEdit
-
- javax.swing.undo.UndoManager
-
- org.jhotdraw.undo.UndoRedoManager
-
- All Implemented Interfaces:
- java.io.Serializable, java.util.EventListener, javax.swing.event.UndoableEditListener, javax.swing.undo.UndoableEdit
public class UndoRedoManager extends javax.swing.undo.UndoManagerSame as javax.swing.UndoManager but provides actions for undo and redo operations.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static javax.swing.undo.UndoableEditDISCARD_ALL_EDITSSending this UndoableEdit event to the UndoRedoManager disables the Undo and Redo functions of the manager.
-
Constructor Summary
Constructors Constructor and Description UndoRedoManager()Creates new UndoRedoManager
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanaddEdit(javax.swing.undo.UndoableEdit anEdit)If inProgress, inserts anEdit at indexOfNextAdd, and removes any old edits that were at indexOfNextAdd or later.voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)voidaddPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)voiddiscardAllEdits()Discards all edits.static ResourceBundleUtilgetLabels()javax.swing.ActiongetRedoAction()Gets the redo action for use as a Redo menu item.javax.swing.ActiongetUndoAction()Gets the undo action for use as an Undo menu item.booleanhasSignificantEdits()Returns true if at least one significant UndoableEdit has been added since the last call to discardAllEdits.voidredo()Redoes the last undone edit event.voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)voidremovePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)voidsetHasSignificantEdits(boolean newValue)voidsetLocale(java.util.Locale l)voidundo()Undoes the last edit event.voidundoOrRedo()Undoes or redoes the last edit event.-
Methods inherited from class javax.swing.undo.UndoManager
canRedo, canUndo, canUndoOrRedo, end, getLimit, getRedoPresentationName, getUndoOrRedoPresentationName, getUndoPresentationName, setLimit, toString, undoableEditHappened
-
-
-
-
Field Detail
-
DISCARD_ALL_EDITS
public static final javax.swing.undo.UndoableEdit DISCARD_ALL_EDITS
Sending this UndoableEdit event to the UndoRedoManager disables the Undo and Redo functions of the manager.
-
-
Method Detail
-
getLabels
public static ResourceBundleUtil getLabels()
-
setLocale
public void setLocale(java.util.Locale l)
-
discardAllEdits
public void discardAllEdits()
Discards all edits.- Overrides:
discardAllEditsin classjavax.swing.undo.UndoManager
-
setHasSignificantEdits
public void setHasSignificantEdits(boolean newValue)
-
hasSignificantEdits
public boolean hasSignificantEdits()
Returns true if at least one significant UndoableEdit has been added since the last call to discardAllEdits.
-
addEdit
public boolean addEdit(javax.swing.undo.UndoableEdit anEdit)
If inProgress, inserts anEdit at indexOfNextAdd, and removes any old edits that were at indexOfNextAdd or later. The die method is called on each edit that is removed is sent, in the reverse of the order the edits were added. Updates indexOfNextAdd.If not inProgress, acts as a CompoundEdit
Regardless of inProgress, if undoOrRedoInProgress, calls die on each edit that is sent.
- Specified by:
addEditin interfacejavax.swing.undo.UndoableEdit- Overrides:
addEditin classjavax.swing.undo.UndoManager- See Also:
CompoundEdit.end(),CompoundEdit.addEdit(javax.swing.undo.UndoableEdit)
-
getUndoAction
public javax.swing.Action getUndoAction()
Gets the undo action for use as an Undo menu item.
-
getRedoAction
public javax.swing.Action getRedoAction()
Gets the redo action for use as a Redo menu item.
-
undo
public void undo() throws javax.swing.undo.CannotUndoExceptionUndoes the last edit event. The UndoRedoManager ignores all incoming UndoableEdit events, while undo is in progress.- Specified by:
undoin interfacejavax.swing.undo.UndoableEdit- Overrides:
undoin classjavax.swing.undo.UndoManager- Throws:
javax.swing.undo.CannotUndoException
-
redo
public void redo() throws javax.swing.undo.CannotUndoExceptionRedoes the last undone edit event. The UndoRedoManager ignores all incoming UndoableEdit events, while redo is in progress.- Specified by:
redoin interfacejavax.swing.undo.UndoableEdit- Overrides:
redoin classjavax.swing.undo.UndoManager- Throws:
javax.swing.undo.CannotUndoException
-
undoOrRedo
public void undoOrRedo() throws javax.swing.undo.CannotUndoException, javax.swing.undo.CannotRedoExceptionUndoes or redoes the last edit event. The UndoRedoManager ignores all incoming UndoableEdit events, while undo or redo is in progress.- Overrides:
undoOrRedoin classjavax.swing.undo.UndoManager- Throws:
javax.swing.undo.CannotUndoExceptionjavax.swing.undo.CannotRedoException
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
-
addPropertyChangeListener
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
-
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG