Class Overview
Stores document changes as the document is being
modified. Can subsequently be used for change notification
when done with the document modification transaction.
This is used by the AbstractDocument class and its extensions
for broadcasting change information to the document listeners.
Summary
[Expand]
Inherited Methods |
From class
javax.swing.undo.CompoundEdit
boolean
|
addEdit(UndoableEdit anEdit)
If this edit is inProgress ,
accepts anEdit and returns true.
|
boolean
|
canRedo()
Returns false if isInProgress or if super
returns false.
|
boolean
|
canUndo()
Returns false if isInProgress or if super
returns false.
|
void
|
die()
Sends die to each subedit,
in the reverse of the order that they were added.
|
void
|
end()
Sets inProgress to false.
|
String
|
getPresentationName()
Returns getPresentationName from the
last UndoableEdit added to
edits .
|
String
|
getRedoPresentationName()
Returns getRedoPresentationName
from the last UndoableEdit
added to edits .
|
String
|
getUndoPresentationName()
Returns getUndoPresentationName
from the last UndoableEdit
added to edits .
|
boolean
|
isInProgress()
Returns true if this edit is in progress--that is, it has not
received end.
|
boolean
|
isSignificant()
Returns true if any of the UndoableEdit s
in edits do.
|
UndoableEdit
|
lastEdit()
Returns the last UndoableEdit in
edits , or null
if edits is empty.
|
void
|
redo()
Sends redo to all contained
UndoableEdit s in the order in
which they were added.
|
String
|
toString()
Returns a string that displays and identifies this
object's properties.
|
void
|
undo()
Sends undo to all contained
UndoableEdits in the reverse of
the order in which they were added.
|
|
From class
javax.swing.undo.AbstractUndoableEdit
boolean
|
addEdit(UndoableEdit anEdit)
This default implementation returns false.
|
boolean
|
canRedo()
Returns true if this edit is alive
and hasBeenDone is false .
|
boolean
|
canUndo()
Returns true if this edit is alive
and hasBeenDone is true .
|
void
|
die()
Sets alive to false.
|
String
|
getPresentationName()
This default implementation returns "".
|
String
|
getRedoPresentationName()
Retreives the value from the defaults table with key
AbstractUndoableEdit.redoText and returns
that value followed by a space, followed by
getPresentationName .
|
String
|
getUndoPresentationName()
Retreives the value from the defaults table with key
AbstractUndoableEdit.undoText and returns
that value followed by a space, followed by
getPresentationName .
|
boolean
|
isSignificant()
This default implementation returns true.
|
void
|
redo()
Throws CannotRedoException if canRedo
returns false.
|
boolean
|
replaceEdit(UndoableEdit anEdit)
This default implementation returns false.
|
String
|
toString()
Returns a string that displays and identifies this
object's properties.
|
void
|
undo()
Throws CannotUndoException if canUndo
returns false .
|
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait()
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
final
void
|
wait(long timeout, int nanos)
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
final
void
|
wait(long timeout)
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
|
From interface
javax.swing.event.DocumentEvent
|
From interface
javax.swing.undo.UndoableEdit
abstract
boolean
|
addEdit(UndoableEdit anEdit)
Adds an UndoableEdit to this UndoableEdit .
|
abstract
boolean
|
canRedo()
Returns true if this edit may be redone.
|
abstract
boolean
|
canUndo()
Returns true if this edit may be undone.
|
abstract
void
|
die()
Informs the edit that it should no longer be used.
|
abstract
String
|
getPresentationName()
Returns a localized, human-readable description of this edit, suitable
for use in a change log, for example.
|
abstract
String
|
getRedoPresentationName()
Returns a localized, human-readable description of the redoable form of
this edit, suitable for use as a Redo menu item, for example.
|
abstract
String
|
getUndoPresentationName()
Returns a localized, human-readable description of the undoable form of
this edit, suitable for use as an Undo menu item, for example.
|
abstract
boolean
|
isSignificant()
Returns true if this edit is considered significant.
|
abstract
void
|
redo()
Re-applies the edit.
|
abstract
boolean
|
replaceEdit(UndoableEdit anEdit)
Returns true if this UndoableEdit should replace
anEdit .
|
abstract
void
|
undo()
Undo the edit.
|
|
Public Constructors
public
AbstractDocument.DefaultDocumentEvent
(int offs, int len, DocumentEvent.EventType type)
Constructs a change record.
Parameters
offs
| the offset into the document of the change >= 0 |
len
| the length of the change >= 0 |
type
| the type of event (DocumentEvent.EventType) |
Public Methods
public
boolean
addEdit
(UndoableEdit anEdit)
Adds a document edit. If the number of edits crosses
a threshold, this switches on a hashtable lookup for
ElementChange implementations since access of these
needs to be relatively quick.
Parameters
anEdit
| a document edit record |
Returns
- true if the edit was added
Gets the changes for an element.
public
Document
getDocument
()
Gets the document that sourced the change event.
public
int
getLength
()
Returns the length of the change.
public
int
getOffset
()
Returns the offset within the document of the start of the change.
public
String
getPresentationName
()
Provides a localized, human readable description of this edit
suitable for use in, say, a change log.
public
String
getRedoPresentationName
()
Provides a localized, human readable description of the redoable
form of this edit, e.g. for use as a Redo menu item. Typically
derived from getPresentationName();
Returns the type of event.
Returns
- the event type as a DocumentEvent.EventType
public
String
getUndoPresentationName
()
Provides a localized, human readable description of the undoable
form of this edit, e.g. for use as an Undo menu item. Typically
derived from getDescription();
public
boolean
isSignificant
()
DefaultDocument events are significant. If you wish to aggregate
DefaultDocumentEvents to present them as a single edit to the user
place them into a CompoundEdit.
Returns
- whether the event is significant for edit undo purposes
public
String
toString
()
Returns a string description of the change event.