| Modifier and Type | Field and Description |
|---|---|
| private Stack | |
| private boolean | |
| private MutableAttributeSet | convAttr
Buffer for the purpose of attribute conversion |
| private boolean | |
| private boolean | |
| private boolean | indentNext
Determines whether the indentation needs to be incremented. |
| private boolean | |
| private boolean | |
| private boolean | |
| private MutableAttributeSet | oConvAttr
Buffer for the purpose of attribute conversion. |
| private int | preEndOffset
When inPre is true, this will indicate the end offset of the pre element. |
| private boolean | replaceEntities
Set to true when entities (such as <) should be replaced. |
| private Segment | segment
Used when writing out content.
|
| private Vector | |
| private Vector | |
| private Vector | tagValues
Values for the tags. |
| private char[] | tempChars
Temporary buffer.
|
| private boolean | writeCSS
If true, the writer will emit CSS attributes in preference to HTML tags/attributes (i.e. It will emit an HTML 4.0 style). |
| private boolean | wroteHead
Set to true after the head has been output. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | HTMLWriter(Writer
a Writer w, HTMLDocument an HTMLDocument doc, int the document location from which to fetch the content pos, int the amount to write out len)Creates a new HTMLWriter. |
| Modifier and Type | Method and Description |
|---|---|
| private static void | addAttribute(MutableAttributeSet to, Object key, Object value)
Add an attribute only if it doesn't exist so that we don't loose information replacing it with SimpleAttributeSet.EMPTY |
| protected void | closeOutUnwantedEmbeddedTags(AttributeSet
a set of attributes attr)Searches the attribute set and for each tag that is stored in the tag vector. |
| protected void | |
| pack-priv AttributeSet | convertToHTML(AttributeSet from, MutableAttributeSet to)
Convert the give set of attributes to be html for the purpose of writing them out. |
| private static void | |
| private static void | convertToHTML40(AttributeSet from, MutableAttributeSet to)
Copies the given AttributeSet to a new set, converting any CSS attributes found to arguments of an HTML style attribute. |
| private static void | createFontAttribute(CSS.
Create/update an HTML <font> tag attribute. |
| protected void | |
| protected void | |
| private boolean | |
| private void | |
| protected boolean | Returns: true if tag is block tag, false otherwise.an AttributeSet attr)Determines if the HTML.Tag associated with the element is a block tag. |
| private boolean | isFormElementWithContent(AttributeSet attr)
Determines if the element associated with the attributeset is a TEXTAREA or SELECT. |
| private boolean | isPreTagWithParagraphTag(AttributeSet attr)
Determines if the element associated with the attributeset is a P tag and it is within Pre tag. |
| protected boolean | Returns: true if the StyleConstants.NameAttribute is equal to the tag that is passed in as a parameter.a set of attributes attr, HTML.an HTML tag tagReturns true if the StyleConstants.NameAttribute is equal to the tag that is passed in as a parameter. |
| private boolean | noMatchForTagInAttributes(AttributeSet attr, HTML.
Searches the attribute set for a tag, both of which are passed in as a parameter. |
| protected void | output(char[] chars, int start, int length)
Overrides javax. This method is overridden to map any character entities, such as < to <. |
| private void | |
| protected void | selectContent(AttributeSet
the AttributeSet associated with the form element attr)Writes out the content of the SELECT form element. |
| protected void | |
| protected boolean | Returns: true if the element is a synthesized element.an element elem)Returns |
| protected void | |
| protected void | textAreaContent(AttributeSet
an AttributeSet attr)Writes out text that is contained in a TEXTAREA form element. |
| public void | write()
Implements abstract javax. Iterates over the Element tree and controls the writing out of all the tags and its attributes. |
| pack-priv void | writeAdditionalComments()
Writes out any additional comments (comments outside of the body) stored under the property HTMLDocument.AdditionalComments. |
| protected void | writeAttributes(AttributeSet
an AttributeSet attr)Overrides javax. Writes out the attribute set. |
| pack-priv void | |
| protected void | writeEmbeddedTags(AttributeSet
a set of attributes attr)Searches for embedded tags in the AttributeSet and writes them out. |
| protected void | writeLineSeparator()
Overrides javax. Writes the line separator. |
| pack-priv void | |
| protected void | |
| pack-priv boolean | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void |
| blockElementStack | back to summary |
|---|---|
| private Stack<Element> blockElementStack | |
| completeDoc | back to summary |
|---|---|
| private boolean completeDoc | |
| convAttr | back to summary |
|---|---|
| private MutableAttributeSet convAttr Buffer for the purpose of attribute conversion | |
| inContent | back to summary |
|---|---|
| private boolean inContent | |
| indented | back to summary |
|---|---|
| private boolean indented | |
| indentNext | back to summary |
|---|---|
| private boolean indentNext Determines whether the indentation needs to be incremented. Basically, if next is a child of current, and next is NOT a synthesized element, the indent level will be incremented. If there is a parent-child relationship and "next" is a synthesized element, then its children must be indented. This state is maintained by the indentNext boolean. | |
| inPre | back to summary |
|---|---|
| private boolean inPre | |
| inTextArea | back to summary |
|---|---|
| private boolean inTextArea | |
| newlineOutputed | back to summary |
|---|---|
| private boolean newlineOutputed | |
| oConvAttr | back to summary |
|---|---|
| private MutableAttributeSet oConvAttr Buffer for the purpose of attribute conversion. This can be used if convAttr is being used. | |
| preEndOffset | back to summary |
|---|---|
| private int preEndOffset When inPre is true, this will indicate the end offset of the pre element. | |
| replaceEntities | back to summary |
|---|---|
| private boolean replaceEntities Set to true when entities (such as <) should be replaced. | |
| segment | back to summary |
|---|---|
| private Segment segment Hides javax. Used when writing out content. | |
| tags | back to summary |
|---|---|
| private Vector<HTML. | |
| tagsToRemove | back to summary |
|---|---|
| private Vector<HTML. | |
| tagValues | back to summary |
|---|---|
| private Vector<Object> tagValues Values for the tags. | |
| tempChars | back to summary |
|---|---|
| private char[] tempChars Hides javax. Temporary buffer. | |
| writeCSS | back to summary |
|---|---|
| private boolean writeCSS If true, the writer will emit CSS attributes in preference to HTML tags/attributes (i.e. It will emit an HTML 4.0 style). | |
| wroteHead | back to summary |
|---|---|
| private boolean wroteHead Set to true after the head has been output. | |
| HTMLWriter | back to summary |
|---|---|
| public HTMLWriter(Writer w, HTMLDocument doc) Creates a new HTMLWriter.
| |
| HTMLWriter | back to summary |
|---|---|
| public HTMLWriter(Writer w, HTMLDocument doc, int pos, int len) Creates a new HTMLWriter.
| |
| addAttribute | back to summary |
|---|---|
| private static void addAttribute(MutableAttributeSet to, Object key, Object value) Add an attribute only if it doesn't exist so that we don't loose information replacing it with SimpleAttributeSet.EMPTY | |
| closeOutUnwantedEmbeddedTags | back to summary |
|---|---|
| protected void closeOutUnwantedEmbeddedTags(AttributeSet attr) throws IOException Searches 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.
| |
| comment | back to summary |
|---|---|
| protected void comment(Element elem) throws BadLocationException, IOException Writes out comments.
| |
| convertToHTML | back to summary |
|---|---|
| pack-priv AttributeSet convertToHTML(AttributeSet from, MutableAttributeSet to) Convert the give set of attributes to be html for the purpose of writing them out. Any keys that have been converted will not appear in the resultant set. Any keys not converted will appear in the resultant set the same as the received set.
This will put the converted values into | |
| convertToHTML32 | back to summary |
|---|---|
| private static void convertToHTML32(AttributeSet from, MutableAttributeSet to) Create an older style of HTML attributes. This will convert character level attributes that have a StyleConstants mapping over to an HTML tag/attribute. Other CSS attributes will be placed in an HTML style attribute. | |
| convertToHTML40 | back to summary |
|---|---|
| private static void convertToHTML40(AttributeSet from, MutableAttributeSet to) Copies the given AttributeSet to a new set, converting any CSS attributes found to arguments of an HTML style attribute. | |
| createFontAttribute | back to summary |
|---|---|
| private static void createFontAttribute(CSS. Create/update an HTML <font> tag attribute. The value of the attribute should be a MutableAttributeSet so that the attributes can be updated as they are discovered. | |
| emptyTag | back to summary |
|---|---|
| protected void emptyTag(Element elem) throws BadLocationException, IOException Writes out all empty elements (all tags that have no corresponding end tag).
| |
| endTag | back to summary |
|---|---|
| protected void endTag(Element elem) throws IOException Writes out an end tag for the element.
| |
| indentNeedsIncrementing | back to summary |
|---|---|
| private boolean indentNeedsIncrementing(Element current, Element next) | |
| indentSmart | back to summary |
|---|---|
| private void indentSmart() throws IOException Writes indent only once per line. | |
| isBlockTag | back to summary |
|---|---|
| protected boolean isBlockTag(AttributeSet attr) Determines if the HTML.Tag associated with the element is a block tag.
| |
| isFormElementWithContent | back to summary |
|---|---|
| private boolean isFormElementWithContent(AttributeSet attr) Determines if the element associated with the attributeset is a TEXTAREA or SELECT. If true, returns true else false | |
| isPreTagWithParagraphTag | back to summary |
|---|---|
| private boolean isPreTagWithParagraphTag(AttributeSet attr) Determines if the element associated with the attributeset is a P tag and it is within Pre tag. If true, returns true else false | |
| matchNameAttribute | back to summary |
|---|---|
| protected boolean matchNameAttribute(AttributeSet attr, HTML. Returns true if the StyleConstants.NameAttribute is equal to the tag that is passed in as a parameter.
| |
| noMatchForTagInAttributes | back to summary |
|---|---|
| private boolean noMatchForTagInAttributes(AttributeSet attr, HTML. Searches the attribute set for a tag, both of which are passed in as a parameter. Returns true if no match is found and false otherwise. | |
| output | back to summary |
|---|---|
| protected void output(char[] chars, int start, int length) throws IOException Overrides javax. This method is overridden to map any character entities, such as
< to <.
| |
| output | back to summary |
|---|---|
| private void output(String string) throws IOException This directly invokes super's | |
| selectContent | back to summary |
|---|---|
| protected void selectContent(AttributeSet attr) throws IOException Writes out the content of the SELECT form element.
| |
| startTag | back to summary |
|---|---|
| protected void startTag(Element elem) throws IOException, BadLocationException Writes out a start tag for the element. Ignores all synthesized elements.
| |
| synthesizedElement | back to summary |
|---|---|
| protected boolean synthesizedElement(Element elem) Returns
| |
| text | back to summary |
|---|---|
| protected void text(Element elem) throws BadLocationException, IOException Overrides javax. Writes out text. If a range is specified when the constructor is invoked, then only the appropriate range of text is written out.
| |
| textAreaContent | back to summary |
|---|---|
| protected void textAreaContent(AttributeSet attr) throws BadLocationException, IOException Writes out text that is contained in a TEXTAREA form element.
| |
| write | back to summary |
|---|---|
| public void write() throws IOException, BadLocationException Implements abstract javax. Iterates over the Element tree and controls the writing out of all the tags and its attributes.
| |
| writeAdditionalComments | back to summary |
|---|---|
| pack-priv void writeAdditionalComments() throws IOException Writes out any additional comments (comments outside of the body) stored under the property HTMLDocument.AdditionalComments. | |
| writeAttributes | back to summary |
|---|---|
| protected void writeAttributes(AttributeSet attr) throws IOException Overrides javax. Writes 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.
| |
| writeComment | back to summary |
|---|---|
| pack-priv void writeComment(String string) throws IOException Writes out comment string.
| |
| writeEmbeddedTags | back to summary |
|---|---|
| protected void writeEmbeddedTags(AttributeSet attr) throws IOException Searches 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.
| |
| writeLineSeparator | back to summary |
|---|---|
| protected void writeLineSeparator() throws IOException Overrides javax. Writes the line separator. This is overridden to make sure we don't replace the newline content in case it is outside normal ascii.
| |
| writeMaps | back to summary |
|---|---|
| pack-priv void writeMaps(Enumeration<?> maps) throws IOException Outputs the maps as elements. Maps are not stored as elements in the document, and as such this is used to output them. | |
| writeOption | back to summary |
|---|---|
| protected void writeOption(Option option) throws IOException Writes out the content of the Option form element.
| |
| writeStyle | back to summary |
|---|---|
| pack-priv boolean writeStyle(String name, Style style, boolean outputStyle) throws IOException Outputs the named style. | |
| writeStyleEndTag | back to summary |
|---|---|
| pack-priv void writeStyleEndTag() throws IOException | |
| writeStyles | back to summary |
|---|---|
| pack-priv void writeStyles(StyleSheet sheet) throws IOException Outputs the styles as a single element. Styles are not stored as elements, but part of the document. For the time being styles are written out as a comment, inside a style tag. | |
| writeStyleStartTag | back to summary |
|---|---|
| pack-priv void writeStyleStartTag() throws IOException | |