Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Class java.awt.swing.text.AbstractDocument.DefaultDocumentEvent

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

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.


Fields inherited from class java.awt.swing.undo.CompoundEdit
 edits
 
Fields inherited from class java.awt.swing.undo.AbstractUndoableEdit
 RedoName, UndoName
 

Constructor Summary
 AbstractDocument.DefaultDocumentEvent(AbstractDocument this$0, int offs, int len, DocumentEvent.EventType type)
Constructs a change record.
 

Method Summary
boolean  addEdit(UndoableEdit anEdit)
Adds a document edit.
DocumentEvent.ElementChange  getChange(Element elem)
Gets the changes for an element.
Document  getDocument()
Gets the document that sourced the change event.
int  getLength()
Returns the length of the change.
int  getOffset()
Returns the offset within the document of the start of the change.
String  getPresentationName()
Provide a localized, human readable description of this edit suitable for use in, say, a change log.
String  getRedoPresentationName()
Provide a localized, human readable description of the redoable form of this edit, e.g.
DocumentEvent.EventType  getType()
Returns the type of event
String  getUndoPresentationName()
Provide a localized, human readable description of the undoable form of this edit, e.g.
boolean  isSignificant()
DefaultDocument events are significant.
void  redo()
Redoes a change.
String  toString()
Returns a string description of the change event.
void  undo()
Undoes a change.
 
Methods inherited from class java.awt.swing.undo.CompoundEdit
 addEdit, canRedo, canUndo, die, end, getPresentationName, getRedoPresentationName, getUndoPresentationName, isInProgress, isSignificant, lastEdit, redo, toString, undo
 
Methods inherited from class java.awt.swing.undo.AbstractUndoableEdit
 addEdit, canRedo, canUndo, die, getPresentationName, getRedoPresentationName, getUndoPresentationName, isSignificant, redo, replaceEdit, toString, undo
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDocument.DefaultDocumentEvent

public AbstractDocument.DefaultDocumentEvent(AbstractDocument this$0,
                                             int offs,
                                             int len,
                                             DocumentEvent.EventType type)
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
type - the type of event.
Method Detail

toString

public String toString()
Returns a string description of the change event.
Returns:
a string
Overrides:
toString in class CompoundEdit

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

redo

public void redo() throws CannotRedoException
Redoes a change.
Throws:
CannotRedoException - if the change cannot be redone
Overrides:
redo in class CompoundEdit

undo

public void undo() throws CannotUndoException
Undoes a change.
Throws:
CannotUndoException - if the change cannot be undone
Overrides:
undo in class CompoundEdit

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.
Overrides:
isSignificant in class CompoundEdit

getPresentationName

public String getPresentationName()
Provide a localized, human readable description of this edit suitable for use in, say, a change log.
Overrides:
getPresentationName in class CompoundEdit

getUndoPresentationName

public String getUndoPresentationName()
Provide 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();
Overrides:
getUndoPresentationName in class CompoundEdit

getRedoPresentationName

public String getRedoPresentationName()
Provide 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();
Overrides:
getRedoPresentationName in class CompoundEdit

getType

public DocumentEvent.EventType getType()
Returns the type of event
Implements:
getType in interface DocumentEvent
See Also:
getType

getOffset

public int getOffset()
Returns the offset within the document of the start of the change.
Implements:
getOffset in interface DocumentEvent
Returns:
the offset
See Also:
getOffset

getLength

public int getLength()
Returns the length of the change.
Implements:
getLength in interface DocumentEvent
Returns:
the length
See Also:
getLength

getDocument

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

getChange

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

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.