javax.swing.text.html

Class 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)
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
writeHTMLTags(AttributeSet attr)
Write bold, indent and underline tags.
protected void
writeHeader()
Write the HTML header.
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, inRange, incrIndent, indent, isLineEmpty, output, setCanWrapLines, setCurrentLineLength, setIndentSpace, setLineLength, setLineSeparator, text, write, write, write, write, writeAttributes, writeLineSeparator

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

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 Details

endFontTag

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

inFontTag

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

isText

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

startFontTag

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

text

protected void text(Element elem)
            throws IOException,
                   BadLocationException
Overrides:
text in interface AbstractWriter

write

public void write()
            throws IOException,
                   BadLocationException
Write the entire HTML document.
Overrides:
write in interface AbstractWriter

writeAttributes

protected void writeAttributes(AttributeSet attr)
            throws IOException
Write a set of attributes.
Overrides:
writeAttributes in interface AbstractWriter

writeBody

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

writeComponent

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

writeContent

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

writeEndParagraph

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

writeEndTag

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

writeHTMLTags

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

writeHeader

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

writeImage

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

writeLeaf

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

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.

writeStartParagraph

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

writeStartTag

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

writeStyles

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

MinimalHTMLWriter.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.