Package Summary  Overview Summary

class:AbstractDocument.DefaultDocumentEvent [NONE]

All Implemented Interfaces:
Serializable, DocumentEvent, UndoableEdit
Enclosing class:
AbstractDocument

public class AbstractDocument.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.

constructor:AbstractDocument.DefaultDocumentEvent(int,int,javax.swing.event.DocumentEvent.EventType) [NONE]

  • DefaultDocumentEvent

    public 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)
    Since:
    1.4

method:toString() [NONE]

  • toString

    public String toString()
    Returns a string description of the change event.
    Overrides:
    toString in class CompoundEdit
    Returns:
    a string
  • method:addEdit(javax.swing.undo.UndoableEdit) [NONE]

    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.
    Specified by:
    addEdit in interface UndoableEdit
    Overrides:
    addEdit in class CompoundEdit
    Parameters:
    anEdit - a document edit record
    Returns:
    true if the edit was added
    See Also:
    UndoableEdit.addEdit(javax.swing.undo.UndoableEdit)

    method:redo() [NONE]

    redo

    public void redo() throws CannotRedoException
    Redoes a change.
    Specified by:
    redo in interface UndoableEdit
    Overrides:
    redo in class CompoundEdit
    Throws:
    CannotRedoException - if the change cannot be redone
    See Also:
    AbstractUndoableEdit.canRedo()

    method:undo() [NONE]

    undo

    public void undo() throws CannotUndoException
    Undoes a change.
    Specified by:
    undo in interface UndoableEdit
    Overrides:
    undo in class CompoundEdit
    Throws:
    CannotUndoException - if the change cannot be undone
    See Also:
    AbstractUndoableEdit.canUndo()

    method:isSignificant() [NONE]

    isSignificant

    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.
    Specified by:
    isSignificant in interface UndoableEdit
    Overrides:
    isSignificant in class CompoundEdit
    Returns:
    whether the event is significant for edit undo purposes
    See Also:
    UndoableEdit.isSignificant()

    method:getPresentationName() [NONE]

    getPresentationName

    public String getPresentationName()
    Provides a localized, human readable description of this edit suitable for use in, say, a change log.
    Specified by:
    getPresentationName in interface UndoableEdit
    Overrides:
    getPresentationName in class CompoundEdit
    Returns:
    the description
    See Also:
    AbstractUndoableEdit.getUndoPresentationName(), AbstractUndoableEdit.getRedoPresentationName()

    method:getUndoPresentationName() [NONE]

    getUndoPresentationName

    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();
    Specified by:
    getUndoPresentationName in interface UndoableEdit
    Overrides:
    getUndoPresentationName in class CompoundEdit
    Returns:
    the description
    See Also:
    AbstractUndoableEdit.getPresentationName()

    method:getRedoPresentationName() [NONE]

    getRedoPresentationName

    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();
    Specified by:
    getRedoPresentationName in interface UndoableEdit
    Overrides:
    getRedoPresentationName in class CompoundEdit
    Returns:
    the description
    See Also:
    AbstractUndoableEdit.getPresentationName()

    method:getType() [NONE]

    getType

    public DocumentEvent.EventType getType()
    Returns the type of event.
    Specified by:
    getType in interface DocumentEvent
    Returns:
    the event type as a DocumentEvent.EventType
    See Also:
    DocumentEvent.getType()

    method:getOffset() [NONE]

    getOffset

    public int getOffset()
    Returns the offset within the document of the start of the change.
    Specified by:
    getOffset in interface DocumentEvent
    Returns:
    the offset >= 0
    See Also:
    DocumentEvent.getOffset()

    method:getLength() [NONE]

    getLength

    public int getLength()
    Returns the length of the change.
    Specified by:
    getLength in interface DocumentEvent
    Returns:
    the length >= 0
    See Also:
    DocumentEvent.getLength()

    method:getDocument() [NONE]

    getDocument

    public Document getDocument()
    Gets the document that sourced the change event.
    Specified by:
    getDocument in interface DocumentEvent
    Returns:
    the document
    See Also:
    DocumentEvent.getDocument()

    method:getChange(javax.swing.text.Element) [NONE]

    getChange

    public DocumentEvent.ElementChange getChange?(Element elem)
    Gets the changes for an element.
    Specified by:
    getChange in interface DocumentEvent
    Parameters:
    elem - the element
    Returns:
    the changes

    © 2021 Oracle Corporation and/or its affiliates