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.
DocumentEvent.ElementChange, DocumentEvent.EventType edits RedoName, UndoName public DefaultDocumentEvent(int offs,
int len,
DocumentEvent.EventType type) Constructs a change record.
offs - the offset into the document of the change >= 0len - the length of the change >= 0type - the type of event (DocumentEvent.EventType)public String toString()
Returns a string description of the change event.
toString in class CompoundEdit
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.
addEdit in interface UndoableEdit
addEdit in class CompoundEdit
anEdit - a document edit recordUndoableEdit.addEdit(javax.swing.undo.UndoableEdit)public void redo()
throws CannotRedoException Redoes a change.
redo in interface UndoableEdit
redo in class CompoundEdit
CannotRedoException - if the change cannot be redoneAbstractUndoableEdit.canRedo()public void undo()
throws CannotUndoException Undoes a change.
undo in interface UndoableEdit
undo in class CompoundEdit
CannotUndoException - if the change cannot be undoneAbstractUndoableEdit.canUndo()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.
isSignificant in interface UndoableEdit
isSignificant in class CompoundEdit
UndoableEdit.isSignificant()public String getPresentationName()
Provides a localized, human readable description of this edit suitable for use in, say, a change log.
getPresentationName in interface UndoableEdit
getPresentationName in class CompoundEdit
AbstractUndoableEdit.getUndoPresentationName(), AbstractUndoableEdit.getRedoPresentationName()
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();
getUndoPresentationName in interface UndoableEdit
getUndoPresentationName in class CompoundEdit
AbstractUndoableEdit.getPresentationName()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();
getRedoPresentationName in interface UndoableEdit
getRedoPresentationName in class CompoundEdit
AbstractUndoableEdit.getPresentationName()public DocumentEvent.EventType getType()
Returns the type of event.
getType in interface DocumentEvent
DocumentEvent.getType()public int getOffset()
Returns the offset within the document of the start of the change.
getOffset in interface DocumentEvent
DocumentEvent.getOffset()public int getLength()
Returns the length of the change.
getLength in interface DocumentEvent
DocumentEvent.getLength()public Document getDocument()
Gets the document that sourced the change event.
getDocument in interface DocumentEvent
DocumentEvent.getDocument()public DocumentEvent.ElementChange getChange(Element elem)
Gets the changes for an element.
getChange in interface DocumentEvent
elem - the element
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.