org.openide.awt 7.55.1

org.openide.awt
Class UndoRedo.Manager

java.lang.Object
  extended by javax.swing.undo.AbstractUndoableEdit
      extended by javax.swing.undo.CompoundEdit
          extended by javax.swing.undo.UndoManager
              extended by org.openide.awt.UndoRedo.Manager
All Implemented Interfaces:
Serializable, EventListener, UndoableEditListener, UndoableEdit, UndoRedo
Enclosing interface:
UndoRedo

public static class UndoRedo.Manager
extends UndoManager
implements 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).

See Also:
Serialized Form

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
 
Fields inherited from interface org.openide.awt.UndoRedo
NONE
 
Constructor Summary
UndoRedo.Manager()
           
 
Method Summary
 void addChangeListener(ChangeListener l)
          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 canUndoOrRedo()
           
 void die()
           
 void discardAllEdits()
           
protected  UndoableEdit editToBeRedone()
           
protected  UndoableEdit editToBeUndone()
           
 void end()
           
 int getLimit()
           
 String getPresentationName()
           
 String getRedoPresentationName()
          Get a human-presentable name describing the redo operation.
 String getUndoOrRedoPresentationName()
           
 String getUndoPresentationName()
          Get a human-presentable name describing the undo operation.
 boolean isInProgress()
           
 boolean isSignificant()
           
protected  UndoableEdit lastEdit()
           
 void redo()
          Redo a previously undone edit.
protected  void redoTo(UndoableEdit edit)
           
 void removeChangeListener(ChangeListener l)
          Remove a change listener.
 boolean replaceEdit(UndoableEdit anEdit)
           
 void setLimit(int l)
           
 String toString()
           
protected  void trimEdits(int from, int to)
           
protected  void trimForLimit()
           
 void undo()
          Undo an edit.
 void undoableEditHappened(UndoableEditEvent ue)
          Consume an undoable edit.
 void undoOrRedo()
           
protected  void undoTo(UndoableEdit edit)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UndoRedo.Manager

public UndoRedo.Manager()
Method Detail

die

public void die()
Specified by:
die in interface UndoableEdit
Overrides:
die in class CompoundEdit

isInProgress

public boolean isInProgress()
Overrides:
isInProgress in class CompoundEdit

end

public void end()
Overrides:
end in class UndoManager

undo

public void undo()
          throws CannotUndoException
Description copied from interface: UndoRedo
Undo an edit.

Specified by:
undo in interface UndoableEdit
Specified by:
undo in interface UndoRedo
Overrides:
undo in class UndoManager
Throws:
CannotUndoException - if it fails

undoTo

protected void undoTo(UndoableEdit edit)
               throws CannotUndoException
Overrides:
undoTo in class UndoManager
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 interface UndoableEdit
Specified by:
canUndo in interface UndoRedo
Overrides:
canUndo in class UndoManager
Returns:
true if undo is allowed

redo

public void redo()
          throws CannotRedoException
Description copied from interface: UndoRedo
Redo a previously undone edit.

Specified by:
redo in interface UndoableEdit
Specified by:
redo in interface UndoRedo
Overrides:
redo in class UndoManager
Throws:
CannotRedoException - if it fails

redoTo

protected void redoTo(UndoableEdit edit)
               throws CannotRedoException
Overrides:
redoTo in class UndoManager
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 interface UndoableEdit
Specified by:
canRedo in interface UndoRedo
Overrides:
canRedo in class UndoManager
Returns:
true if redo is allowed

undoOrRedo

public void undoOrRedo()
                throws CannotRedoException,
                       CannotUndoException
Overrides:
undoOrRedo in class UndoManager
Throws:
CannotRedoException
CannotUndoException

canUndoOrRedo

public boolean canUndoOrRedo()
Overrides:
canUndoOrRedo in class UndoManager

getLimit

public int getLimit()
Overrides:
getLimit in class UndoManager

setLimit

public void setLimit(int l)
Overrides:
setLimit in class UndoManager

trimForLimit

protected void trimForLimit()
Overrides:
trimForLimit in class UndoManager

trimEdits

protected void trimEdits(int from,
                         int to)
Overrides:
trimEdits in class UndoManager

discardAllEdits

public void discardAllEdits()
Overrides:
discardAllEdits in class UndoManager

lastEdit

protected UndoableEdit lastEdit()
Overrides:
lastEdit in class CompoundEdit

editToBeUndone

protected UndoableEdit editToBeUndone()
Overrides:
editToBeUndone in class UndoManager

editToBeRedone

protected UndoableEdit editToBeRedone()
Overrides:
editToBeRedone in class UndoManager

undoableEditHappened

public void undoableEditHappened(UndoableEditEvent ue)
Consume an undoable edit. Delegates to superclass and notifies listeners.

Specified by:
undoableEditHappened in interface UndoableEditListener
Overrides:
undoableEditHappened in class UndoManager
Parameters:
ue - the edit

addEdit

public boolean addEdit(UndoableEdit anEdit)
Specified by:
addEdit in interface UndoableEdit
Overrides:
addEdit in class UndoManager

replaceEdit

public boolean replaceEdit(UndoableEdit anEdit)
Specified by:
replaceEdit in interface UndoableEdit
Overrides:
replaceEdit in class AbstractUndoableEdit

isSignificant

public boolean isSignificant()
Specified by:
isSignificant in interface UndoableEdit
Overrides:
isSignificant in class CompoundEdit

getPresentationName

public String getPresentationName()
Specified by:
getPresentationName in interface UndoableEdit
Overrides:
getPresentationName in class CompoundEdit

getUndoPresentationName

public String getUndoPresentationName()
Description copied from interface: UndoRedo
Get a human-presentable name describing the undo operation.

Specified by:
getUndoPresentationName in interface UndoableEdit
Specified by:
getUndoPresentationName in interface UndoRedo
Overrides:
getUndoPresentationName in class UndoManager
Returns:
the name

getRedoPresentationName

public String getRedoPresentationName()
Description copied from interface: UndoRedo
Get a human-presentable name describing the redo operation.

Specified by:
getRedoPresentationName in interface UndoableEdit
Specified by:
getRedoPresentationName in interface UndoRedo
Overrides:
getRedoPresentationName in class UndoManager
Returns:
the name

getUndoOrRedoPresentationName

public String getUndoOrRedoPresentationName()
Overrides:
getUndoOrRedoPresentationName in class UndoManager

toString

public String toString()
Overrides:
toString in class UndoManager

addChangeListener

public void addChangeListener(ChangeListener l)
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 interface UndoRedo
Parameters:
l - the listener to add

removeChangeListener

public void removeChangeListener(ChangeListener l)
Description copied from interface: UndoRedo
Remove a change listener.

Specified by:
removeChangeListener in interface UndoRedo
Parameters:
l - the listener to remove
See Also:
UndoRedo.addChangeListener(javax.swing.event.ChangeListener)

org.openide.awt 7.55.1

Built on June 6 2013.  |  Portions Copyright 1997-2013 Oracle. All rights reserved.