This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.swing.text
class AbstractDocument.DefaultDocumentEvent

java.lang.Object extended by javax.swing.undo.AbstractUndoableEdit extended by javax.swing.undo.CompoundEdit extended by 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.


Field Summary
 
Fields inherited from class javax.swing.undo.CompoundEdit
edits
 
Fields inherited from class javax.swing.undo.AbstractUndoableEdit
RedoName, UndoName
 
Constructor Summary

          Constructs a change record.
 
Method Summary
 boolean

          Adds a document edit.
 DocumentEvent.ElementChange

          Gets the changes for an element.
 Document

          Gets the document that sourced the change event.
 int

          Returns the length of the change.
 int

          Returns the offset within the document of the start of the change.
 String

          Provides a localized, human readable description of this edit suitable for use in, say, a change log.
 String

          Provides a localized, human readable description of the redoable form of this edit, e.g.
 DocumentEvent.EventType

          Returns the type of event.
 String

          Provides a localized, human readable description of the undoable form of this edit, e.g.
 boolean

          DefaultDocument events are significant.
 void

          Redoes a change.
 String

          Returns a string description of the change event.
 void

          Undoes a change.
 
Methods inherited from class javax.swing.undo.CompoundEdit
addEdit, canRedo, canUndo, die, end, getPresentationName, getRedoPresentationName, getUndoPresentationName, isInProgress, isSignificant, lastEdit, redo, toString, undo
 
Methods inherited from class javax.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(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)
Method Detail

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.

Overrides:
addEdit in class CompoundEdit
Parameters:
anEdit - a document edit record
Returns:
true if the edit was added

getChange

public DocumentEvent.ElementChange getChange(Element elem)
Gets the changes for an element.

Parameters:
elem - the element
Returns:
the changes

getDocument

public Document getDocument()
Gets the document that sourced the change event.

Returns:
the document

getLength

public int getLength()
Returns the length of the change.

Returns:
the length >= 0

getOffset

public int getOffset()
Returns the offset within the document of the start of the change.

Returns:
the offset >= 0

getPresentationName

public String getPresentationName()
Provides a localized, human readable description of this edit suitable for use in, say, a change log.

Overrides:
getPresentationName in class CompoundEdit
Returns:
the description

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();

Overrides:
getRedoPresentationName in class CompoundEdit
Returns:
the description

getType

public DocumentEvent.EventType getType()
Returns the type of event.

Returns:
the event type as a DocumentEvent.EventType

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();

Overrides:
getUndoPresentationName in class CompoundEdit
Returns:
the description

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
Returns:
whether the event is significant for edit undo purposes

redo

public void redo()
          throws CannotRedoException
Redoes a change.

Overrides:
redo in class CompoundEdit
Throws:
CannotRedoException - if the change cannot be redone

toString

public String toString()
Returns a string description of the change event.

Overrides:
toString in class CompoundEdit
Returns:
a string

undo

public void undo()
          throws CannotUndoException
Undoes a change.

Overrides:
undo in class CompoundEdit
Throws:
CannotUndoException - if the change cannot be undone


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.