Class HTMLWriter
java.lang.Object
javax.swing.text.AbstractWriter
javax.swing.text.html.HTMLWriter
This is a writer for HTMLDocuments.
- 
Field SummaryFields declared in class javax.swing.text.AbstractWriterNEWLINE
- 
Constructor SummaryConstructorsConstructorDescriptionHTMLWriter(Writer w, HTMLDocument doc) Creates a new HTMLWriter.HTMLWriter(Writer w, HTMLDocument doc, int pos, int len) Creates a new HTMLWriter.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidSearches the attribute set and for each tag that is stored in the tag vector.protected voidWrites out comments.protected voidWrites out all empty elements (all tags that have no corresponding end tag).protected voidWrites out an end tag for the element.protected booleanisBlockTag(AttributeSet attr) Determines if the HTML.Tag associated with the element is a block tag.protected booleanmatchNameAttribute(AttributeSet attr, HTML.Tag tag) Returns true if the StyleConstants.NameAttribute is equal to the tag that is passed in as a parameter.protected voidoutput(char[] chars, int start, int length) This method is overridden to map any character entities, such as < to <.protected voidselectContent(AttributeSet attr) Writes out the content of the SELECT form element.protected voidWrites out a start tag for the element.protected booleansynthesizedElement(Element elem) Returnstrueif the element is a synthesized element.protected voidWrites out text.protected voidtextAreaContent(AttributeSet attr) Writes out text that is contained in a TEXTAREA form element.voidwrite()Iterates over the Element tree and controls the writing out of all the tags and its attributes.protected voidwriteAttributes(AttributeSet attr) Writes out the attribute set.protected voidSearches for embedded tags in the AttributeSet and writes them out.protected voidWrites the line separator.protected voidwriteOption(Option option) Writes out the content of the Option form element.Methods declared in class javax.swing.text.AbstractWriterdecrIndent, getCanWrapLines, getCurrentLineLength, getDocument, getElementIterator, getEndOffset, getIndentLevel, getIndentSpace, getLineLength, getLineSeparator, getStartOffset, getText, getWriter, incrIndent, indent, inRange, isLineEmpty, setCanWrapLines, setCurrentLineLength, setIndentSpace, setLineLength, setLineSeparator, write, write, write
- 
Constructor Details- 
HTMLWriterCreates a new HTMLWriter.- Parameters:
- w- a Writer
- doc- an HTMLDocument
 
- 
HTMLWriterCreates a new HTMLWriter.- Parameters:
- w- a Writer
- doc- an HTMLDocument
- pos- the document location from which to fetch the content
- len- the amount to write out
 
 
- 
- 
Method Details- 
writeIterates over the Element tree and controls the writing out of all the tags and its attributes.- Specified by:
- writein class- AbstractWriter
- Throws:
- IOException- on any I/O error
- BadLocationException- if pos represents an invalid location within the document.
 
- 
writeAttributesWrites out the attribute set. Ignores all attributes with a key of type HTML.Tag, attributes with a key of type StyleConstants, and attributes with a key of type HTML.Attribute.ENDTAG.- Overrides:
- writeAttributesin class- AbstractWriter
- Parameters:
- attr- an AttributeSet
- Throws:
- IOException- on any I/O error
 
- 
emptyTagWrites out all empty elements (all tags that have no corresponding end tag).- Parameters:
- elem- an Element
- Throws:
- IOException- on any I/O error
- BadLocationException- if pos represents an invalid location within the document.
 
- 
isBlockTagDetermines if the HTML.Tag associated with the element is a block tag.- Parameters:
- attr- an AttributeSet
- Returns:
- true if tag is block tag, false otherwise.
 
- 
startTagWrites out a start tag for the element. Ignores all synthesized elements.- Parameters:
- elem- an Element
- Throws:
- IOException- on any I/O error
- BadLocationException- if pos represents an invalid location within the document.
 
- 
textAreaContentWrites out text that is contained in a TEXTAREA form element.- Parameters:
- attr- an AttributeSet
- Throws:
- IOException- on any I/O error
- BadLocationException- if pos represents an invalid location within the document.
 
- 
textWrites out text. If a range is specified when the constructor is invoked, then only the appropriate range of text is written out.- Overrides:
- textin class- AbstractWriter
- Parameters:
- elem- an Element
- Throws:
- IOException- on any I/O error
- BadLocationException- if pos represents an invalid location within the document.
 
- 
selectContentWrites out the content of the SELECT form element.- Parameters:
- attr- the AttributeSet associated with the form element
- Throws:
- IOException- on any I/O error
 
- 
writeOptionWrites out the content of the Option form element.- Parameters:
- option- an Option
- Throws:
- IOException- on any I/O error
 
- 
endTagWrites out an end tag for the element.- Parameters:
- elem- an Element
- Throws:
- IOException- on any I/O error
 
- 
commentWrites out comments.- Parameters:
- elem- an Element
- Throws:
- IOException- on any I/O error
- BadLocationException- if pos represents an invalid location within the document.
 
- 
synthesizedElementReturnstrueif the element is a synthesized element. Currently we are only testing for the p-implied tag.- Parameters:
- elem- an element
- Returns:
- trueif the element is a synthesized element.
 
- 
matchNameAttributeReturns true if the StyleConstants.NameAttribute is equal to the tag that is passed in as a parameter.- Parameters:
- attr- a set of attributes
- tag- an HTML tag
- Returns:
- trueif the StyleConstants.NameAttribute is equal to the tag that is passed in as a parameter.
 
- 
writeEmbeddedTagsSearches for embedded tags in the AttributeSet and writes them out. It also stores these tags in a vector so that when appropriate the corresponding end tags can be written out.- Parameters:
- attr- a set of attributes
- Throws:
- IOException- on any I/O error
 
- 
closeOutUnwantedEmbeddedTagsSearches the attribute set and for each tag that is stored in the tag vector. If the tag is not found, then the tag is removed from the vector and a corresponding end tag is written out.- Parameters:
- attr- a set of attributes
- Throws:
- IOException- on any I/O error
 
- 
writeLineSeparatorWrites the line separator. This is overridden to make sure we don't replace the newline content in case it is outside normal ascii.- Overrides:
- writeLineSeparatorin class- AbstractWriter
- Throws:
- IOException- on any I/O error
- Since:
- 1.3
 
- 
outputThis method is overridden to map any character entities, such as < to <.super.outputwill be invoked to write the content.- Overrides:
- outputin class- AbstractWriter
- Parameters:
- chars- characters to output
- start- starting index
- length- length of output
- Throws:
- IOException- on any I/O error
- Since:
- 1.3
 
 
-