public class AbstractDocument.DefaultDocumentEvent extends CompoundEdit implements DocumentEvent
Document
is beeing modified.DocumentEvent.ElementChange, DocumentEvent.EventType
edits
RedoName, UndoName
Constructor and Description |
---|
AbstractDocument.DefaultDocumentEvent(int offset,
int length,
DocumentEvent.EventType type)
Creates a new
DefaultDocumentEvent . |
Modifier and Type | Method and Description |
---|---|
boolean |
addEdit(UndoableEdit edit)
Adds an UndoableEdit to this
DocumentEvent . |
DocumentEvent.ElementChange |
getChange(Element elem)
Returns the changes for an element.
|
Document |
getDocument()
Returns the document that has been modified.
|
int |
getLength()
Returns the length of the modification.
|
int |
getOffset()
Returns the start offset of the modification.
|
DocumentEvent.EventType |
getType()
Returns the type of the modification.
|
String |
toString()
Returns a String description of the change event.
|
canRedo, canUndo, die, end, getPresentationName, getRedoPresentationName, getUndoPresentationName, isInProgress, isSignificant, lastEdit, redo, undo
replaceEdit
public AbstractDocument.DefaultDocumentEvent(int offset, int length, DocumentEvent.EventType type)
DefaultDocumentEvent
.offset
- the starting offset of the changelength
- the length of the changetype
- the type of changepublic boolean addEdit(UndoableEdit edit)
DocumentEvent
. If this
edit is an instance of AbstractDocument.ElementEdit
, then this record can
later be fetched by calling getChange(javax.swing.text.Element)
.addEdit
in interface UndoableEdit
addEdit
in class CompoundEdit
edit
- the undoable edit to addtrue
if edit
could somehow be
incorporated; false
if edit
has not
been incorporated because CompoundEdit.end()
was called before.public Document getDocument()
getDocument
in interface DocumentEvent
public int getLength()
getLength
in interface DocumentEvent
public int getOffset()
getOffset
in interface DocumentEvent
public DocumentEvent.EventType getType()
getType
in interface DocumentEvent
public DocumentEvent.ElementChange getChange(Element elem)
getChange
in interface DocumentEvent
elem
- the element for which the changes are requestedelem
or null
if
elem
has not been changedpublic String toString()
toString
in class CompoundEdit
Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)