API Overview API Index Package Overview Direct link to this page
JDK 1.6
  javax.swing.text. DefaultStyledDocument View Source
Author(s)
Timothy Prinzing
Since
Version
1.128 05/04/06
Serial
Hierarchy
 Object
      AbstractDocument
          DefaultStyledDocument
Implements
 StyledDocument
Subclasses
Description
public class DefaultStyledDocument
  A document that can be marked up with character and paragraph styles in a manner similar to the Rich Text Format.
See also:    Document AbstractDocument
Constructors
public DefaultStyledDocument ()
  Constructs a default styled document.
public DefaultStyledDocument (Content c, StyleContext styles)
  Constructs a styled document.
public DefaultStyledDocument (StyleContext styles)
  Constructs a styled document with the default content storage implementation and a shared set of styles.
Methods
Hide/Show inherited methods
public void addDocumentListener (DocumentListener listener) [Overrides AbstractDocument]
  Adds a document listener for notification of any changes.
public Style addStyle (String nm, Style parent) [Specified in StyledDocument]
  Adds a new style into the logical style hierarchy.
public void addUndoableEditListener (UndoableEditListener listener) [Inherited From AbstractDocument]
  Adds an undo listener for notification of any changes.
protected void create (ElementSpec data)
  Initialize the document to reflect the given element structure (i.e.
protected Element createBranchElement (Element parent, AttributeSet a) [Inherited From AbstractDocument]
  Creates a document branch element, that can contain other elements.
protected AbstractElement createDefaultRoot ()
  Creates the root element to be used to represent the default document structure.
protected Element createLeafElement (Element parent, AttributeSet a, int p0, int p1) [Inherited From AbstractDocument]
  Creates a document leaf element.
publicsynchronized Position createPosition (int offs) throws BadLocationException [Inherited From AbstractDocument]
  Returns a position that will track change as the document is altered.
pack-private short createSpecsForInsertAfterNewline (Element paragraph, Element pParagraph, AttributeSet pattr, Vector parseBuffer, int offset, int endOffset)
  This is called by insertUpdate when inserting after a new line.
pack-private ChangeListener createStyleChangeListener ()
Returns a new instance of StyleChangeHandler.
pack-private ChangeListener createStyleContextChangeListener ()
Returns a new instance of StyleContextChangeHandler.
public void dump (PrintStream out) [Inherited From AbstractDocument]
  Gives a diagnostic dump.
protected void fireChangedUpdate (DocumentEvent e) [Inherited From AbstractDocument]
  Notifies all listeners that have registered interest for notification on this event type.
protected void fireInsertUpdate (DocumentEvent e) [Inherited From AbstractDocument]
  Notifies all listeners that have registered interest for notification on this event type.
protected void fireRemoveUpdate (DocumentEvent e) [Inherited From AbstractDocument]
  Notifies all listeners that have registered interest for notification on this event type.
protected void fireUndoableEditUpdate (UndoableEditEvent e) [Inherited From AbstractDocument]
  Notifies all listeners that have registered interest for notification on this event type.
public int getAsynchronousLoadPriority () [Inherited From AbstractDocument]
  Gets the asynchronous loading priority.
protectedfinal AttributeContext getAttributeContext () [Inherited From AbstractDocument]
  Fetches the context for managing attributes.
public Color getBackground (AttributeSet attr) [Specified in StyledDocument]
  Gets the background color from an attribute set.
public Element getBidiRootElement () [Inherited From AbstractDocument]
  Returns the root element of the bidirectional structure for this document.
public Element getCharacterElement (int pos) [Specified in StyledDocument]
  Gets a character element based on a position.
protectedfinal Content getContent () [Inherited From AbstractDocument]
  Gets the content for the document.
protectedfinalsynchronized Thread getCurrentWriter () [Inherited From AbstractDocument]
  Fetches the current writing thread if there is one.
public Element getDefaultRootElement () [Specified in AbstractDocument]
  Gets the default root element.
public DocumentFilter getDocumentFilter () [Inherited From AbstractDocument]
  Returns the DocumentFilter that is responsible for filtering of insertion/removal.
public DocumentListener getDocumentListeners () [Inherited From AbstractDocument]
  Returns an array of all the document listeners registered on this document.
public Dictionary<Object, Object> getDocumentProperties () [Inherited From AbstractDocument]
  Supports managing a set of properties.
publicfinal Position getEndPosition () [Inherited From AbstractDocument]
  Returns a position that represents the end of the document.
public Font getFont (AttributeSet attr) [Specified in StyledDocument]
  Gets the font from an attribute set.
public Color getForeground (AttributeSet attr) [Specified in StyledDocument]
  Gets the foreground color from an attribute set.
public int getLength () [Inherited From AbstractDocument]
  Returns the length of the data.
public T getListeners (Class< T> listenerType) [Inherited From AbstractDocument]
  Returns an array of all the objects currently registered as FooListeners upon this document.
public Style getLogicalStyle (int p) [Specified in StyledDocument]
  Fetches the logical style assigned to the paragraph represented by the given position.
public Element getParagraphElement (int pos) [Specified in StyledDocument]
  Gets the paragraph element at the offset pos.
publicfinal Object getProperty (Object key) [Inherited From AbstractDocument]
  A convenience method for looking up a property value.
public Element getRootElements () [Inherited From AbstractDocument]
  Gets all root elements defined.
publicfinal Position getStartPosition () [Inherited From AbstractDocument]
  Returns a position that represents the start of the document.
public Style getStyle (String nm) [Specified in StyledDocument]
  Fetches a named style previously added.
public Enumeration<Object> getStyleNames ()
  Fetches the list of of style names.
public String getText (int offset, int length) throws BadLocationException [Inherited From AbstractDocument]
  Gets a sequence of text from the document.
public void getText (int offset, int length, Segment txt) throws BadLocationException [Inherited From AbstractDocument]
  Fetches the text contained within the given portion of the document.
public UndoableEditListener getUndoableEditListeners () [Inherited From AbstractDocument]
  Returns an array of all the undoable edit listeners registered on this document.
pack-private void handleInsertString (int offs, String str, AttributeSet a) throws BadLocationException [Inherited From AbstractDocument]
Performs the actual work of inserting the text; it is assumed the caller has obtained a write lock before invoking this.
pack-private void handleRemove (int offs, int len) throws BadLocationException [Inherited From AbstractDocument]
  Performs the actual work of the remove.
protected void insert (int offset, ElementSpec data) throws BadLocationException
  Inserts new elements in bulk.
public void insertString (int offs, String str, AttributeSet a) throws BadLocationException [Inherited From AbstractDocument]
  Inserts some content into the document.
protected void insertUpdate (DefaultDocumentEvent chng, AttributeSet attr) [Overrides AbstractDocument]
  Updates document structure as a result of text insertion.
pack-private boolean isLeftToRight (int p0, int p1) [Inherited From AbstractDocument]
Returns true if the text in the range p0 to p1 is left to right.
protected void postRemoveUpdate (DefaultDocumentEvent chng) [Inherited From AbstractDocument]
  Updates any document structure as a result of text removal.
publicfinal void putProperty (Object key, Object value) [Inherited From AbstractDocument]
  A convenience method for storing up a property value.
publicfinalsynchronized void readLock () [Inherited From AbstractDocument]
  Acquires a lock to begin reading some state from the document.
publicfinalsynchronized void readUnlock () [Inherited From AbstractDocument]
  Does a read unlock.
public void remove (int offs, int len) throws BadLocationException [Inherited From AbstractDocument]
  Removes some content from the document.
public void removeDocumentListener (DocumentListener listener) [Overrides AbstractDocument]
  Removes a document listener.
public void removeStyle (String nm) [Specified in StyledDocument]
  Removes a named style previously added to the document.
public void removeUndoableEditListener (UndoableEditListener listener) [Inherited From AbstractDocument]
  Removes an undo listener.
protected void removeUpdate (DefaultDocumentEvent chng) [Overrides AbstractDocument]
  Updates document structure as a result of text removal.
public void render (Runnable r) [Inherited From AbstractDocument]
  This allows the model to be safely rendered in the presence of currency, if the model supports being updated asynchronously.
public void replace (int offset, int length, String text, AttributeSet attrs) throws BadLocationException [Inherited From AbstractDocument]
  Deletes the region of text from offset to offset + length, and replaces it with text.
public void setAsynchronousLoadPriority (int p) [Inherited From AbstractDocument]
  Sets the asynchronous loading priority.
public void setCharacterAttributes (int offset, int length, AttributeSet s, boolean replace) [Specified in StyledDocument]
  Sets attributes for some part of the document.
public void setDocumentFilter (DocumentFilter filter) [Inherited From AbstractDocument]
  Sets the DocumentFilter.
public void setDocumentProperties (Dictionary<Object, Object> x) [Inherited From AbstractDocument]
  Replaces the document properties dictionary for this document.
public void setLogicalStyle (int pos, Style s) [Specified in StyledDocument]
  Sets the logical style to use for the paragraph at the given position.
public void setParagraphAttributes (int offset, int length, AttributeSet s, boolean replace) [Specified in StyledDocument]
  Sets attributes for a paragraph.
protected void styleChanged (Style style)
  Called when any of this document's styles have changed.
pack-private void updateBidi (DefaultDocumentEvent chng) [Inherited From AbstractDocument]
  Update the bidi element structure as a result of the given change to the document.
pack-private void updateStylesListeningTo ()
Adds a ChangeListener to new styles, and removes ChangeListener from old styles.
protectedfinalsynchronized void writeLock () [Inherited From AbstractDocument]
  Acquires a lock to begin mutating the document this lock protects.
protectedfinalsynchronized void writeUnlock () [Inherited From AbstractDocument]
  Releases a write lock previously obtained via writeLock.
Fields
Hide/Show inherited fields
pack-privatefinalstatic String AsyncLoadPriority = "load priority" [Inherited From AbstractDocument]
Document property that indicates asynchronous loading is desired, with the thread priority given as the value.
protectedfinalstatic String BAD_LOCATION = "document location failure" [Inherited From AbstractDocument]
Error message to indicate a bad location.
publicfinalstatic String BidiElementName = "bidi level" [Inherited From AbstractDocument]
Name of elements used to hold a unidirectional run
protected ElementBuffer buffer
publicfinalstatic int BUFFER_SIZE_DEFAULT = "4096"
The default size of the initial content buffer.
publicfinalstatic String ContentElementName = "content" [Inherited From AbstractDocument]
Name of elements used to represent content
publicfinalstatic String ElementNameAttribute = "$ename" [Inherited From AbstractDocument]
Name of the attribute used to specify element names.
pack-privatefinalstatic String I18NProperty = "i18n" [Inherited From AbstractDocument]
  Document property that indicates whether internationalization functions such as text reordering or reshaping should be performed.
protected EventListenerList listenerList [Inherited From AbstractDocument]
The event listener list for the document.
pack-privatefinalstatic Object MultiByteProperty [Inherited From AbstractDocument]
  Document property that indicates if a character has been inserted into the document that is more than one byte long.
publicfinalstatic String ParagraphElementName = "paragraph" [Inherited From AbstractDocument]
Name of elements used to represent paragraphs
publicfinalstatic String SectionElementName = "section" [Inherited From AbstractDocument]
Name of elements used to hold sections (lines/paragraphs).
publicfinalstatic String StreamDescriptionProperty = "stream" [Inherited From StyledDocument]
  The property name for the description of the stream used to initialize the document.
publicfinalstatic String TitleProperty = "title" [Inherited From StyledDocument]
The property name for the title of the document, if there is one.
Nested Classes
  DefaultStyledDocument.SectionElement
Default root element for a document...
  DefaultStyledDocument.ElementSpec
Specification for building elements.
  DefaultStyledDocument.ElementBuffer
Class to manage changes to the element hierarchy.
  DefaultStyledDocument.AttributeUndoableEdit
An UndoableEdit used to remember AttributeSet changes to an Element.
  DefaultStyledDocument.StyleChangeUndoableEdit
UndoableEdit for changing the resolve parent of an Element.
  DefaultStyledDocument.AbstractChangeHandler
Base class for style change handlers with support for stale objects detection.
  DefaultStyledDocument.StyleChangeHandler
Added to all the Styles.
  DefaultStyledDocument.StyleContextChangeHandler
Added to the StyleContext.
  DefaultStyledDocument.ChangeUpdateRunnable
When run this creates a change event for the complete document and fires it.
  AbstractDocument.Content
Interface to describe a sequence of character content that can be edited.
  AbstractDocument.AttributeContext
An interface that can be used to allow MutableAttributeSet implementations to use pluggable attribute compression techniques.
  AbstractDocument.AbstractElement
Implements the abstract part of an element.
  AbstractDocument.BranchElement
Implements a composite element that contains other elements.
  AbstractDocument.LeafElement
Implements an element that directly represents content of some kind.
  AbstractDocument.BidiRootElement
Represents the root element of the bidirectional element structure.
  AbstractDocument.BidiElement
Represents an element of the bidirectional element structure.
  AbstractDocument.DefaultDocumentEvent
Stores document changes as the document is being modified.
  AbstractDocument.UndoRedoDocumentEvent
This event used when firing document changes while Undo/Redo operations.
  AbstractDocument.ElementEdit
An implementation of ElementChange that can be added to the document event.
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar