Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.hexidec.ekit.component
Class ExtendedHTMLDocument  view ExtendedHTMLDocument download ExtendedHTMLDocument.java

java.lang.Object
  extended byjavax.swing.text.AbstractDocument
      extended byjavax.swing.text.DefaultStyledDocument
          extended byjavax.swing.text.html.HTMLDocument
              extended bycom.hexidec.ekit.component.ExtendedHTMLDocument
All Implemented Interfaces:
javax.swing.text.Document, java.io.Serializable, javax.swing.text.StyledDocument

public class ExtendedHTMLDocument
extends javax.swing.text.html.HTMLDocument

A document that models HTML. The purpose of this model is to support both browsing and editing. As a result, the structure described by an HTML document is not exactly replicated by default. The element structure that is modeled by default, is built by the class HTMLDocument.HTMLReader, which implements the HTMLEditorKit.ParserCallback protocol that the parser expects. To change the structure one can subclass HTMLReader, and reimplement the method getReader(int) 55 to return the new reader implementation. The documentation for HTMLReader should be consulted for the details of the default structure created. The intent is that the document be non-lossy (although reproducing the HTML format may result in a different format).

The document models only HTML, and makes no attempt to store view attributes in it. The elements are identified by the StyleContext.NameAttribute attribute, which should always have a value of type HTML.Tag that identifies the kind of element. Some of the elements (such as comments) are synthesized. The HTMLFactory uses this attribute to determine what kind of view to build.

This document supports incremental loading. The TokenThreshold property controls how much of the parse is buffered before trying to update the element structure of the document. This property is set by the EditorKit so that subclasses can disable it.

The Base property determines the URL against which relative URLs are resolved. By default, this will be the Document.StreamDescriptionProperty if the value of the property is a URL. If a <BASE> tag is encountered, the base will become the URL specified by that tag. Because the base URL is a property, it can of course be set directly.

The default content storage mechanism for this document is a gap buffer (GapContent). Alternatives can be supplied by using the constructor that takes a Content implementation.

Version:
1.148 04/09/02

Nested Class Summary
 class ExtendedHTMLDocument.ExtendedHTMLReader
           
 
Nested classes inherited from class javax.swing.text.html.HTMLDocument
javax.swing.text.html.HTMLDocument.BlockElement, javax.swing.text.html.HTMLDocument.HTMLReader, javax.swing.text.html.HTMLDocument.Iterator, javax.swing.text.html.HTMLDocument.RunElement
 
Nested classes inherited from class javax.swing.text.DefaultStyledDocument
javax.swing.text.DefaultStyledDocument.AttributeUndoableEdit, javax.swing.text.DefaultStyledDocument.ElementBuffer, javax.swing.text.DefaultStyledDocument.ElementSpec, javax.swing.text.DefaultStyledDocument.SectionElement
 
Nested classes inherited from class javax.swing.text.AbstractDocument
javax.swing.text.AbstractDocument.AbstractElement, javax.swing.text.AbstractDocument.AttributeContext, javax.swing.text.AbstractDocument.BranchElement, javax.swing.text.AbstractDocument.Content, javax.swing.text.AbstractDocument.DefaultDocumentEvent, javax.swing.text.AbstractDocument.ElementEdit, javax.swing.text.AbstractDocument.LeafElement
 
Field Summary
 
Fields inherited from class javax.swing.text.html.HTMLDocument
AdditionalComments
 
Fields inherited from class javax.swing.text.DefaultStyledDocument
buffer, BUFFER_SIZE_DEFAULT
 
Fields inherited from class javax.swing.text.AbstractDocument
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName
 
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 
Constructor Summary
ExtendedHTMLDocument()
          Constructs an HTML document using the default buffer size and a default StyleSheet.
ExtendedHTMLDocument(javax.swing.text.AbstractDocument.Content c, javax.swing.text.html.StyleSheet styles)
          Constructs an HTML document with the given content storage implementation and the given style/attribute storage mechanism.
ExtendedHTMLDocument(javax.swing.text.html.StyleSheet styles)
          Constructs an HTML document with the default content storage implementation and the specified style/attribute storage mechanism.
 
Method Summary
 javax.swing.text.html.HTMLEditorKit.ParserCallback getReader(int pos)
          Fetches the reader for the parser to use when loading the document with HTML.
 javax.swing.text.html.HTMLEditorKit.ParserCallback getReader(int pos, int popDepth, int pushDepth, javax.swing.text.html.HTML.Tag insertTag)
          Returns the reader for the parser to use to load the document with HTML.
(package private)  javax.swing.text.html.HTMLEditorKit.ParserCallback getReader(int pos, int popDepth, int pushDepth, javax.swing.text.html.HTML.Tag insertTag, boolean insertInsertTag)
          Fetches the reader for the parser to use to load the document with HTML.
 
Methods inherited from class javax.swing.text.html.HTMLDocument
create, createBranchElement, createDefaultRoot, createLeafElement, fireChangedUpdate, fireUndoableEditUpdate, getBase, getElement, getElement, getIterator, getParser, getPreservesUnknownTags, getStyleSheet, getTokenThreshold, insert, insertAfterEnd, insertAfterStart, insertBeforeEnd, insertBeforeStart, insertUpdate, processHTMLFrameHyperlinkEvent, setBase, setInnerHTML, setOuterHTML, setParagraphAttributes, setParser, setPreservesUnknownTags, setTokenThreshold
 
Methods inherited from class javax.swing.text.DefaultStyledDocument
addStyle, getBackground, getCharacterElement, getDefaultRootElement, getFont, getForeground, getLogicalStyle, getParagraphElement, getStyle, getStyleNames, removeStyle, removeUpdate, setCharacterAttributes, setLogicalStyle, styleChanged
 
Methods inherited from class javax.swing.text.AbstractDocument
addDocumentListener, addUndoableEditListener, createPosition, dump, fireInsertUpdate, fireRemoveUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, insertString, postRemoveUpdate, putProperty, readLock, readUnlock, remove, removeDocumentListener, removeUndoableEditListener, 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
 
Methods inherited from interface javax.swing.text.Document
addDocumentListener, addUndoableEditListener, createPosition, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, insertString, putProperty, remove, removeDocumentListener, removeUndoableEditListener, render
 

Constructor Detail

ExtendedHTMLDocument

public ExtendedHTMLDocument()
Constructs an HTML document using the default buffer size and a default StyleSheet. This is a convenience method for the constructor HTMLDocument(Content, StyleSheet).


ExtendedHTMLDocument

public ExtendedHTMLDocument(javax.swing.text.html.StyleSheet styles)
Constructs an HTML document with the default content storage implementation and the specified style/attribute storage mechanism. This is a convenience method for the constructor HTMLDocument(Content, StyleSheet).


ExtendedHTMLDocument

public ExtendedHTMLDocument(javax.swing.text.AbstractDocument.Content c,
                            javax.swing.text.html.StyleSheet styles)
Constructs an HTML document with the given content storage implementation and the given style/attribute storage mechanism.

Method Detail

getReader

public javax.swing.text.html.HTMLEditorKit.ParserCallback getReader(int pos)
Fetches the reader for the parser to use when loading the document with HTML. This is implemented to return an instance of HTMLDocument.HTMLReader. Subclasses can reimplement this method to change how the document gets structured if desired. (For example, to handle custom tags, or structurally represent character style elements.)


getReader

public javax.swing.text.html.HTMLEditorKit.ParserCallback getReader(int pos,
                                                                    int popDepth,
                                                                    int pushDepth,
                                                                    javax.swing.text.html.HTML.Tag insertTag)
Returns the reader for the parser to use to load the document with HTML. This is implemented to return an instance of HTMLDocument.HTMLReader. Subclasses can reimplement this method to change how the document gets structured if desired. (For example, to handle custom tags, or structurally represent character style elements.)

This is a convenience method for getReader(int, int, int, HTML.Tag, TRUE).


getReader

javax.swing.text.html.HTMLEditorKit.ParserCallback getReader(int pos,
                                                             int popDepth,
                                                             int pushDepth,
                                                             javax.swing.text.html.HTML.Tag insertTag,
                                                             boolean insertInsertTag)
Fetches the reader for the parser to use to load the document with HTML. This is implemented to return an instance of HTMLDocument.HTMLReader. Subclasses can reimplement this method to change how the document get structured if desired (e.g. to handle custom tags, structurally represent character style elements, etc.).