|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.text.AbstractWriter javax.swing.text.html.HTMLWriter
This is a writer for HTMLDocuments.
Field Summary | |
private Stack |
blockElementStack
|
private boolean |
completeDoc
|
private MutableAttributeSet |
convAttr
Buffer for the purpose of attribute conversion |
private boolean |
inContent
|
private boolean |
indentNext
Determines whether a the indentation needs to be incremented. |
private boolean |
inPre
|
private boolean |
inTextArea
|
private boolean |
newlineOutputed
|
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 |
tags
|
private Vector |
tagsToRemove
|
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. |
private boolean |
wroteHead
Set to true after the head has been output. |
Fields inherited from class javax.swing.text.AbstractWriter |
NEWLINE |
Constructor Summary | |
HTMLWriter(Writer w,
HTMLDocument doc)
Creates a new HTMLWriter. |
|
HTMLWriter(Writer w,
HTMLDocument doc,
int pos,
int len)
Creates a new HTMLWriter. |
Method Summary | |
protected void |
closeOutUnwantedEmbeddedTags(AttributeSet attr)
Searches the attribute set and for each tag that is stored in the tag vector. |
protected void |
comment(Element elem)
Writes out comments. |
(package private) 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 |
convertToHTML32(AttributeSet from,
MutableAttributeSet to)
Create an older style of HTML attributes. |
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.Attribute a,
AttributeSet from,
MutableAttributeSet to)
Create/update an HTML <font> tag attribute. |
protected void |
emptyTag(Element elem)
Writes out all empty elements (all tags that have no corresponding end tag). |
protected void |
endTag(Element elem)
Writes out an end tag for the element. |
private boolean |
indentNeedsIncrementing(Element current,
Element next)
|
protected boolean |
isBlockTag(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. |
protected boolean |
matchNameAttribute(AttributeSet attr,
HTML.Tag tag)
Returns true if the StyleConstants.NameAttribute is equal to the tag that is passed in as a parameter. |
private boolean |
noMatchForTagInAttributes(AttributeSet attr,
HTML.Tag t,
Object tagValue)
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)
This method is overriden to map any character entities, such as < to <. |
private void |
output(String string)
This directly invokes super's output after converting
string to a char[]. |
protected void |
selectContent(AttributeSet attr)
Writes out the content of the SELECT form element. |
protected void |
startTag(Element elem)
Writes out a start tag for the element. |
protected boolean |
synthesizedElement(Element elem)
Returns true if the element is a synthesized element. |
protected void |
text(Element elem)
Writes out text. |
protected void |
textAreaContent(AttributeSet attr)
Writes out text that is contained in a TEXTAREA form element. |
void |
write()
Iterates over the Element tree and controls the writing out of all the tags and its attributes. |
(package private) void |
writeAdditionalComments()
Writes out any additional comments (comments outside of the body) stored under the property HTMLDocument.AdditionalComments. |
protected void |
writeAttributes(AttributeSet attr)
Writes out the attribute set. |
(package private) void |
writeComment(String string)
Writes out comment string. |
protected void |
writeEmbeddedTags(AttributeSet attr)
Searches for embedded tags in the AttributeSet and writes them out. |
protected void |
writeLineSeparator()
Writes the line separator. |
(package private) void |
writeMaps(Enumeration maps)
Outputs the maps as elements. |
protected void |
writeOption(Option option)
Writes out the content of the Option form element. |
(package private) boolean |
writeStyle(String name,
Style style,
boolean outputStyle)
Outputs the named style. |
(package private) void |
writeStyleEndTag()
|
(package private) void |
writeStyles(StyleSheet sheet)
Outputs the styles as a single element. |
(package private) void |
writeStyleStartTag()
|
Methods inherited from class javax.swing.text.AbstractWriter |
decrIndent, getCanWrapLines, getCurrentLineLength, getDocument, getElementIterator, getEndOffset, getIndentLevel, getIndentSpace, getLineLength, getLineSeparator, getStartOffset, getText, getWriter, incrIndent, indent, inRange, isLineEmpty, setCanWrapLines, setCurrentLineLength, setIndentSpace, setLineLength, setLineSeparator, write, write, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private Stack blockElementStack
private boolean inContent
private boolean inPre
private int preEndOffset
private boolean inTextArea
private boolean newlineOutputed
private boolean completeDoc
private Vector tags
private Vector tagValues
private Segment segment
private Vector tagsToRemove
private boolean wroteHead
private boolean replaceEntities
private char[] tempChars
private boolean indentNext
private boolean writeCSS
private MutableAttributeSet convAttr
private MutableAttributeSet oConvAttr
Constructor Detail |
public HTMLWriter(Writer w, HTMLDocument doc)
w
- a Writerdoc
- an HTMLDocumentpublic HTMLWriter(Writer w, HTMLDocument doc, int pos, int len)
w
- a Writerdoc
- an HTMLDocumentpos
- the document location from which to fetch the contentlen
- the amount to write outMethod Detail |
public void write() throws IOException, BadLocationException
write
in class AbstractWriter
IOException
- on any I/O error
BadLocationException
- if pos represents an invalid
location within the document.protected void writeAttributes(AttributeSet attr) throws IOException
writeAttributes
in class AbstractWriter
attr
- an AttributeSet
IOException
- on any I/O errorprotected void emptyTag(Element elem) throws BadLocationException, IOException
elem
- an Element
IOException
- on any I/O error
BadLocationException
- if pos represents an invalid
location within the document.protected boolean isBlockTag(AttributeSet attr)
attr
- an AttributeSet
protected void startTag(Element elem) throws IOException, BadLocationException
elem
- an Element
IOException
- on any I/O error
BadLocationException
protected void textAreaContent(AttributeSet attr) throws BadLocationException, IOException
attr
- an AttributeSet
IOException
- on any I/O error
BadLocationException
- if pos represents an invalid
location within the document.protected void text(Element elem) throws BadLocationException, IOException
text
in class AbstractWriter
elem
- an Element
IOException
- on any I/O error
BadLocationException
- if pos represents an invalid
location within the document.protected void selectContent(AttributeSet attr) throws IOException
attr
- the AttributeSet associated with the form element
IOException
- on any I/O errorprotected void writeOption(Option option) throws IOException
option
- an Option
IOException
- on any I/O errorprotected void endTag(Element elem) throws IOException
elem
- an Element
IOException
- on any I/O errorprotected void comment(Element elem) throws BadLocationException, IOException
elem
- an Element
IOException
- on any I/O error
BadLocationException
- if pos represents an invalid
location within the document.void writeComment(String string) throws IOException
string
- the comment
IOException
- on any I/O error
BadLocationException
- if pos represents an invalid
location within the document.void writeAdditionalComments() throws IOException
IOException
protected boolean synthesizedElement(Element elem)
protected boolean matchNameAttribute(AttributeSet attr, HTML.Tag tag)
protected void writeEmbeddedTags(AttributeSet attr) throws IOException
IOException
- on any I/O errorprivate boolean noMatchForTagInAttributes(AttributeSet attr, HTML.Tag t, Object tagValue)
protected void closeOutUnwantedEmbeddedTags(AttributeSet attr) throws IOException
IOException
- on any I/O errorprivate boolean isFormElementWithContent(AttributeSet attr)
private boolean indentNeedsIncrementing(Element current, Element next)
void writeMaps(Enumeration maps) throws IOException
IOException
void writeStyles(StyleSheet sheet) throws IOException
IOException
boolean writeStyle(String name, Style style, boolean outputStyle) throws IOException
outputStyle
indicates
whether or not a style has been output yet. This will return
true if a style is written.
IOException
void writeStyleStartTag() throws IOException
IOException
void writeStyleEndTag() throws IOException
IOException
AttributeSet convertToHTML(AttributeSet from, MutableAttributeSet to)
This will put the converted values into to
, unless
it is null in which case a temporary AttributeSet will be returned.
private static void convertToHTML32(AttributeSet from, MutableAttributeSet to)
private static void createFontAttribute(CSS.Attribute a, AttributeSet from, MutableAttributeSet to)
private static void convertToHTML40(AttributeSet from, MutableAttributeSet to)
protected void writeLineSeparator() throws IOException
writeLineSeparator
in class AbstractWriter
IOException
protected void output(char[] chars, int start, int length) throws IOException
super.output
will be invoked to
write the content.
output
in class AbstractWriter
IOException
private void output(String string) throws IOException
output
after converting
string
to a char[].
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |