javax.swing.text

Class DefaultStyledDocument

Implemented Interfaces:
Document, Serializable, StyledDocument
Known Direct Subclasses:
HTMLDocument

public class DefaultStyledDocument
extends AbstractDocument
implements StyledDocument

See Also:
Serialized Form

Nested Class Summary

class
DefaultStyledDocument.ElementBuffer

Nested classes/interfaces inherited from class javax.swing.text.AbstractDocument

AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement

Field Summary

static int
BUFFER_SIZE_DEFAULT
protected DefaultStyledDocument.ElementBuffer
buffer

Fields inherited from class javax.swing.text.AbstractDocument

BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, ParagraphElementName, SectionElementName, listenerList

Fields inherited from interface javax.swing.text.Document

StreamDescriptionProperty, TitleProperty

Constructor Summary

DefaultStyledDocument()
DefaultStyledDocument(AbstractDocument.Content content, StyleContext context)
DefaultStyledDocument(StyleContext context)

Method Summary

Style
addStyle(String nm, Style parent)
protected AbstractDocument.AbstractElement
createDefaultRoot()
Color
getBackground(AttributeSet attributes)
Element
getCharacterElement(int position)
Element
getDefaultRootElement()
Returns the default root element.
Font
getFont(AttributeSet attributes)
Color
getForeground(AttributeSet attributes)
Style
getLogicalStyle(int position)
Element
getParagraphElement(int position)
Style
getStyle(String nm)
void
removeStyle(String nm)
void
setCharacterAttributes(int offset, int length, AttributeSet attributes, boolean replace)
void
setLogicalStyle(int position, Style style)
void
setParagraphAttributes(int offset, int length, AttributeSet attributes, boolean replace)

Methods inherited from class javax.swing.text.AbstractDocument

addDocumentListener, addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDefaultRootElement, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getParagraphElement, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, insertString, insertUpdate, postRemoveUpdate, putProperty, readLock, readUnlock, remove, removeDocumentListener, removeUndoableEditListener, removeUpdate, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

BUFFER_SIZE_DEFAULT

public static final int BUFFER_SIZE_DEFAULT

Field Value:
4096


buffer

protected DefaultStyledDocument.ElementBuffer buffer

Constructor Details

DefaultStyledDocument

public DefaultStyledDocument()


DefaultStyledDocument

public DefaultStyledDocument(AbstractDocument.Content content,
                             StyleContext context)


DefaultStyledDocument

public DefaultStyledDocument(StyleContext context)

Method Details

addStyle

public Style addStyle(String nm,
                      Style parent)
Specified by:
addStyle in interface StyledDocument


createDefaultRoot

protected AbstractDocument.AbstractElement createDefaultRoot()


getBackground

public Color getBackground(AttributeSet attributes)
Specified by:
getBackground in interface StyledDocument


getCharacterElement

public Element getCharacterElement(int position)
Specified by:
getCharacterElement in interface StyledDocument


getDefaultRootElement

public Element getDefaultRootElement()
Returns the default root element. Views should be using this element unless other mechanisms for assigning views to element structure is provided.
Specified by:
getDefaultRootElement in interface Document
Overrides:
getDefaultRootElement in interface AbstractDocument

Returns:
the default root element


getFont

public Font getFont(AttributeSet attributes)
Specified by:
getFont in interface StyledDocument


getForeground

public Color getForeground(AttributeSet attributes)
Specified by:
getForeground in interface StyledDocument


getLogicalStyle

public Style getLogicalStyle(int position)
Specified by:
getLogicalStyle in interface StyledDocument


getParagraphElement

public Element getParagraphElement(int position)
Specified by:
getParagraphElement in interface StyledDocument
Overrides:
getParagraphElement in interface AbstractDocument


getStyle

public Style getStyle(String nm)
Specified by:
getStyle in interface StyledDocument


removeStyle

public void removeStyle(String nm)
Specified by:
removeStyle in interface StyledDocument


setCharacterAttributes

public void setCharacterAttributes(int offset,
                                   int length,
                                   AttributeSet attributes,
                                   boolean replace)
Specified by:
setCharacterAttributes in interface StyledDocument


setLogicalStyle

public void setLogicalStyle(int position,
                            Style style)
Specified by:
setLogicalStyle in interface StyledDocument


setParagraphAttributes

public void setParagraphAttributes(int offset,
                                   int length,
                                   AttributeSet attributes,
                                   boolean replace)
Specified by:
setParagraphAttributes in interface StyledDocument


DefaultStyledDocument.java -- Copyright (C) 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.