Java Platform 1.2
Beta 4

Class com.sun.java.swing.text.html.HTMLDocument.HTMLReader

java.lang.Object
  |
  +--com.sun.java.swing.text.html.HTMLEditorKit.ParserCallback
        |
        +--com.sun.java.swing.text.html.HTMLDocument.HTMLReader

public class HTMLDocument.HTMLReader
extends HTMLEditorKit.ParserCallback
An html reader to load an html document with an html element structure. This is a set of callbacks from the parser, implemented to create a set of elements tagged with attributes.


Inner Class Summary
  HTMLDocument.HTMLReader.BlockAction
           
  HTMLDocument.HTMLReader.CharacterAction
           
  HTMLDocument.HTMLReader.ParagraphAction
           
  HTMLDocument.HTMLReader.PreAction
           
  HTMLDocument.HTMLReader.SpecialAction
           
  HTMLDocument.HTMLReader.TagAction
          This is an action to be performed in response to parsing a tag.
 
Constructor Summary
HTMLDocument.HTMLReader(int offset)
           
 
Method Summary
protected  void addContent(char[] data, int offs, int length)
          Add some text with the current character attributes.
protected  void addSpecialElement(HTML.Tag t, MutableAttributeSet a)
          Add content that is basically specified entirely in the attribute set.
protected  void blockClose(HTML.Tag t)
          Add an instruction to the parse buffer to close out a block element of the given type.
protected  void blockOpen(HTML.Tag t, MutableAttributeSet attr)
          Add an instruction to the parse buffer to create a block element with the given attributes.
 void flush()
          This is the last method called on the reader.
 void handleEndTag(HTML.Tag t, int pos)
          Callback from the parser.
 void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pos)
          Callback from the parser.
 void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos)
          Callback from the parser.
 void handleText(char[] data, int pos)
          Called by the parser to indicate a block of text was encountered.
protected  void popCharacterStyle()
          Pop a previously pushed character style off the stack to return to a previous style.
protected  void preContent(char[] data)
          Add the given content that was encountered in a PRE element.
protected  void pushCharacterStyle()
          Push the current character style on a stack in preparation for forming a new nested character style.
protected  void registerTag(HTML.Tag t, HTMLDocument.HTMLReader.TagAction a)
          Register a handler for the given tag.
 
Methods inherited from class com.sun.java.swing.text.html.HTMLEditorKit.ParserCallback
handleComment , handleError
 
Methods inherited from class java.lang.Object
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
 

Constructor Detail

HTMLDocument.HTMLReader

public HTMLDocument.HTMLReader(int offset)
Method Detail

flush

public void flush()
           throws BadLocationException
This is the last method called on the reader. It allows any pending changes to be flushed into the document. Since this is currently loading synchronously, the entire set of changes are pushed in at this point.
Overrides:
flush in class HTMLEditorKit.ParserCallback

handleText

public void handleText(char[] data,
                       int pos)
Called by the parser to indicate a block of text was encountered.
Overrides:
handleText in class HTMLEditorKit.ParserCallback

handleStartTag

public void handleStartTag(HTML.Tag t,
                           MutableAttributeSet a,
                           int pos)
Callback from the parser. Route to the appropriate handler for the tag.
Overrides:
handleStartTag in class HTMLEditorKit.ParserCallback

handleEndTag

public void handleEndTag(HTML.Tag t,
                         int pos)
Callback from the parser. Route to the appropriate handler for the tag.
Overrides:
handleEndTag in class HTMLEditorKit.ParserCallback

handleSimpleTag

public void handleSimpleTag(HTML.Tag t,
                            MutableAttributeSet a,
                            int pos)
Callback from the parser. Route to the appropriate handler for the tag.
Overrides:
handleSimpleTag in class HTMLEditorKit.ParserCallback

registerTag

protected void registerTag(HTML.Tag t,
                           HTMLDocument.HTMLReader.TagAction a)
Register a handler for the given tag. By default all of the well-known tags will have been registered. This can be used to change the handling of a particular tag or to add support for custom tags.

pushCharacterStyle

protected void pushCharacterStyle()
Push the current character style on a stack in preparation for forming a new nested character style.

popCharacterStyle

protected void popCharacterStyle()
Pop a previously pushed character style off the stack to return to a previous style.

preContent

protected void preContent(char[] data)
Add the given content that was encountered in a PRE element. This synthesizes lines to hold the runs of text, and makes calls to addContent to actually add the text.

blockOpen

protected void blockOpen(HTML.Tag t,
                         MutableAttributeSet attr)
Add an instruction to the parse buffer to create a block element with the given attributes.

blockClose

protected void blockClose(HTML.Tag t)
Add an instruction to the parse buffer to close out a block element of the given type.

addContent

protected void addContent(char[] data,
                          int offs,
                          int length)
Add some text with the current character attributes.
Parameters:
embedded - the attributes of an embedded object.

addSpecialElement

protected void addSpecialElement(HTML.Tag t,
                                 MutableAttributeSet a)
Add content that is basically specified entirely in the attribute set.

Java Platform 1.2
Beta 4

Submit a bug or feature
Submit comments/suggestions about new javadoc look
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.
This documentation was generated with a post-Beta4 version of Javadoc.