javax.swing.text.html
Class MinimalHTMLWriter

java.lang.Object
  extended by javax.swing.text.AbstractWriter
      extended by javax.swing.text.html.MinimalHTMLWriter

public class MinimalHTMLWriter
extends AbstractWriter

MinimalHTMLWriter, A minimal AbstractWriter implementation for HTML.


Field Summary
 
Fields inherited from class javax.swing.text.AbstractWriter
NEWLINE
 
Constructor Summary
MinimalHTMLWriter(Writer w, StyledDocument doc)
          Constructs a MinimalHTMLWriter.
MinimalHTMLWriter(Writer w, StyledDocument doc, int pos, int len)
          Constructs a MinimalHTMLWriter.
 
Method Summary
protected  void endFontTag()
          Ends a span tag.
protected  boolean inFontTag()
          Returns whether the writer is within two span tags.
protected  boolean isText(Element elem)
          Returns whether the element contains text or not.
protected  void startFontTag(String style)
          Starts a span tag.
protected  void text(Element elem)
          Output the text of the indicated Element, properly clipping it to the range of the Document specified when the AbstractWriter was created.
 void write()
          Write the entire HTML document.
protected  void writeAttributes(AttributeSet attr)
          Write a set of attributes.
protected  void writeBody()
          Writes the body of the HTML document.
protected  void writeComponent(Element elem)
          Deliberately unimplemented, handles component elements.
protected  void writeContent(Element elem, boolean needsIndenting)
          Writes the content of an element.
protected  void writeEndParagraph()
          Write a paragraph end tag, closes any other open tags.
protected  void writeEndTag(String endTag)
          Write an ending tag and decrement the indent.
protected  void writeHeader()
          Write the HTML header.
protected  void writeHTMLTags(AttributeSet attr)
          Write bold, indent and underline tags.
protected  void writeImage(Element elem)
          Deliberately unimplemented.
protected  void writeLeaf(Element e)
          Writes a non-text leaf element.
protected  void writeNonHTMLAttributes(AttributeSet attr)
          Write the HTML attributes which do not have tag equivalents, e.g. attributes other than bold/italic/underlined.
protected  void writeStartParagraph(Element elem)
          Write a paragraph start tag.
protected  void writeStartTag(String tag)
          Write a start tag and increment the indent.
protected  void writeStyles()
          Write the styles used.
 
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, output, setCanWrapLines, setCurrentLineLength, setIndentSpace, setLineLength, setLineSeparator, write, write, write, writeLineSeparator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MinimalHTMLWriter

public MinimalHTMLWriter(Writer w,
                         StyledDocument doc)
Constructs a MinimalHTMLWriter.

Parameters:
w - - a Writer, for output.
doc - - the document

MinimalHTMLWriter

public MinimalHTMLWriter(Writer w,
                         StyledDocument doc,
                         int pos,
                         int len)
Constructs a MinimalHTMLWriter.

Parameters:
w - - a Writer, for output.
doc - - the document
pos - - start position
len - - length
Method Detail

startFontTag

protected void startFontTag(String style)
                     throws IOException
Starts a span tag.

Throws:
IOException

inFontTag

protected boolean inFontTag()
Returns whether the writer is within two span tags.


endFontTag

protected void endFontTag()
                   throws IOException
Ends a span tag.

Throws:
IOException

write

public void write()
           throws IOException,
                  BadLocationException
Write the entire HTML document.

Specified by:
write in class AbstractWriter
Throws:
IOException
BadLocationException

writeStartTag

protected void writeStartTag(String tag)
                      throws IOException
Write a start tag and increment the indent.

Throws:
IOException

writeEndTag

protected void writeEndTag(String endTag)
                    throws IOException
Write an ending tag and decrement the indent.

Throws:
IOException

writeHeader

protected void writeHeader()
                    throws IOException
Write the HTML header.

Throws:
IOException

writeStartParagraph

protected void writeStartParagraph(Element elem)
                            throws IOException
Write a paragraph start tag.

Throws:
IOException

writeEndParagraph

protected void writeEndParagraph()
                          throws IOException
Write a paragraph end tag, closes any other open tags.

Throws:
IOException

writeBody

protected void writeBody()
                  throws IOException,
                         BadLocationException
Writes the body of the HTML document.

Throws:
IOException
BadLocationException

text

protected void text(Element elem)
             throws IOException,
                    BadLocationException
Description copied from class: AbstractWriter
Output the text of the indicated Element, properly clipping it to the range of the Document specified when the AbstractWriter was created.

Overrides:
text in class AbstractWriter
Throws:
IOException
BadLocationException

writeHTMLTags

protected void writeHTMLTags(AttributeSet attr)
                      throws IOException
Write bold, indent and underline tags.

Throws:
IOException

isText

protected boolean isText(Element elem)
Returns whether the element contains text or not.


writeContent

protected void writeContent(Element elem,
                            boolean needsIndenting)
                     throws IOException,
                            BadLocationException
Writes the content of an element.

Throws:
IOException
BadLocationException

writeLeaf

protected void writeLeaf(Element e)
                  throws IOException
Writes a non-text leaf element.

Throws:
IOException

writeNonHTMLAttributes

protected void writeNonHTMLAttributes(AttributeSet attr)
                               throws IOException
Write the HTML attributes which do not have tag equivalents, e.g. attributes other than bold/italic/underlined.

Throws:
IOException

writeStyles

protected void writeStyles()
                    throws IOException
Write the styles used.

Throws:
IOException

writeAttributes

protected void writeAttributes(AttributeSet attr)
                        throws IOException
Write a set of attributes.

Overrides:
writeAttributes in class AbstractWriter
Throws:
IOException

writeComponent

protected void writeComponent(Element elem)
                       throws IOException
Deliberately unimplemented, handles component elements.

Throws:
IOException

writeImage

protected void writeImage(Element elem)
                   throws IOException
Deliberately unimplemented. Writes StyleConstants.IconElementName elements.

Throws:
IOException