javax.swing.text

Class AbstractDocument.DefaultDocumentEvent

public class AbstractDocument.DefaultDocumentEvent extends CompoundEdit implements DocumentEvent

Stores the changes when a Document is beeing modified.
Constructor Summary
DefaultDocumentEvent(int offset, int length, DocumentEvent.EventType type)
Creates a new DefaultDocumentEvent.
Method Summary
booleanaddEdit(UndoableEdit edit)
Adds an UndoableEdit to this DocumentEvent.
ElementChangegetChange(Element elem)
Returns the changes for an element.
DocumentgetDocument()
Returns the document that has been modified.
intgetLength()
Returns the length of the modification.
intgetOffset()
Returns the start offset of the modification.
DocumentEvent.EventTypegetType()
Returns the type of the modification.
StringtoString()
Returns a String description of the change event.

Constructor Detail

DefaultDocumentEvent

public DefaultDocumentEvent(int offset, int length, DocumentEvent.EventType type)
Creates a new DefaultDocumentEvent.

Parameters: offset the starting offset of the change length the length of the change type the type of change

Method Detail

addEdit

public boolean addEdit(UndoableEdit edit)
Adds an UndoableEdit to this DocumentEvent. If this edit is an instance of {@link ElementEdit}, then this record can later be fetched by calling {@link #getChange}.

Parameters: edit the undoable edit to add

getChange

public ElementChange getChange(Element elem)
Returns the changes for an element.

Parameters: elem the element for which the changes are requested

Returns: the changes for elem or null if elem has not been changed

getDocument

public Document getDocument()
Returns the document that has been modified.

Returns: the document that has been modified

getLength

public int getLength()
Returns the length of the modification.

Returns: the length of the modification

getOffset

public int getOffset()
Returns the start offset of the modification.

Returns: the start offset of the modification

getType

public DocumentEvent.EventType getType()
Returns the type of the modification.

Returns: the type of the modification

toString

public String toString()
Returns a String description of the change event. This returns the toString method of the Vector of edits.