- java.lang.Object
- 
- javax.swing.undo.AbstractUndoableEdit
- 
- javax.swing.undo.CompoundEdit
- 
- javax.swing.text.AbstractDocument.DefaultDocumentEvent
 
 
 
- 
- 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.- See Also:
- Serialized Form
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces declared in interface javax.swing.event.DocumentEventDocumentEvent.ElementChange, DocumentEvent.EventType
 
- 
 - 
Field Summary- 
Fields declared in class javax.swing.undo.CompoundEditedits
 - 
Fields declared in class javax.swing.undo.AbstractUndoableEditRedoName, UndoName
 
- 
 - 
Constructor SummaryConstructors Constructor Description DefaultDocumentEvent(int offs, int len, DocumentEvent.EventType type)Constructs a change record.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddEdit(UndoableEdit anEdit)Adds a document edit.DocumentEvent.ElementChangegetChange(Element elem)Gets the changes for an element.DocumentgetDocument()Gets the document that sourced the change event.intgetLength()Returns the length of the change.intgetOffset()Returns the offset within the document of the start of the change.StringgetPresentationName()Provides a localized, human readable description of this edit suitable for use in, say, a change log.StringgetRedoPresentationName()Provides a localized, human readable description of the redoable form of this edit, e.g. for use as a Redo menu item.DocumentEvent.EventTypegetType()Returns the type of event.StringgetUndoPresentationName()Provides a localized, human readable description of the undoable form of this edit, e.g. for use as an Undo menu item.booleanisSignificant()DefaultDocument events are significant.voidredo()Redoes a change.StringtoString()Returns a string description of the change event.voidundo()Undoes a change.- 
Methods declared in class javax.swing.undo.CompoundEditcanRedo, canUndo, die, end, isInProgress, lastEdit
 - 
Methods declared in class javax.swing.undo.AbstractUndoableEditreplaceEdit
 
- 
 
- 
- 
- 
Constructor Detail- 
DefaultDocumentEventpublic 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 Detail- 
toStringpublic String toString() Returns a string description of the change event.- Overrides:
- toStringin class- CompoundEdit
- Returns:
- a string
 
 - 
addEditpublic 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:
- addEditin interface- UndoableEdit
- Overrides:
- addEditin class- CompoundEdit
- Parameters:
- anEdit- a document edit record
- Returns:
- true if the edit was added
- See Also:
- UndoableEdit.addEdit(javax.swing.undo.UndoableEdit)
 
 - 
redopublic void redo() throws CannotRedoExceptionRedoes a change.- Specified by:
- redoin interface- UndoableEdit
- Overrides:
- redoin class- CompoundEdit
- Throws:
- CannotRedoException- if the change cannot be redone
- See Also:
- AbstractUndoableEdit.canRedo()
 
 - 
undopublic void undo() throws CannotUndoExceptionUndoes a change.- Specified by:
- undoin interface- UndoableEdit
- Overrides:
- undoin class- CompoundEdit
- Throws:
- CannotUndoException- if the change cannot be undone
- See Also:
- AbstractUndoableEdit.canUndo()
 
 - 
isSignificantpublic 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:
- isSignificantin interface- UndoableEdit
- Overrides:
- isSignificantin class- CompoundEdit
- Returns:
- whether the event is significant for edit undo purposes
- See Also:
- UndoableEdit.isSignificant()
 
 - 
getPresentationNamepublic String getPresentationName() Provides a localized, human readable description of this edit suitable for use in, say, a change log.- Specified by:
- getPresentationNamein interface- UndoableEdit
- Overrides:
- getPresentationNamein class- CompoundEdit
- Returns:
- the description
- See Also:
- AbstractUndoableEdit.getUndoPresentationName(),- AbstractUndoableEdit.getRedoPresentationName()
 
 - 
getUndoPresentationNamepublic 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:
- getUndoPresentationNamein interface- UndoableEdit
- Overrides:
- getUndoPresentationNamein class- CompoundEdit
- Returns:
- the description
- See Also:
- AbstractUndoableEdit.getPresentationName()
 
 - 
getRedoPresentationNamepublic 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:
- getRedoPresentationNamein interface- UndoableEdit
- Overrides:
- getRedoPresentationNamein class- CompoundEdit
- Returns:
- the description
- See Also:
- AbstractUndoableEdit.getPresentationName()
 
 - 
getTypepublic DocumentEvent.EventType getType() Returns the type of event.- Specified by:
- getTypein interface- DocumentEvent
- Returns:
- the event type as a DocumentEvent.EventType
- See Also:
- DocumentEvent.getType()
 
 - 
getOffsetpublic int getOffset() Returns the offset within the document of the start of the change.- Specified by:
- getOffsetin interface- DocumentEvent
- Returns:
- the offset >= 0
- See Also:
- DocumentEvent.getOffset()
 
 - 
getLengthpublic int getLength() Returns the length of the change.- Specified by:
- getLengthin interface- DocumentEvent
- Returns:
- the length >= 0
- See Also:
- DocumentEvent.getLength()
 
 - 
getDocumentpublic Document getDocument() Gets the document that sourced the change event.- Specified by:
- getDocumentin interface- DocumentEvent
- Returns:
- the document
- See Also:
- DocumentEvent.getDocument()
 
 - 
getChangepublic DocumentEvent.ElementChange getChange(Element elem) Gets the changes for an element.- Specified by:
- getChangein interface- DocumentEvent
- Parameters:
- elem- the element
- Returns:
- the changes
 
 
- 
 
-