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.
- 
Nested Class SummaryNested classes/interfaces declared in interface javax.swing.event.DocumentEventDocumentEvent.ElementChange, DocumentEvent.EventType
- 
Field Summary
- 
Constructor SummaryConstructors Constructor Description DefaultDocumentEvent(int offs, int len, DocumentEvent.EventType type)Constructs a change record.
- 
Method SummaryModifier 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
- 
Constructor Details- 
DefaultDocumentEventConstructs 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 Details- 
toStringReturns a string description of the change event.- Overrides:
- toStringin class- CompoundEdit
- Returns:
- a string
 
- 
addEditAdds 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)
 
- 
redoRedoes a change.- Specified by:
- redoin interface- UndoableEdit
- Overrides:
- redoin class- CompoundEdit
- Throws:
- CannotRedoException- if the change cannot be redone
- See Also:
- AbstractUndoableEdit.canRedo()
 
- 
undoUndoes 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()
 
- 
getPresentationNameProvides 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()
 
- 
getUndoPresentationNameProvides 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()
 
- 
getRedoPresentationNameProvides 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()
 
- 
getTypeReturns 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()
 
- 
getDocumentGets the document that sourced the change event.- Specified by:
- getDocumentin interface- DocumentEvent
- Returns:
- the document
- See Also:
- DocumentEvent.getDocument()
 
- 
getChangeGets the changes for an element.- Specified by:
- getChangein interface- DocumentEvent
- Parameters:
- elem- the element
- Returns:
- the changes
 
 
-