Class UndoRedo.Manager
java.lang.Object
javax.swing.undo.AbstractUndoableEdit
javax.swing.undo.CompoundEdit
javax.swing.undo.UndoManager
org.openide.awt.UndoRedo.Manager
- All Implemented Interfaces:
Serializable
,EventListener
,UndoableEditListener
,UndoableEdit
,UndoRedo
- Enclosing interface:
UndoRedo
An undo manager which fires a change event each time it consumes a new undoable edit.
Compared to Swing this implementation is more stable. If any contained undo edit throws an exception from its undo/redo methods the implementation will fail gracefully (unlike in Swing it will not change an internal pointer inside edits).
Compared to Swing this implementation is more stable. If any contained undo edit throws an exception from its undo/redo methods the implementation will fail gracefully (unlike in Swing it will not change an internal pointer inside edits).
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.openide.awt.UndoRedo
UndoRedo.Empty, UndoRedo.Manager, UndoRedo.Provider
-
Field Summary
Fields inherited from class javax.swing.undo.CompoundEdit
edits
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a change listener.boolean
addEdit
(UndoableEdit anEdit) boolean
canRedo()
Test whether the component currently has undone edits which may be redone.boolean
canUndo()
Test whether the component currently has edits which may be undone.boolean
void
die()
void
protected UndoableEdit
protected UndoableEdit
void
end()
int
getLimit()
Get a human-presentable name describing the redo operation.Get a human-presentable name describing the undo operation.boolean
boolean
protected UndoableEdit
lastEdit()
void
redo()
Redo a previously undone edit.protected void
redoTo
(UndoableEdit edit) void
Remove a change listener.boolean
replaceEdit
(UndoableEdit anEdit) void
setLimit
(int l) toString()
protected void
trimEdits
(int from, int to) protected void
void
undo()
Undo an edit.void
Consume an undoable edit.void
protected void
undoTo
(UndoableEdit edit)
-
Constructor Details
-
Manager
public Manager()
-
-
Method Details
-
die
public void die()- Specified by:
die
in interfaceUndoableEdit
- Overrides:
die
in classCompoundEdit
-
isInProgress
public boolean isInProgress()- Overrides:
isInProgress
in classCompoundEdit
-
end
public void end()- Overrides:
end
in classUndoManager
-
undo
Description copied from interface:UndoRedo
Undo an edit.- Specified by:
undo
in interfaceUndoableEdit
- Specified by:
undo
in interfaceUndoRedo
- Overrides:
undo
in classUndoManager
- Throws:
CannotUndoException
- if it fails
-
undoTo
- Overrides:
undoTo
in classUndoManager
- Throws:
CannotUndoException
-
canUndo
public boolean canUndo()Description copied from interface:UndoRedo
Test whether the component currently has edits which may be undone.- Specified by:
canUndo
in interfaceUndoableEdit
- Specified by:
canUndo
in interfaceUndoRedo
- Overrides:
canUndo
in classUndoManager
- Returns:
true
if undo is allowed
-
redo
Description copied from interface:UndoRedo
Redo a previously undone edit.- Specified by:
redo
in interfaceUndoableEdit
- Specified by:
redo
in interfaceUndoRedo
- Overrides:
redo
in classUndoManager
- Throws:
CannotRedoException
- if it fails
-
redoTo
- Overrides:
redoTo
in classUndoManager
- Throws:
CannotRedoException
-
canRedo
public boolean canRedo()Description copied from interface:UndoRedo
Test whether the component currently has undone edits which may be redone.- Specified by:
canRedo
in interfaceUndoableEdit
- Specified by:
canRedo
in interfaceUndoRedo
- Overrides:
canRedo
in classUndoManager
- Returns:
true
if redo is allowed
-
undoOrRedo
- Overrides:
undoOrRedo
in classUndoManager
- Throws:
CannotRedoException
CannotUndoException
-
canUndoOrRedo
public boolean canUndoOrRedo()- Overrides:
canUndoOrRedo
in classUndoManager
-
getLimit
public int getLimit()- Overrides:
getLimit
in classUndoManager
-
setLimit
public void setLimit(int l) - Overrides:
setLimit
in classUndoManager
-
trimForLimit
protected void trimForLimit()- Overrides:
trimForLimit
in classUndoManager
-
trimEdits
protected void trimEdits(int from, int to) - Overrides:
trimEdits
in classUndoManager
-
discardAllEdits
public void discardAllEdits()- Overrides:
discardAllEdits
in classUndoManager
-
lastEdit
- Overrides:
lastEdit
in classCompoundEdit
-
editToBeUndone
- Overrides:
editToBeUndone
in classUndoManager
-
editToBeRedone
- Overrides:
editToBeRedone
in classUndoManager
-
undoableEditHappened
Consume an undoable edit. Delegates to superclass and notifies listeners.- Specified by:
undoableEditHappened
in interfaceUndoableEditListener
- Overrides:
undoableEditHappened
in classUndoManager
- Parameters:
ue
- the edit
-
addEdit
- Specified by:
addEdit
in interfaceUndoableEdit
- Overrides:
addEdit
in classUndoManager
-
replaceEdit
- Specified by:
replaceEdit
in interfaceUndoableEdit
- Overrides:
replaceEdit
in classAbstractUndoableEdit
-
isSignificant
public boolean isSignificant()- Specified by:
isSignificant
in interfaceUndoableEdit
- Overrides:
isSignificant
in classCompoundEdit
-
getPresentationName
- Specified by:
getPresentationName
in interfaceUndoableEdit
- Overrides:
getPresentationName
in classCompoundEdit
-
getUndoPresentationName
Description copied from interface:UndoRedo
Get a human-presentable name describing the undo operation.- Specified by:
getUndoPresentationName
in interfaceUndoableEdit
- Specified by:
getUndoPresentationName
in interfaceUndoRedo
- Overrides:
getUndoPresentationName
in classUndoManager
- Returns:
- the name
-
getRedoPresentationName
Description copied from interface:UndoRedo
Get a human-presentable name describing the redo operation.- Specified by:
getRedoPresentationName
in interfaceUndoableEdit
- Specified by:
getRedoPresentationName
in interfaceUndoRedo
- Overrides:
getRedoPresentationName
in classUndoManager
- Returns:
- the name
-
getUndoOrRedoPresentationName
- Overrides:
getUndoOrRedoPresentationName
in classUndoManager
-
toString
- Overrides:
toString
in classUndoManager
-
addChangeListener
Description copied from interface:UndoRedo
Add a change listener. The listener will be notified every time the undo/redo ability of this object changes.- Specified by:
addChangeListener
in interfaceUndoRedo
- Parameters:
l
- the listener to add
-
removeChangeListener
Description copied from interface:UndoRedo
Remove a change listener.- Specified by:
removeChangeListener
in interfaceUndoRedo
- Parameters:
l
- the listener to remove- See Also:
-