Overview | Package | Class | Tree | Deprecated | Index | Help Java Platform
1.1.7
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class com.sun.java.swing.text.PlainDocument

java.lang.Object
  |
  +--com.sun.java.swing.text.AbstractDocument
        |
        +--com.sun.java.swing.text.PlainDocument

public class PlainDocument
extends AbstractDocument
A plain document that uses one font and color.

Warning: serialized objects of this class will not be compatible with future swing releases. The current serialization support is appropriate for short term storage or RMI between Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.

See Also:
Document, AbstractDocument, Serialized Form

Inner classes inherited from class com.sun.java.swing.text.AbstractDocument
AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement
 
Field Summary
static java.lang.String lineLimitAttribute
          Name of the attribute that specifies the maximum length of a line, if there is a maximum length.
static java.lang.String tabSizeAttribute
          Name of the attribute that specifies the tab size for tabs contained in the content.
 
Fields inherited from class com.sun.java.swing.text.AbstractDocument
BAD_LOCATION, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName
 
Constructor Summary
PlainDocument()
          Constructs a plain text document.
PlainDocument(AbstractDocument.Content c)
          Constructs a plain text document.
 
Method Summary
AbstractDocument.AbstractElement createDefaultRoot()
          Creates the root element to be used to represent the default document structure.
Element getDefaultRootElement()
          Gets the default root element for the document model.
void insertUpdate(AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr)
          Updates document structure as a result of text insertion.
void removeUpdate(AbstractDocument.DefaultDocumentEvent chng)
          Updates any document structure as a result of text removal.
 
Methods inherited from class com.sun.java.swing.text.AbstractDocument
addDocumentListener, addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAttributeContext, getContent, getCurrentWriter, getDefaultRootElement, getDocumentProperties, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, insertString, insertUpdate, putProperty, readLock, readUnlock, remove, removeDocumentListener, removeUndoableEditListener, removeUpdate, render, setDocumentProperties, writeLock, writeUnlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

tabSizeAttribute

public static final java.lang.String tabSizeAttribute
Name of the attribute that specifies the tab size for tabs contained in the content. The type for the value is Integer.

lineLimitAttribute

public static final java.lang.String lineLimitAttribute
Name of the attribute that specifies the maximum length of a line, if there is a maximum length. The type for the value is Integer.
Constructor Detail

PlainDocument

public PlainDocument()
Constructs a plain text document. A default model using StringContent is constructed and set.

PlainDocument

protected PlainDocument(AbstractDocument.Content c)
Constructs a plain text document. A default root element is created, and the tab size set to 8.
Parameters:
c - the container for the content
Method Detail

getDefaultRootElement

public Element getDefaultRootElement()
Gets the default root element for the document model.
Returns:
the root
Overrides:
getDefaultRootElement in class AbstractDocument
See Also:
getDefaultRootElement

createDefaultRoot

protected AbstractDocument.AbstractElement createDefaultRoot()
Creates the root element to be used to represent the default document structure.
Returns:
the element base

insertUpdate

protected void insertUpdate(AbstractDocument.DefaultDocumentEvent chng,
                            AttributeSet attr)
Updates document structure as a result of text insertion. This will happen within a write lock. Since this document simply maps out lines, we refresh the line map.
Parameters:
chng - the change event describing the dit
attr - the set of attributes for the inserted text
Overrides:
insertUpdate in class AbstractDocument

removeUpdate

protected void removeUpdate(AbstractDocument.DefaultDocumentEvent chng)
Updates any document structure as a result of text removal. This will happen within a write lock. Since the structure represents a line map, this just checks to see if the removal spans lines. If it does, the two lines outside of the removal area are joined together.
Parameters:
chng - the change event describing the edit
Overrides:
removeUpdate in class AbstractDocument

Overview | Package | Class | Tree | Deprecated | Index | Help Java Platform
1.1.7
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Submit a bug or feature
Submit comments/suggestions about javadoc
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.