API Overview API Index Package Overview Direct link to this page
JDK 1.6
  javax.swing.text.html. HTMLDocument View Source
Author(s)
Timothy Prinzing
Scott Violet
Sunita Mani
Since
Version
1.180 05/10/06
Serial
Hierarchy
 Object
      AbstractDocument
          DefaultStyledDocument
              HTMLDocument
Implements
Subclasses
Description
public class HTMLDocument
  A document that models HTML.
See also:   
Constructors
public HTMLDocument ()
  Constructs an HTML document using the default buffer size and a default StyleSheet.
public HTMLDocument (Content c, StyleSheet styles)
  Constructs an HTML document with the given content storage implementation and the given style/attribute storage mechanism.
public HTMLDocument (StyleSheet styles)
  Constructs an HTML document with the default content storage implementation and the specified style/attribute storage mechanism.
Methods
Hide/Show inherited methods
public void addDocumentListener (DocumentListener listener) [Inherited From DefaultStyledDocument]
  Adds a document listener for notification of any changes.
pack-private void addMap (Map map)
  Adds the specified map, this will remove a Map that has been previously registered with the same name.
public Style addStyle (String nm, Style parent) [Inherited From DefaultStyledDocument]
  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) [Overrides DefaultStyledDocument]
  Replaces the contents of the document with the given element specifications.
protected Element createBranchElement (Element parent, AttributeSet a) [Overrides AbstractDocument]
  Creates a document branch element, that can contain other elements.
protected AbstractElement createDefaultRoot () [Overrides DefaultStyledDocument]
  Creates the root element to be used to represent the default document structure.
protected Element createLeafElement (Element parent, AttributeSet a, int p0, int p1) [Overrides AbstractDocument]
  Creates a document leaf element that directly represents text (doesn't have any children).
publicsynchronized Position createPosition (int offs) throws BadLocationException [Inherited From AbstractDocument]
  Returns a position that will track change as the document is altered.
public void dump (PrintStream out) [Inherited From AbstractDocument]
  Gives a diagnostic dump.
protected void fireChangedUpdate (DocumentEvent e) [Overrides 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) [Overrides 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) [Inherited From DefaultStyledDocument]
  Gets the background color from an attribute set.
public URL getBase ()
  Returns the location to resolve relative URLs against.
pack-private String getBaseTarget ()
public Element getBidiRootElement () [Inherited From AbstractDocument]
  Returns the root element of the bidirectional structure for this document.
public Element getCharacterElement (int pos) [Inherited From DefaultStyledDocument]
  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 () [Inherited From DefaultStyledDocument] [Specified in AbstractDocument]
  Gets the default root element.
pack-private String getDefaultStyleSheetType ()
  Returns the content type language used for style sheets.
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.
public Element getElement (Element e, Object attribute, Object value)
  Returns the child element of e that contains the attribute, attribute with value value, or null if one isn't found.
public Element getElement (String id)
  Returns the element that has the given id Attribute.
publicfinal Position getEndPosition () [Inherited From AbstractDocument]
  Returns a position that represents the end of the document.
public Font getFont (AttributeSet attr) [Inherited From DefaultStyledDocument]
  Gets the font from an attribute set.
public Color getForeground (AttributeSet attr) [Inherited From DefaultStyledDocument]
  Gets the foreground color from an attribute set.
public Iterator getIterator (Tag t)
  Fetches an iterator for the specified HTML tag.
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) [Inherited From DefaultStyledDocument]
  Fetches the logical style assigned to the paragraph represented by the given position.
pack-private Map getMap (String name)
  Returns the Map associated with the given name.
pack-private Enumeration getMaps ()
  Returns an Enumeration of the possible Maps.
public Element getParagraphElement (int pos) [Inherited From DefaultStyledDocument] [Specified in AbstractDocument]
  Gets the paragraph element at the offset pos.
public Parser getParser ()
  Returns the parser that is used when inserting HTML into the existing document.
public boolean getPreservesUnknownTags ()
  Returns the behavior the parser observes when encountering unknown tags.
publicfinal Object getProperty (Object key) [Inherited From AbstractDocument]
  A convenience method for looking up a property value.
public ParserCallback getReader (int pos)
  Fetches the reader for the parser to use when loading the document with HTML.
public ParserCallback getReader (int pos, int popDepth, int pushDepth, Tag insertTag)
  Returns the reader for the parser to use to load the document with HTML.
pack-private ParserCallback getReader (int pos, int popDepth, int pushDepth, Tag insertTag, boolean insertInsertTag)
  Fetches the reader for the parser to use to load the document with HTML.
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) [Inherited From DefaultStyledDocument]
  Fetches a named style previously added.
public Enumeration<Object> getStyleNames () [Inherited From DefaultStyledDocument]
  Fetches the list of of style names.
public StyleSheet getStyleSheet ()
  Fetches the StyleSheet with the document-specific display rules (CSS) that were specified in the HTML document itself.
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 int getTokenThreshold ()
  Gets the number of tokens to buffer before trying to update the documents element structure.
public UndoableEditListener getUndoableEditListeners () [Inherited From AbstractDocument]
  Returns an array of all the undoable edit listeners registered on this document.
pack-private boolean hasBaseTag ()
protected void insert (int offset, ElementSpec data) throws BadLocationException [Overrides DefaultStyledDocument]
  Inserts new elements in bulk.
public void insertAfterEnd (Element elem, String htmlText) throws BadLocationException IOException
  Inserts the HTML specified as a string after the the end of the given element.
public void insertAfterStart (Element elem, String htmlText) throws BadLocationException IOException
  Inserts the HTML specified as a string at the start of the element.
public void insertBeforeEnd (Element elem, String htmlText) throws BadLocationException IOException
  Inserts the HTML specified as a string at the end of the element.
public void insertBeforeStart (Element elem, String htmlText) throws BadLocationException IOException
  Inserts the HTML specified as a string before the start of the given element.
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 DefaultStyledDocument]
  Updates document structure as a result of text insertion.
pack-private boolean isFrameDocument ()
  Returns true if the document will be viewed in a frame.
pack-privatestatic boolean matchNameAttribute (AttributeSet attr, Tag tag)
  Returns true if StyleConstants.NameAttribute is equal to the tag that is passed in as a parameter.
pack-private void obtainLock ()
protected void postRemoveUpdate (DefaultDocumentEvent chng) [Inherited From AbstractDocument]
  Updates any document structure as a result of text removal.
public void processHTMLFrameHyperlinkEvent (HTMLFrameHyperlinkEvent e)
  Processes HyperlinkEvents that are generated by documents in an HTML frame.
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.
pack-private void releaseLock ()
public void remove (int offs, int len) throws BadLocationException [Inherited From AbstractDocument]
  Removes some content from the document.
public void removeDocumentListener (DocumentListener listener) [Inherited From DefaultStyledDocument]
  Removes a document listener.
pack-private void removeMap (Map map)
  Removes a previously registered map.
public void removeStyle (String nm) [Inherited From DefaultStyledDocument]
  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) [Inherited From DefaultStyledDocument]
  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 setBase (URL u)
  Sets the location to resolve relative URLs against.
public void setCharacterAttributes (int offset, int length, AttributeSet s, boolean replace) [Inherited From DefaultStyledDocument]
  Sets attributes for some part of the document.
pack-private void setDefaultStyleSheetType (String contentType)
  Sets the content type language used for style sheets that do not explicitly specify the type.
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.
pack-private void setFrameDocumentState (boolean frameDoc)
  Sets a boolean state about whether the document will be viewed in a frame.
public void setInnerHTML (Element elem, String htmlText) throws BadLocationException IOException
  Replaces the children of the given element with the contents specified as an HTML string.
public void setLogicalStyle (int pos, Style s) [Inherited From DefaultStyledDocument]
  Sets the logical style to use for the paragraph at the given position.
public void setOuterHTML (Element elem, String htmlText) throws BadLocationException IOException
  Replaces the given element in the parent with the contents specified as an HTML string.
public void setParagraphAttributes (int offset, int length, AttributeSet s, boolean replace) [Overrides DefaultStyledDocument]
  Sets attributes for a paragraph.
public void setParser (Parser parser)
  Sets the parser that is used by the methods that insert html into the existing document, such as setInnerHTML, and setOuterHTML.
public void setPreservesUnknownTags (boolean preservesTags)
  Determines how unknown tags are handled by the parser.
public void setTokenThreshold (int n)
  Sets the number of tokens to buffer before trying to update the documents element structure.
protected void styleChanged (Style style) [Inherited From DefaultStyledDocument]
  Called when any of this document's styles have changed.
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
publicfinalstatic String AdditionalComments = "AdditionalComments"
  Document property key value.
protectedfinalstatic String BAD_LOCATION = "document location failure" [Inherited From AbstractDocument]
Error message to indicate a bad location.
pack-private URL base
  The location to resolve relative URLs against.
publicfinalstatic String BidiElementName = "bidi level" [Inherited From AbstractDocument]
Name of elements used to hold a unidirectional run
protected ElementBuffer buffer [Inherited From DefaultStyledDocument]
publicfinalstatic int BUFFER_SIZE_DEFAULT = "4096" [Inherited From DefaultStyledDocument]
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-private boolean hasBaseTag
does the document have base tag
protected EventListenerList listenerList [Inherited From AbstractDocument]
The event listener list for the document.
pack-privatestatic String MAP_PROPERTY
Property Maps are registered under, will be a Hashtable.
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).
pack-privatefinalstatic String StyleType = "StyleType"
  Document property key value.
pack-privatefinalstatic String TokenThreshold = "token threshold"
Document property for the number of tokens to buffer before building an element subtree to represent them.
Nested Classes
  HTMLDocument.Iterator
An iterator to iterate over a particular type of tag.
  HTMLDocument.LeafIterator
An iterator to iterate over a particular type of tag.
  HTMLDocument.HTMLReader
An HTML reader to load an HTML document with an HTML element structure.
  HTMLDocument.TaggedAttributeSet
Used by StyleSheet to determine when to avoid removing HTML.Tags matching StyleConstants.
  HTMLDocument.RunElement
An element that represents a chunk of text that has a set of HTML character level attributes assigned to it.
  HTMLDocument.BlockElement
An element that represents a structural block of HTML.
  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.
  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.DefaultDocumentEvent
Stores document changes as the document is being modified.
  AbstractDocument.ElementEdit
An implementation of ElementChange that can be added to the document event.
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar