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

java.lang.Object
  |
  +--org.jfree.xml.writer.XMLWriterSupport
        |
        +--org.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
static java.lang.String BAND_TAG
          The 'band' tag.
static java.lang.String BASIC_KEY_TAG
          The 'basic-key' tag name.
static java.lang.String BASIC_OBJECT_TAG
          The text for the 'basic-object' tag.
static java.lang.String BOTTOMMARGIN_ATT
          Literal text for an XML attribute.
static java.lang.String CLASS_ATTRIBUTE
          The class attribute name.
static java.lang.String COMPOUND_KEY_TAG
          The 'compound-key' tag name.
static java.lang.String COMPOUND_OBJECT_TAG
          The text for the 'compound-object' tag.
static java.lang.String CONFIGURATION_TAG
          The 'configuration' tag name.
static java.lang.String DATADEFINITION_FACTORY_TAG
          The 'datadefinition-factory' tag name.
static java.lang.String DATAFACTORY_TAG
          The 'default page format' tag name.
static java.lang.String DATASOURCE_FACTORY_HINT
          A constant defining a datasource factory parser hint.
static java.lang.String DATASOURCE_FACTORY_TAG
          The 'datasource-factory' tag name.
static java.lang.String DATASOURCE_TAG
          The datasource tag name.
static java.lang.String ELEMENT_FACTORY_HINT
          A constant defining a element factory parser hint.
static java.lang.String ELEMENT_FACTORY_TAG
          The 'element-factory' tag name.
static java.lang.String ELEMENT_TAG
          The 'element' tag.
static java.lang.String EXPRESSION_TAG
          The name of the expression tag.
static java.lang.String EXTENDS_TAG
          The 'extends' tag name.
static java.lang.String FIELD_TAG
          The 'field' tag name.
static java.lang.String FIELDS_TAG
          The 'fields' tag name.
static java.lang.String FUNCTION_TAG
          The name of the function tag.
static java.lang.String FUNCTIONS_TAG
          The functions tag name.
static java.lang.String GROUP_FOOTER_TAG
          The 'group-footer' tag name.
static java.lang.String GROUP_HEADER_TAG
          The 'group-header' tag name.
static java.lang.String GROUP_TAG
          The 'group' tag name.
static java.lang.String GROUPS_TAG
          The 'groups' tag name.
static java.lang.String HEIGHT_ATT
          Literal text for an XML attribute.
static java.lang.String ITEMBAND_TAG
          The 'itemband' tag name.
static java.lang.String LEFTMARGIN_ATT
          Literal text for an XML attribute.
static java.lang.String NAME_ATTR
          The 'name' attribute text.
static java.lang.String OBJECT_FACTORY_HINT
          A constant defining an object factory parser hint.
static java.lang.String OBJECT_FACTORY_TAG
          The 'object-factory' tag name.
static java.lang.String ORIENTATION_ATT
          Literal text for an XML attribute.
static java.lang.String ORIENTATION_LANDSCAPE_VAL
          Literal text for an XML attribute.
static java.lang.String ORIENTATION_PORTRAIT_VAL
          Literal text for an XML attribute.
static java.lang.String ORIENTATION_REVERSE_LANDSCAPE_VAL
          Literal text for an XML attribute.
static java.lang.String OUTPUT_TARGET_TAG
          The 'output-config' tag name.
protected static java.lang.String PAGE_DEFINITION_TAG
           
static java.lang.String PAGE_FOOTER_TAG
          The 'page-footer' tag name.
static java.lang.String PAGE_HEADER_TAG
          The 'page-header' tag name.
protected static java.lang.String PAGE_TAG
           
static java.lang.String PAGEFORMAT_ATT
          Literal text for an XML attribute.
static java.lang.String PARSER_CONFIG_TAG
          The parser config tag name.
static java.lang.String PROPERTIES_TAG
          The properties tag name.
static java.lang.String PROPERTY_REF_TAG
          The name of the 'property-ref' tag.
static java.lang.String PROPERTY_TAG
          The 'property' tag name.
static java.lang.String REPORT_CONFIG_TAG
          The report config tag name.
static java.lang.String REPORT_DEFINITION_TAG
          the document element tag for the extended report format.
static java.lang.String REPORT_DESCRIPTION_TAG
          The report description tag name.
static java.lang.String REPORT_FOOTER_TAG
          The 'report-footer' tag name.
static java.lang.String REPORT_HEADER_TAG
          The 'report-header' tag name.
static java.lang.String RIGHTMARGIN_ATT
          Literal text for an XML attribute.
protected static java.lang.String SIMPLE_PAGE_DEFINITION_TAG
           
static java.lang.String STYLE_TAG
          The 'style' tag name.
static java.lang.String STYLEKEY_FACTORY_HINT
          A constant defining a style key factory parser hint.
static java.lang.String STYLEKEY_FACTORY_TAG
          The 'stylekey-factory' tag name.
static java.lang.String STYLES_TAG
          The styles tag name.
static java.lang.String TEMPLATE_FACTORY_HINT
          A constant defining a template factory parser hint.
static java.lang.String TEMPLATE_FACTORY_TAG
          The 'template-factory' tag name.
static java.lang.String TEMPLATE_TAG
          The template tag.
static java.lang.String TEMPLATES_TAG
          The templates tag name.
static java.lang.String TOPMARGIN_ATT
          Literal text for an XML attribute.
static java.lang.String WATERMARK_TAG
          The 'watermark' tag name.
static java.lang.String WIDTH_ATT
          Literal text for an XML attribute.
 
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
 

Field Detail

REPORT_DEFINITION_TAG

public static final java.lang.String REPORT_DEFINITION_TAG
the document element tag for the extended report format.

PARSER_CONFIG_TAG

public static final java.lang.String PARSER_CONFIG_TAG
The parser config tag name.

REPORT_CONFIG_TAG

public static final java.lang.String REPORT_CONFIG_TAG
The report config tag name.

STYLES_TAG

public static final java.lang.String STYLES_TAG
The styles tag name.

TEMPLATES_TAG

public static final java.lang.String TEMPLATES_TAG
The templates tag name.

REPORT_DESCRIPTION_TAG

public static final java.lang.String REPORT_DESCRIPTION_TAG
The report description tag name.

FUNCTIONS_TAG

public static final java.lang.String FUNCTIONS_TAG
The functions tag name.

BAND_TAG

public static final java.lang.String BAND_TAG
The 'band' tag.

ELEMENT_TAG

public static final java.lang.String ELEMENT_TAG
The 'element' tag.

COMPOUND_OBJECT_TAG

public static final java.lang.String COMPOUND_OBJECT_TAG
The text for the 'compound-object' tag.

BASIC_OBJECT_TAG

public static final java.lang.String BASIC_OBJECT_TAG
The text for the 'basic-object' tag.

DATASOURCE_TAG

public static final java.lang.String DATASOURCE_TAG
The datasource tag name.

PROPERTIES_TAG

public static final java.lang.String PROPERTIES_TAG
The properties tag name.

FUNCTION_TAG

public static final java.lang.String FUNCTION_TAG
The name of the function tag.

EXPRESSION_TAG

public static final java.lang.String EXPRESSION_TAG
The name of the expression tag.

PROPERTY_REF_TAG

public static final java.lang.String PROPERTY_REF_TAG
The name of the 'property-ref' tag.

FIELDS_TAG

public static final java.lang.String FIELDS_TAG
The 'fields' tag name.

FIELD_TAG

public static final java.lang.String FIELD_TAG
The 'field' tag name.

GROUP_HEADER_TAG

public static final java.lang.String GROUP_HEADER_TAG
The 'group-header' tag name.

GROUP_FOOTER_TAG

public static final java.lang.String GROUP_FOOTER_TAG
The 'group-footer' tag name.

GROUP_TAG

public static final java.lang.String GROUP_TAG
The 'group' tag name.

STYLEKEY_FACTORY_TAG

public static final java.lang.String STYLEKEY_FACTORY_TAG
The 'stylekey-factory' tag name.

TEMPLATE_FACTORY_TAG

public static final java.lang.String TEMPLATE_FACTORY_TAG
The 'template-factory' tag name.

OBJECT_FACTORY_TAG

public static final java.lang.String OBJECT_FACTORY_TAG
The 'object-factory' tag name.

DATADEFINITION_FACTORY_TAG

public static final java.lang.String DATADEFINITION_FACTORY_TAG
The 'datadefinition-factory' tag name.

DATASOURCE_FACTORY_TAG

public static final java.lang.String DATASOURCE_FACTORY_TAG
The 'datasource-factory' tag name.

ELEMENT_FACTORY_TAG

public static final java.lang.String ELEMENT_FACTORY_TAG
The 'element-factory' tag name.

CLASS_ATTRIBUTE

public static final java.lang.String CLASS_ATTRIBUTE
The class attribute name.

DATAFACTORY_TAG

public static final java.lang.String DATAFACTORY_TAG
The 'default page format' tag name.

CONFIGURATION_TAG

public static final java.lang.String CONFIGURATION_TAG
The 'configuration' tag name.

OUTPUT_TARGET_TAG

public static final java.lang.String OUTPUT_TARGET_TAG
The 'output-config' tag name.

PAGEFORMAT_ATT

public static final java.lang.String PAGEFORMAT_ATT
Literal text for an XML attribute.

LEFTMARGIN_ATT

public static final java.lang.String LEFTMARGIN_ATT
Literal text for an XML attribute.

RIGHTMARGIN_ATT

public static final java.lang.String RIGHTMARGIN_ATT
Literal text for an XML attribute.

TOPMARGIN_ATT

public static final java.lang.String TOPMARGIN_ATT
Literal text for an XML attribute.

BOTTOMMARGIN_ATT

public static final java.lang.String BOTTOMMARGIN_ATT
Literal text for an XML attribute.

WIDTH_ATT

public static final java.lang.String WIDTH_ATT
Literal text for an XML attribute.

HEIGHT_ATT

public static final java.lang.String HEIGHT_ATT
Literal text for an XML attribute.

ORIENTATION_ATT

public static final java.lang.String ORIENTATION_ATT
Literal text for an XML attribute.

ORIENTATION_PORTRAIT_VAL

public static final java.lang.String ORIENTATION_PORTRAIT_VAL
Literal text for an XML attribute.

ORIENTATION_LANDSCAPE_VAL

public static final java.lang.String ORIENTATION_LANDSCAPE_VAL
Literal text for an XML attribute.

ORIENTATION_REVERSE_LANDSCAPE_VAL

public static final java.lang.String ORIENTATION_REVERSE_LANDSCAPE_VAL
Literal text for an XML attribute.

STYLEKEY_FACTORY_HINT

public static final java.lang.String STYLEKEY_FACTORY_HINT
A constant defining a style key factory parser hint.

OBJECT_FACTORY_HINT

public static final java.lang.String OBJECT_FACTORY_HINT
A constant defining an object factory parser hint.

DATASOURCE_FACTORY_HINT

public static final java.lang.String DATASOURCE_FACTORY_HINT
A constant defining a datasource factory parser hint.

TEMPLATE_FACTORY_HINT

public static final java.lang.String TEMPLATE_FACTORY_HINT
A constant defining a template factory parser hint.

ELEMENT_FACTORY_HINT

public static final java.lang.String ELEMENT_FACTORY_HINT
A constant defining a element factory parser hint.

REPORT_HEADER_TAG

public static final java.lang.String REPORT_HEADER_TAG
The 'report-header' tag name.

REPORT_FOOTER_TAG

public static final java.lang.String REPORT_FOOTER_TAG
The 'report-footer' tag name.

PAGE_HEADER_TAG

public static final java.lang.String PAGE_HEADER_TAG
The 'page-header' tag name.

PAGE_FOOTER_TAG

public static final java.lang.String PAGE_FOOTER_TAG
The 'page-footer' tag name.

ITEMBAND_TAG

public static final java.lang.String ITEMBAND_TAG
The 'itemband' tag name.

GROUPS_TAG

public static final java.lang.String GROUPS_TAG
The 'groups' tag name.

WATERMARK_TAG

public static final java.lang.String WATERMARK_TAG
The 'watermark' tag name.

STYLE_TAG

public static final java.lang.String STYLE_TAG
The 'style' tag name.

COMPOUND_KEY_TAG

public static final java.lang.String COMPOUND_KEY_TAG
The 'compound-key' tag name.

BASIC_KEY_TAG

public static final java.lang.String BASIC_KEY_TAG
The 'basic-key' tag name.

EXTENDS_TAG

public static final java.lang.String EXTENDS_TAG
The 'extends' tag name.

TEMPLATE_TAG

public static final java.lang.String TEMPLATE_TAG
The template tag.

PROPERTY_TAG

public static final java.lang.String PROPERTY_TAG
The 'property' tag name.

NAME_ATTR

public static final java.lang.String NAME_ATTR
The 'name' attribute text.

PAGE_DEFINITION_TAG

protected static final java.lang.String PAGE_DEFINITION_TAG

SIMPLE_PAGE_DEFINITION_TAG

protected static final java.lang.String SIMPLE_PAGE_DEFINITION_TAG

PAGE_TAG

protected static final java.lang.String PAGE_TAG
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.