|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.text.html.HTMLEditorKit.ParserCallback
javax.swing.text.html.HTMLDocument.HTMLReader
public class HTMLDocument.HTMLReader
A reader to load an HTMLDocument with HTML structure.
Nested Class Summary | |
---|---|
class |
HTMLDocument.HTMLReader.BlockAction
|
class |
HTMLDocument.HTMLReader.CharacterAction
|
class |
HTMLDocument.HTMLReader.FormAction
Processes elements that make up forms: <input>, <textarea>, <select> and <option>. |
class |
HTMLDocument.HTMLReader.HiddenAction
This action indicates that the content between starting and closing HTML elements (like script - /script) should not be visible. |
class |
HTMLDocument.HTMLReader.IsindexAction
Handles <isindex> tags. |
class |
HTMLDocument.HTMLReader.ParagraphAction
|
class |
HTMLDocument.HTMLReader.PreAction
This action is performed when a <pre> tag is parsed. |
class |
HTMLDocument.HTMLReader.SpecialAction
Inserts the elements that are represented by ths single tag with attributes (only). |
class |
HTMLDocument.HTMLReader.TagAction
|
Field Summary | |
---|---|
protected MutableAttributeSet |
charAttr
Holds the current character attribute set * |
protected Vector<DefaultStyledDocument.ElementSpec> |
parseBuffer
|
Fields inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback |
---|
IMPLIED |
Constructor Summary | |
---|---|
HTMLDocument.HTMLReader(int offset)
|
|
HTMLDocument.HTMLReader(int offset,
int popDepth,
int pushDepth,
HTML.Tag insertTag)
|
Method Summary | |
---|---|
protected void |
addContent(char[] data,
int offs,
int length)
Adds text to the appropriate context using the current character attribute set. |
protected void |
addContent(char[] data,
int offs,
int length,
boolean generateImpliedPIfNecessary)
Adds text to the appropriate context using the current character attribute set, and possibly generating an IMPLIED Tag if necessary. |
protected void |
addSpecialElement(HTML.Tag t,
MutableAttributeSet a)
Adds content that is specified in the attribute set. |
protected void |
blockClose(HTML.Tag t)
Instructs the parse buffer to close the block element associated with the given HTML.Tag |
protected void |
blockOpen(HTML.Tag t,
MutableAttributeSet attr)
Instructs the parse buffer to create a block element with the given attributes. |
void |
flush()
This is the last method called on the HTMLReader, allowing any pending changes to be flushed to the HTMLDocument. |
void |
handleComment(char[] data,
int pos)
This method called by parser to handle a comment block. |
void |
handleEndOfLineString(String eol)
This is invoked after the stream has been parsed but before it has been flushed. |
void |
handleEndTag(HTML.Tag t,
int pos)
This method is called by the parser and should route the call to the proper handler for the tag. |
void |
handleSimpleTag(HTML.Tag t,
MutableAttributeSet a,
int pos)
This is a callback from the parser that should be routed to the appropriate handler for the tag. |
void |
handleStartTag(HTML.Tag t,
MutableAttributeSet a,
int pos)
This method is called by the parser and should route the call to the proper handler for the tag. |
void |
handleText(char[] data,
int pos)
This method is called by the parser to indicate a block of text was encountered. |
protected void |
popCharacterStyle()
Pops a character style off of the stack and uses it as the current character style. |
protected void |
preContent(char[] data)
Adds the given text that was encountered in a element. |
protected void |
pushCharacterStyle()
Pushes the current character style onto the stack. |
protected void |
registerTag(HTML.Tag t,
HTMLDocument.HTMLReader.TagAction a)
Registers a given tag with a given Action. |
protected void |
textAreaContent(char[] data)
Adds the given text to the textarea document. |
Methods inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback |
---|
handleError |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected MutableAttributeSet charAttr
protected Vector<DefaultStyledDocument.ElementSpec> parseBuffer
Constructor Detail |
---|
public HTMLDocument.HTMLReader(int offset)
public HTMLDocument.HTMLReader(int offset, int popDepth, int pushDepth, HTML.Tag insertTag)
Method Detail |
---|
protected void pushCharacterStyle()
protected void popCharacterStyle()
protected void registerTag(HTML.Tag t, HTMLDocument.HTMLReader.TagAction a)
t
- the Tag to registera
- the Action for the Tagpublic void flush() throws BadLocationException
flush
in class HTMLEditorKit.ParserCallback
BadLocationException
public void handleText(char[] data, int pos)
handleText
in class HTMLEditorKit.ParserCallback
data
- the text that was insertedpos
- the position at which the text was insertedpublic void handleStartTag(HTML.Tag t, MutableAttributeSet a, int pos)
handleStartTag
in class HTMLEditorKit.ParserCallback
t
- the HTML.Taga
- the attribute setpos
- the position at which the tag was encounteredpublic void handleComment(char[] data, int pos)
handleComment
in class HTMLEditorKit.ParserCallback
data
- the commentpos
- the position at which the comment was encounteredpublic void handleEndTag(HTML.Tag t, int pos)
handleEndTag
in class HTMLEditorKit.ParserCallback
t
- the HTML.Tagpos
- the position at which the tag was encounteredpublic void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pos)
handleSimpleTag
in class HTMLEditorKit.ParserCallback
t
- the HTML.Tag that was encountereda
- the attribute setpos
- the position at which the tag was encounteredpublic void handleEndOfLineString(String eol)
handleEndOfLineString
in class HTMLEditorKit.ParserCallback
eol
- one of \n, \r, or \r\n, whichever was encountered the most in
parsing the streamprotected void textAreaContent(char[] data)
data
- the text to add to the textareaprotected void preContent(char[] data)
element. This adds synthesized lines to hold the text runs.
data
- the textprotected void blockOpen(HTML.Tag t, MutableAttributeSet attr)
t
- the tag that requires opening a new blockattr
- the attribute set for the new blockprotected void blockClose(HTML.Tag t)
t
- the HTML.Tag that is closing its blockprotected void addContent(char[] data, int offs, int length)
data
- the text to addoffs
- the offset at which to add itlength
- the length of the text to addprotected void addContent(char[] data, int offs, int length, boolean generateImpliedPIfNecessary)
data
- the text to addoffs
- the offset at which to add itlength
- the length of the text to addgenerateImpliedPIfNecessary
- whether or not we should generate
an HTML.Tag.IMPLIED tag if necessaryprotected void addSpecialElement(HTML.Tag t, MutableAttributeSet a)
t
- the HTML.Taga
- the attribute set specifying the special content
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |