edu.princeton.swing.text
Class HighlightedDocument.UndoableEdit

java.lang.Object
  extended by edu.princeton.swing.text.HighlightedDocument.UndoableEdit
All Implemented Interfaces:
UndoableEdit
Enclosing class:
HighlightedDocument

public class HighlightedDocument.UndoableEdit
extends Object
implements UndoableEdit

UndoableEdit is a simple implementation of javax.swing.undo.UndoableEdit.


Constructor Summary
protected HighlightedDocument.UndoableEdit(int offset, int length, StringBuffer newText, boolean mergable)
          Creates a new UndoableEdit.
 
Method Summary
 boolean addEdit(UndoableEdit edit)
          Attempts to merge another edit with the current edit.
 boolean canRedo()
          Returns wheter or not this edit is alive.
 boolean canUndo()
          Returns wheter or not this edit is alive.
 void die()
          Frees resources associated with an edit.
 String getPresentationName()
          Returns a string describing the edit.
 String getRedoPresentationName()
          Returns a string describing the edit.
 String getUndoPresentationName()
          Returns a string describing the edit.
 boolean isSignificant()
          Returns true (this edit involved a document mutation).
 void redo()
          Redoes an edit.
 boolean replaceEdit(UndoableEdit anEdit)
          Returns false (this edit should never replace another).
 String toString()
          Returns a string describing the edit.
 void undo()
          Undoes this edit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HighlightedDocument.UndoableEdit

protected HighlightedDocument.UndoableEdit(int offset,
                                           int length,
                                           StringBuffer newText,
                                           boolean mergable)
Creates a new UndoableEdit. This should be called *before* the edit is actually performed.

Method Detail

addEdit

public boolean addEdit(UndoableEdit edit)
Attempts to merge another edit with the current edit.

Specified by:
addEdit in interface UndoableEdit

canRedo

public boolean canRedo()
Returns wheter or not this edit is alive.

Specified by:
canRedo in interface UndoableEdit

canUndo

public boolean canUndo()
Returns wheter or not this edit is alive.

Specified by:
canUndo in interface UndoableEdit

die

public void die()
Frees resources associated with an edit.

Specified by:
die in interface UndoableEdit

getPresentationName

public String getPresentationName()
Returns a string describing the edit.

Specified by:
getPresentationName in interface UndoableEdit

getRedoPresentationName

public String getRedoPresentationName()
Returns a string describing the edit.

Specified by:
getRedoPresentationName in interface UndoableEdit

getUndoPresentationName

public String getUndoPresentationName()
Returns a string describing the edit.

Specified by:
getUndoPresentationName in interface UndoableEdit

toString

public String toString()
Returns a string describing the edit.

Overrides:
toString in class Object

isSignificant

public boolean isSignificant()
Returns true (this edit involved a document mutation).

Specified by:
isSignificant in interface UndoableEdit

redo

public void redo()
Redoes an edit.

Specified by:
redo in interface UndoableEdit

replaceEdit

public boolean replaceEdit(UndoableEdit anEdit)
Returns false (this edit should never replace another).

Specified by:
replaceEdit in interface UndoableEdit

undo

public void undo()
Undoes this edit.

Specified by:
undo in interface UndoableEdit