All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class java.awt.swing.text.DefaultDocumentEvent

java.lang.Object
    |
    +----java.awt.swing.undo.AbstractUndoableEdit
            |
            +----java.awt.swing.undo.CompoundEdit
                    |
                    +----java.awt.swing.text.DefaultDocumentEvent

public class DefaultDocumentEvent
extends CompoundEdit
implements DocumentEvent
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.

See Also:
DocumentEvent, Document

Class Index

 o DefaultDocumentEvent.ElementEdit
An implementation of ElementChange that can be added to the document event.

Constructor Index

 o DefaultDocumentEvent(Document, int, int)
Constructs a change record.

Method Index

 o addEdit(UndoableEdit)
Adds a document edit.
 o getChange(Element)
Gets the changes for an element.
 o getDocument()
Gets the document that sourced the change event.
 o getEdit()
Gets the current edit to the model.
 o getLength()
Returns the length of the change.
 o getOffset()
Returns the offset within the document of the start of the change.
 o toString()
Returns a string description of the event.

Constructors

 o DefaultDocumentEvent
public DefaultDocumentEvent(Document doc,
                            int offs,
                            int len)
Constructs a change record.

Parameters:
doc - document that is being changed
offs - the offset into the document of the change
len - the length of the change

Methods

 o toString
public String toString()
Returns a string description of the event.

Returns:
a string
Overrides:
toString in class CompoundEdit
 o addEdit
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:
???
Overrides:
addEdit in class CompoundEdit
 o getEdit
public UndoableEdit getEdit()
Gets the current edit to the model.

Returns:
the current edit
See Also:
getEdit
 o getOffset
public int getOffset()
Returns the offset within the document of the start of the change.

Returns:
the offset
See Also:
getOffset
 o getLength
public int getLength()
Returns the length of the change.

Returns:
the length
See Also:
getLength
 o getDocument
public Document getDocument()
Gets the document that sourced the change event.

Returns:
the document
See Also:
getDocument
 o getChange
public DocumentEvent.ElementChange getChange(Element elem)
Gets the changes for an element.

Parameters:
elem - the element
Returns:
the changes

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature