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 JavaBeans
has been added to the java.beans package.
Please see java..
Document, AbstractDocument
| Modifier and Type | Field and Description |
|---|---|
| private Vector | |
| private AbstractDocument. | |
| public static final String | lineLimitAttribute
Name of the attribute that specifies the maximum length of a line, if there is a maximum length. |
| private Vector | |
| private transient Segment | |
| public static final String | tabSizeAttribute
Name of the attribute that specifies the tab size for tabs contained in the content. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | PlainDocument(AbstractDocument.
the container for the content cConstructs a plain text document. |
| Modifier and Type | Method and Description |
|---|---|
| protected AbstractDocument. | Returns: the element baseCreates the root element to be used to represent the default document structure. |
| public Element | Returns: the rootImplements abstract javax. Implements javax. Gets the default root element for the document model. |
| public Element | getParagraphElement(int pos)
Implements abstract javax. Get the paragraph element containing the given position. |
| private void | |
| public void | insertString(int
the starting offset >= 0 offs, String the string to insert; does nothing with null/empty strings str, AttributeSet the attributes for the inserted content a)Overrides javax. Implements javax. Inserts some content into the document. |
| protected void | insertUpdate(AbstractDocument.
the change event describing the dit chng,the set of attributes for the inserted text attr)Overrides javax. Updates document structure as a result of text insertion. |
| protected void | removeUpdate(AbstractDocument.
the change event describing the edit chngOverrides javax. Updates any document structure as a result of text removal. |
| added | back to summary |
|---|---|
| private Vector<Element> added | |
| defaultRoot | back to summary |
|---|---|
| private AbstractDocument. | |
| lineLimitAttribute | back to summary |
|---|---|
| public static final 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. | |
| removed | back to summary |
|---|---|
| private Vector<Element> removed | |
| s | back to summary |
|---|---|
| private transient Segment s | |
| tabSizeAttribute | back to summary |
|---|---|
| public static final String tabSizeAttribute Name of the attribute that specifies the tab size for tabs contained in the content. The type for the value is Integer. | |
| PlainDocument | back to summary |
|---|---|
| public PlainDocument() Constructs a plain text document. A default model using
| |
| PlainDocument | back to summary |
|---|---|
| public PlainDocument(AbstractDocument. Constructs a plain text document. A default root element is created, and the tab size set to 8.
| |
| createDefaultRoot | back to summary |
|---|---|
| protected AbstractDocument. Creates the root element to be used to represent the default document structure.
| |
| getDefaultRootElement | back to summary |
|---|---|
| public Element getDefaultRootElement() Implements abstract javax. Implements javax. Gets the default root element for the document model.
| |
| getParagraphElement | back to summary |
|---|---|
| public Element getParagraphElement(int pos) Implements abstract javax. Get the paragraph element containing the given position. Since this document only models lines, it returns the line instead. | |
| insertComposedTextUpdate | back to summary |
|---|---|
| private void insertComposedTextUpdate(AbstractDocument. | |
| insertString | back to summary |
|---|---|
| public void insertString(int offs, String str, AttributeSet a) throws BadLocationException Overrides javax. Implements javax. Inserts some content into the document. Inserting content causes a write lock to be held while the actual changes are taking place, followed by notification to the observers on the thread that grabbed the write lock. This method is thread safe, although most Swing methods are not. Please see Concurrency in Swing for more information.
| |
| insertUpdate | back to summary |
|---|---|
| protected void insertUpdate(AbstractDocument. Overrides javax. 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.
| |
| removeUpdate | back to summary |
|---|---|
| protected void removeUpdate(AbstractDocument. Overrides javax. 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.
| |