org.jfree.report.modules.parser.extwriter
Class AbstractXMLDefinitionWriter

java.lang.Object
  extended byorg.jfree.xml.writer.XMLWriterSupport
      extended byorg.jfree.report.modules.parser.extwriter.AbstractXMLDefinitionWriter
Direct Known Subclasses:
FunctionsWriter, ObjectWriter, ParserConfigWriter, ReportConfigWriter, ReportDefinitionWriter, ReportDescriptionWriter, StylesWriter, StyleWriter, TemplatesWriter

public abstract class AbstractXMLDefinitionWriter
extends org.jfree.xml.writer.XMLWriterSupport

A base class for writer classes for the JFreeReport XML report files.

Author:
Thomas Morgner

Field Summary
 
Fields inherited from class org.jfree.xml.writer.XMLWriterSupport
CLOSE, CLOSE_TAG_DECREASE, INDENT_ONLY, OPEN, OPEN_TAG_INCREASE
 
Constructor Summary
AbstractXMLDefinitionWriter(ReportWriter reportWriter, int indentLevel)
          Creates a new writer.
 
Method Summary
static org.jfree.xml.writer.SafeTagList getDefaultSafeTags()
          Returns the tags that can safely extend over several lines in the XML definition.
protected  JFreeReport getReport()
          Returns the report.
protected  ReportWriter getReportWriter()
          Returns the report writer.
static java.lang.String normalize(java.lang.String s)
          Normalises a string, replacing certain characters with their escape sequences so that the XML text is not corrupted.
abstract  void write(java.io.Writer writer)
          Writes the report definition portion.
protected  void writeComment(java.io.Writer writer, CommentHintPath path, java.lang.String hintName)
          Reads a comment from the given comment hint path and hint name and Writes that comment to the xml stream.
protected  void writeComment(java.io.Writer writer, java.lang.String comment)
          Writes the given comment.
 
Methods inherited from class org.jfree.xml.writer.XMLWriterSupport
allowLineBreak, decreaseIndent, endBlock, getIndentLevel, getLineSeparator, getSafeTags, increaseIndent, indent, startBlock, writeCloseTag, writeTag, writeTag, writeTag, writeTag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractXMLDefinitionWriter

public AbstractXMLDefinitionWriter(ReportWriter reportWriter,
                                   int indentLevel)
Creates a new writer.

Parameters:
reportWriter - the report writer.
indentLevel - the current indention level.
Method Detail

getDefaultSafeTags

public static org.jfree.xml.writer.SafeTagList getDefaultSafeTags()
Returns the tags that can safely extend over several lines in the XML definition.

Returns:
The safe tags.

getReportWriter

protected ReportWriter getReportWriter()
Returns the report writer.

Returns:
The report writer.

getReport

protected JFreeReport getReport()
Returns the report.

Returns:
The report.

normalize

public static java.lang.String normalize(java.lang.String s)
Normalises a string, replacing certain characters with their escape sequences so that the XML text is not corrupted.

Parameters:
s - the string.
Returns:
The normalised string.

writeComment

protected void writeComment(java.io.Writer writer,
                            java.lang.String comment)
                     throws java.io.IOException
Writes the given comment. This method does nothing if the comment is null.

Parameters:
writer - the writer that should receive the content.
comment - the xml comment that should be written.
Throws:
java.io.IOException - if an error occurs.

writeComment

protected void writeComment(java.io.Writer writer,
                            CommentHintPath path,
                            java.lang.String hintName)
                     throws java.io.IOException
Reads a comment from the given comment hint path and hint name and Writes that comment to the xml stream. This method does nothing if there is no comment stored at that position.

Parameters:
writer - the writer that should receive the content
path - the comment hint path that points to the comment
hintName - the hint name used to store the comment
Throws:
java.io.IOException - if an error occured.

write

public abstract void write(java.io.Writer writer)
                    throws java.io.IOException,
                           ReportWriterException
Writes the report definition portion. Every DefinitionWriter handles one or more elements of the JFreeReport object tree, DefinitionWriter traverse the object tree and write the known objects or forward objects to other definition writers.

Parameters:
writer - the writer.
Throws:
java.io.IOException - if there is an I/O problem.
ReportWriterException - if the report serialisation failed.