Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
javax.swing.text.html.HTMLEditorKit.ParserCallback
javax.swing.text.html.HTMLDocument.HTMLReader
public class HTMLDocument.HTMLReader
extends HTMLEditorKit.ParserCallback
Nested Class Summary | |
class | |
class | |
class |
|
class |
|
class |
|
class | |
class |
|
class |
|
class |
Field Summary | |
protected MutableAttributeSet |
|
protected Vector |
Fields inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback | |
IMPLIED |
Constructor Summary | |
| |
|
Method Summary | |
protected void |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
Methods inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback | |
flush , handleComment , handleEndOfLineString , handleEndTag , handleError , handleSimpleTag , handleStartTag , handleText |
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
protected void addContent(char[] data, int offs, int length)
Adds text to the appropriate context using the current character attribute set.
- Parameters:
data
- the text to addoffs
- the offset at which to add itlength
- the length of the text to add
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.
- Parameters:
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 necessary
protected void addSpecialElement(HTML.Tag t, MutableAttributeSet a)
Adds content that is specified in the attribute set.
- Parameters:
t
- the HTML.Taga
- the attribute set specifying the special content
protected void blockClose(HTML.Tag t)
Instructs the parse buffer to close the block element associated with the given HTML.Tag
- Parameters:
t
- the HTML.Tag that is closing its block
protected void blockOpen(HTML.Tag t, MutableAttributeSet attr)
Instructs the parse buffer to create a block element with the given attributes.
- Parameters:
t
- the tag that requires opening a new blockattr
- the attribute set for the new block
public void flush() throws BadLocationException
This is the last method called on the HTMLReader, allowing any pending changes to be flushed to the HTMLDocument.
- Overrides:
- flush in interface HTMLEditorKit.ParserCallback
public void handleComment(char[] data, int pos)
This method called by parser to handle a comment block.
- Overrides:
- handleComment in interface HTMLEditorKit.ParserCallback
- Parameters:
data
- the commentpos
- the position at which the comment was encountered
public void handleEndOfLineString(String eol)
This is invoked after the stream has been parsed but before it has been flushed.
- Overrides:
- handleEndOfLineString in interface HTMLEditorKit.ParserCallback
- Parameters:
eol
- one of \n, \r, or \r\n, whichever was encountered the most in parsing the stream
- Since:
- 1.3
public 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.
- Overrides:
- handleEndTag in interface HTMLEditorKit.ParserCallback
- Parameters:
t
- the HTML.Tagpos
- the position at which the tag was encountered
public 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.
- Overrides:
- handleSimpleTag in interface HTMLEditorKit.ParserCallback
- Parameters:
t
- the HTML.Tag that was encountereda
- the attribute setpos
- the position at which the tag was encountered
public 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.
- Overrides:
- handleStartTag in interface HTMLEditorKit.ParserCallback
- Parameters:
t
- the HTML.Taga
- the attribute setpos
- the position at which the tag was encountered
public void handleText(char[] data, int pos)
This method is called by the parser to indicate a block of text was encountered. Should insert the text appropriately.
- Overrides:
- handleText in interface HTMLEditorKit.ParserCallback
- Parameters:
data
- the text that was insertedpos
- the position at which the text was inserted
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 aelement. This adds synthesized lines to hold the text runs.
- Parameters:
data
- the text
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. All of the well-known tags are registered by default, but this method can change their behaviour or add support for custom or currently unsupported tags.
- Parameters:
t
- the Tag to registera
- the Action for the Tag
protected void textAreaContent(char[] data)
Adds the given text to the textarea document. Called only when we are within a textarea.
- Parameters:
data
- the text to add to the textarea