|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.text.AbstractDocument | +--javax.swing.text.PlainDocument
Safe: A plain document that maintains no character attributes. The default element structure for this document is a map of the lines in the text. The Element returned by getDefaultRootElement is a map of the lines, and each child element represents a line. This model does not maintain any character level attributes, but each line can be tagged with an arbitrary set of attributes. Line to offset, and offset to line translations can be quickly performed using the default root element. The structure information of the DocumentEvent's fired by edits will indicate the line structure changes.
The default content storage management is performed by a gapped buffer implementation (GapContent). It supports editing reasonably large documents with good efficiency when the edits are contiguous or clustered, as is typical.
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 applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans
package.
Please see java.beans.XMLEncoder
.
Document
,
AbstractDocument
,
Serialized FormField Summary | |
private Vector |
added
|
private javax.swing.text.AbstractDocument.AbstractElement |
defaultRoot
|
static String |
lineLimitAttribute
Suppressed: Name of the attribute that specifies the maximum length of a line, if there is a maximum length. |
private Vector |
removed
|
static String |
tabSizeAttribute
Suppressed: Name of the attribute that specifies the tab size for tabs contained in the content. |
Fields inherited from class javax.swing.text.AbstractDocument |
AsyncLoadPriority, BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, I18NProperty, listenerList, MultiByteProperty, ParagraphElementName, SectionElementName |
Fields inherited from interface javax.swing.text.Document |
StreamDescriptionProperty, TitleProperty |
Constructor Summary | |
PlainDocument()
Enabled: Constructs a plain text document. |
|
PlainDocument(javax.swing.text.AbstractDocument.Content c)
Suppressed: Constructs a plain text document. |
Method Summary | |
protected javax.swing.text.AbstractDocument.AbstractElement |
createDefaultRoot()
Creates the root element to be used to represent the default document structure. |
Element |
getDefaultRootElement()
Enabled: Gets the default root element for the document model. |
Element |
getParagraphElement(int pos)
Enabled: Get the paragraph element containing the given position. |
private void |
insertComposedTextUpdate(javax.swing.text.AbstractDocument.DefaultDocumentEvent chng,
AttributeSet attr)
|
void |
insertString(int offs,
String str,
AttributeSet a)
Enabled: Inserts some content into the document. |
protected void |
insertUpdate(javax.swing.text.AbstractDocument.DefaultDocumentEvent chng,
AttributeSet attr)
Updates document structure as a result of text insertion. |
protected void |
removeUpdate(javax.swing.text.AbstractDocument.DefaultDocumentEvent chng)
Updates any document structure as a result of text removal. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String tabSizeAttribute
public static final String lineLimitAttribute
private javax.swing.text.AbstractDocument.AbstractElement defaultRoot
private Vector added
private Vector removed
Constructor Detail |
public PlainDocument()
GapContent
is constructed and set.
public PlainDocument(javax.swing.text.AbstractDocument.Content c)
c
- the container for the contentMethod Detail |
public void insertString(int offs, String str, AttributeSet a) throws BadLocationException
This method is thread safe, although most Swing methods are not. Please see Threads and Swing for more information.
insertString
in interface Document
insertString
in class AbstractDocument
offs
- the starting offset >= 0str
- the string to insert; does nothing with null/empty stringsa
- the attributes for the inserted content
BadLocationException
Document.insertString(int, java.lang.String, javax.swing.text.AttributeSet)
public Element getDefaultRootElement()
getDefaultRootElement
in interface Document
getDefaultRootElement
in class AbstractDocument
Document.getDefaultRootElement()
protected javax.swing.text.AbstractDocument.AbstractElement createDefaultRoot()
public Element getParagraphElement(int pos)
getParagraphElement
in class AbstractDocument
pos
- the starting offset >= 0
protected void insertUpdate(javax.swing.text.AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr)
insertUpdate
in class AbstractDocument
chng
- the change event describing the ditattr
- the set of attributes for the inserted textprotected void removeUpdate(javax.swing.text.AbstractDocument.DefaultDocumentEvent chng)
removeUpdate
in class AbstractDocument
chng
- the change event describing the editprivate void insertComposedTextUpdate(javax.swing.text.AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |