net.sf.jasperreports.engine.xml
Class JRXmlWriter

java.lang.Object
  extended by net.sf.jasperreports.engine.xml.JRXmlBaseWriter
      extended by net.sf.jasperreports.engine.xml.JRXmlWriter

public class JRXmlWriter
extends JRXmlBaseWriter

A writer that produces the JRXML representation of an in-memory report.

Version:
$Id: JRXmlWriter.java 5397 2012-05-21 01:10:02Z teodord $
Author:
Teodor Danciu (teodord@users.sourceforge.net), Minor enhancements by Barry Klawans (bklawans@users.sourceforge.net)

Field Summary
static XmlNamespace JASPERREPORTS_NAMESPACE
           
 
Fields inherited from class net.sf.jasperreports.engine.xml.JRXmlBaseWriter
writer
 
Constructor Summary
  JRXmlWriter(JasperReportsContext jasperReportsContext)
           
protected JRXmlWriter(JRReport report, java.lang.String encoding)
          Deprecated. To be removed.
 
Method Summary
protected  XmlNamespace getNamespace()
           
 java.io.Writer getUnderlyingWriter()
          Returns the underlying stream to which this writer outputs to.
 JRXmlWriteHelper getXmlWriteHelper()
          Returns the XML write helper used by this report writer.
protected  boolean toWriteConditionalStyles()
          Decides whether conditional styles are to be written.
 void write(JRReport report, java.io.OutputStream outputStream, java.lang.String encoding)
           
 java.lang.String write(JRReport report, java.lang.String encoding)
           
 void write(JRReport report, java.lang.String destFileName, java.lang.String encoding)
           
 void writeAreaChart(JRChart chart)
           
 void writeAxisFormat(JRFont axisLabelFont, java.awt.Color axisLabelColor, JRFont axisTickLabelFont, java.awt.Color axisTickLabelColor, java.lang.String axisTickLabelMask, java.lang.Boolean axisVerticalTickLabels, java.awt.Color axisLineColor)
          Writes out the axis format block for a chart axis.
 void writeAxisFormat(java.lang.String axisFormatElementName, JRFont axisLabelFont, java.awt.Color axisLabelColor, JRFont axisTickLabelFont, java.awt.Color axisTickLabelColor, java.lang.String axisTickLabelMask, java.lang.Boolean axisVerticalTickLabels, java.awt.Color axisLineColor)
          Writes out the axis format block for a chart axis.
 void writeBar3DChart(JRChart chart)
           
 void writeBar3DPlot(JRBar3DPlot plot)
           
 void writeBarChart(JRChart chart)
           
 void writeBreak(JRBreak breakElement)
           
 void writeBubbleChart(JRChart chart)
           
protected  void writeBucket(JRCrosstabBucket bucket)
           
 void writeCandlestickChart(JRChart chart)
           
 void writeCategoryAxisFormat(JRFont axisLabelFont, java.awt.Color axisLabelColor, JRFont axisTickLabelFont, java.awt.Color axisTickLabelColor, java.lang.String axisTickLabelMask, java.lang.Boolean axisVerticalTickLabels, java.lang.Double labelRotation, java.awt.Color axisLineColor)
          Writes out the category axis format block.
protected  void writeCellContents(JRCellContents contents)
           
 void writeChartTag(JRChart chart)
           
 void writeChildElements(JRElementGroup elementContainer)
          Writes the contents (child elements) of an element container.
 void writeComponentElement(JRComponentElement componentElement)
           
 void writeCrosstab(JRCrosstab crosstab)
           
protected  void writeCrosstabCell(JRCrosstabCell cell)
           
protected  void writeCrosstabColumnGroup(JRCrosstabColumnGroup group)
           
protected  void writeCrosstabMeasure(JRCrosstabMeasure measure)
           
protected  void writeCrosstabParameter(JRCrosstabParameter parameter)
           
protected  void writeCrosstabRowGroup(JRCrosstabRowGroup group)
           
 void writeDataRange(JRDataRange dataRange)
          Writes a data range block to the output stream.
 void writeDataset(JRDataset dataset)
           
protected  void writeDatasetContents(JRDataset dataset)
           
 void writeDatasetRun(JRDatasetRun datasetRun)
          Outputs the XML representation of a subdataset run object.
 void writeElementDataset(JRElementDataset dataset)
          Writes the JRXML representation of an element dataset.
 void writeElementDataset(JRElementDataset dataset, boolean skipIfEmpty)
          Writes the JRXML representation of an element dataset.
 void writeElementDataset(JRElementDataset dataset, ResetTypeEnum defaultResetType, boolean skipIfEmpty)
          Writes the JRXML representation of an element dataset.
 void writeElementGroup(JRElementGroup elementGroup)
           
 void writeEllipse(JREllipse ellipse)
           
 void writeFont(JRFont font)
           
 void writeFrame(JRFrame frame)
           
 void writeGanttChart(JRChart chart)
           
 void writeGenericElement(JRGenericElement element)
           
 void writeHighLowChart(JRChart chart)
           
 void writeHighLowDataset(JRHighLowDataset dataset)
           
 void writeHyperlink(java.lang.String tagName, JRHyperlink hyperlink)
           
 void writeHyperlink(java.lang.String tagName, XmlNamespace namespace, JRHyperlink hyperlink)
           
protected  void writeHyperlinkParameter(JRHyperlinkParameter parameter)
           
protected  void writeHyperlinkParameters(JRHyperlinkParameter[] parameters)
           
 void writeImage(JRImage image)
           
 void writeItemLabel(JRItemLabel itemLabel)
          Writes the description of how to display item labels in a category plot.
 void writeLine(JRLine line)
           
 void writeLineChart(JRChart chart)
           
 void writeMeterChart(JRChart chart)
          Writes the definition of a meter chart to the output stream.
 void writeMultiAxisChart(JRChart chart)
          Writes the definition of a multiple axis chart to the output stream.
 void writePie3DChart(JRChart chart)
           
 void writePieChart(JRChart chart)
           
 void writePieDataset(JRPieDataset dataset)
           
 void writeProperties(JRPropertiesHolder propertiesHolder)
           
protected  void writePropertyExpression(JRPropertyExpression propertyExpression)
           
 void writePropertyExpressions(JRPropertyExpression[] propertyExpressions)
           
 void writeRectangle(JRRectangle rectangle)
           
static void writeReport(JRReport report, java.io.OutputStream outputStream, java.lang.String encoding)
           
static java.lang.String writeReport(JRReport report, java.lang.String encoding)
           
static void writeReport(JRReport report, java.lang.String destFileName, java.lang.String encoding)
           
protected  void writeReport(JRReport report, java.lang.String encoding, java.io.Writer out)
           
protected  void writeReport(java.io.Writer out)
          Deprecated. Replaced by writeReport(JRReport, String, Writer).
 void writeScatterChart(JRChart chart)
           
protected  void writeSection(JRSection section)
           
 void writeStackedAreaChart(JRChart chart)
           
 void writeStackedBar3DChart(JRChart chart)
           
 void writeStackedBarChart(JRChart chart)
           
 void writeStaticText(JRStaticText staticText)
           
 void writeSubreport(JRSubreport subreport)
           
protected  void writeTemplate(JRReportTemplate template)
           
protected  void writeTemplates()
          Deprecated. Replaced by writeTemplates(JRReport).
protected  void writeTemplates(JRReport report)
           
 void writeTextField(JRTextField textField)
           
 void writeThermometerChart(JRChart chart)
          Writes the description of a thermometer chart to the output stream.
 void writeTimeSeriesChart(JRChart chart)
           
 void writeValueDataset(JRValueDataset dataset)
          Writes the description of a value dataset to the output stream.
 void writeValueDisplay(JRValueDisplay valueDisplay)
          Writes the description of how to display a value in a valueDataset.
 void writeXyAreaChart(JRChart chart)
           
 void writeXyBarChart(JRChart chart)
           
 void writeXyLineChart(JRChart chart)
           
 
Methods inherited from class net.sf.jasperreports.engine.xml.JRXmlBaseWriter
useWriter, writeBox, writeBox, writeConditionalStyle, writeParagraph, writeParagraph, writePen, writeStyle, writeStyleReferenceAttr, writeTabStop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JASPERREPORTS_NAMESPACE

public static final XmlNamespace JASPERREPORTS_NAMESPACE
Constructor Detail

JRXmlWriter

public JRXmlWriter(JasperReportsContext jasperReportsContext)

JRXmlWriter

protected JRXmlWriter(JRReport report,
                      java.lang.String encoding)
Deprecated. To be removed.

Method Detail

write

public java.lang.String write(JRReport report,
                              java.lang.String encoding)

write

public void write(JRReport report,
                  java.lang.String destFileName,
                  java.lang.String encoding)
           throws JRException
Throws:
JRException

write

public void write(JRReport report,
                  java.io.OutputStream outputStream,
                  java.lang.String encoding)
           throws JRException
Throws:
JRException

writeReport

public static java.lang.String writeReport(JRReport report,
                                           java.lang.String encoding)
See Also:
write(JRReport, String)

writeReport

public static void writeReport(JRReport report,
                               java.lang.String destFileName,
                               java.lang.String encoding)
                        throws JRException
Throws:
JRException
See Also:
write(JRReport, String, String)

writeReport

public static void writeReport(JRReport report,
                               java.io.OutputStream outputStream,
                               java.lang.String encoding)
                        throws JRException
Throws:
JRException
See Also:
write(JRReport, OutputStream, String)

writeReport

protected void writeReport(JRReport report,
                           java.lang.String encoding,
                           java.io.Writer out)
                    throws java.io.IOException
Throws:
java.io.IOException

writeReport

protected void writeReport(java.io.Writer out)
                    throws java.io.IOException
Deprecated. Replaced by writeReport(JRReport, String, Writer).

Throws:
java.io.IOException

writeProperties

public void writeProperties(JRPropertiesHolder propertiesHolder)
                     throws java.io.IOException
Throws:
java.io.IOException

writeTemplates

protected void writeTemplates(JRReport report)
                       throws java.io.IOException
Throws:
java.io.IOException

writeTemplates

protected void writeTemplates()
                       throws java.io.IOException
Deprecated. Replaced by writeTemplates(JRReport).

Throws:
java.io.IOException

writeTemplate

protected void writeTemplate(JRReportTemplate template)
                      throws java.io.IOException
Throws:
java.io.IOException

writeSection

protected void writeSection(JRSection section)
                     throws java.io.IOException
Throws:
java.io.IOException

writeChildElements

public void writeChildElements(JRElementGroup elementContainer)
Writes the contents (child elements) of an element container.

Parameters:
elementContainer - the element container

writeElementGroup

public void writeElementGroup(JRElementGroup elementGroup)
                       throws java.io.IOException
Throws:
java.io.IOException

writeBreak

public void writeBreak(JRBreak breakElement)
                throws java.io.IOException
Throws:
java.io.IOException

writeLine

public void writeLine(JRLine line)
               throws java.io.IOException
Throws:
java.io.IOException

writePropertyExpressions

public void writePropertyExpressions(JRPropertyExpression[] propertyExpressions)
                              throws java.io.IOException
Throws:
java.io.IOException

writePropertyExpression

protected void writePropertyExpression(JRPropertyExpression propertyExpression)
                                throws java.io.IOException
Throws:
java.io.IOException

writeRectangle

public void writeRectangle(JRRectangle rectangle)
                    throws java.io.IOException
Throws:
java.io.IOException

writeEllipse

public void writeEllipse(JREllipse ellipse)
                  throws java.io.IOException
Throws:
java.io.IOException

writeImage

public void writeImage(JRImage image)
                throws java.io.IOException
Throws:
java.io.IOException

writeStaticText

public void writeStaticText(JRStaticText staticText)
                     throws java.io.IOException
Throws:
java.io.IOException

writeFont

public void writeFont(JRFont font)
               throws java.io.IOException
Throws:
java.io.IOException

writeTextField

public void writeTextField(JRTextField textField)
                    throws java.io.IOException
Throws:
java.io.IOException

writeSubreport

public void writeSubreport(JRSubreport subreport)
                    throws java.io.IOException
Throws:
java.io.IOException

writeElementDataset

public void writeElementDataset(JRElementDataset dataset)
                         throws java.io.IOException
Writes the JRXML representation of an element dataset.

The method produces a <dataset> XML element.

Parameters:
dataset - the element dataset
Throws:
java.io.IOException - any I/O exception that occurred while writing the XML output

writeElementDataset

public void writeElementDataset(JRElementDataset dataset,
                                boolean skipIfEmpty)
                         throws java.io.IOException
Writes the JRXML representation of an element dataset.

The method produces a <dataset> XML element.

Parameters:
dataset - the element dataset
skipIfEmpty - if set, no output will be produced if the element dataset only has default attribute values
Throws:
java.io.IOException - any I/O exception that occurred while writing the XML output

writeElementDataset

public void writeElementDataset(JRElementDataset dataset,
                                ResetTypeEnum defaultResetType,
                                boolean skipIfEmpty)
                         throws java.io.IOException
Writes the JRXML representation of an element dataset.

The method produces a <dataset> XML element.

Parameters:
dataset - the element dataset
defaultResetType - the default dataset reset type
skipIfEmpty - if set, no output will be produced if the element dataset only has default attribute values
Throws:
java.io.IOException - any I/O exception that occurred while writing the XML output

writePieDataset

public void writePieDataset(JRPieDataset dataset)
                     throws java.io.IOException
Throws:
java.io.IOException

writeValueDataset

public void writeValueDataset(JRValueDataset dataset)
                       throws java.io.IOException
Writes the description of a value dataset to the output stream.

Parameters:
dataset - the value dataset to persist
Throws:
java.io.IOException

writeValueDisplay

public void writeValueDisplay(JRValueDisplay valueDisplay)
                       throws java.io.IOException
Writes the description of how to display a value in a valueDataset.

Parameters:
valueDisplay - the description to save
Throws:
java.io.IOException

writeItemLabel

public void writeItemLabel(JRItemLabel itemLabel)
                    throws java.io.IOException
Writes the description of how to display item labels in a category plot.

Parameters:
itemLabel - the description to save
Throws:
java.io.IOException

writeDataRange

public void writeDataRange(JRDataRange dataRange)
                    throws java.io.IOException
Writes a data range block to the output stream.

Parameters:
dataRange - the range to write
Throws:
java.io.IOException

writePieChart

public void writePieChart(JRChart chart)
                   throws java.io.IOException
Throws:
java.io.IOException

writePie3DChart

public void writePie3DChart(JRChart chart)
                     throws java.io.IOException
Throws:
java.io.IOException

writeCategoryAxisFormat

public void writeCategoryAxisFormat(JRFont axisLabelFont,
                                    java.awt.Color axisLabelColor,
                                    JRFont axisTickLabelFont,
                                    java.awt.Color axisTickLabelColor,
                                    java.lang.String axisTickLabelMask,
                                    java.lang.Boolean axisVerticalTickLabels,
                                    java.lang.Double labelRotation,
                                    java.awt.Color axisLineColor)
                             throws java.io.IOException
Writes out the category axis format block.

Parameters:
axisLabelFont - font to use for the axis label
axisLabelColor - color to use for the axis label
axisTickLabelFont - font to use for the label of each tick mark
axisTickLabelColor - color to use for the label of each tick mark
axisTickLabelMask - formatting mask to use for the label of each tick mark
axisVerticalTickLabels - flag to render tick labels at 90 degrees
labelRotation - label rotation angle
axisLineColor - the color to use for the axis line and any tick marks
Throws:
java.io.IOException

writeAxisFormat

public void writeAxisFormat(java.lang.String axisFormatElementName,
                            JRFont axisLabelFont,
                            java.awt.Color axisLabelColor,
                            JRFont axisTickLabelFont,
                            java.awt.Color axisTickLabelColor,
                            java.lang.String axisTickLabelMask,
                            java.lang.Boolean axisVerticalTickLabels,
                            java.awt.Color axisLineColor)
                     throws java.io.IOException
Writes out the axis format block for a chart axis.

Parameters:
axisFormatElementName - the name of the axis format element being written
axisLabelFont - font to use for the axis label
axisLabelColor - color to use for the axis label
axisTickLabelFont - font to use for the label of each tick mark
axisTickLabelColor - color to use for the label of each tick mark
axisTickLabelMask - formatting mask to use for the label of each tick mark
axisVerticalTickLabels - flag to render tick labels at 90 degrees
axisLineColor - the color to use for the axis line and any tick marks
Throws:
java.io.IOException

writeAxisFormat

public void writeAxisFormat(JRFont axisLabelFont,
                            java.awt.Color axisLabelColor,
                            JRFont axisTickLabelFont,
                            java.awt.Color axisTickLabelColor,
                            java.lang.String axisTickLabelMask,
                            java.lang.Boolean axisVerticalTickLabels,
                            java.awt.Color axisLineColor)
                     throws java.io.IOException
Writes out the axis format block for a chart axis.

Parameters:
axisLabelFont - font to use for the axis label
axisLabelColor - color to use for the axis label
axisTickLabelFont - font to use for the label of each tick mark
axisTickLabelColor - color to use for the label of each tick mark
axisTickLabelMask - formatting mask to use for the label of each tick mark
axisVerticalTickLabels - flag to render tick labels at 90 degrees
axisLineColor - the color to use for the axis line and any tick marks
Throws:
java.io.IOException

writeBar3DPlot

public void writeBar3DPlot(JRBar3DPlot plot)
                    throws java.io.IOException
Throws:
java.io.IOException

writeBarChart

public void writeBarChart(JRChart chart)
                   throws java.io.IOException
Throws:
java.io.IOException

writeBar3DChart

public void writeBar3DChart(JRChart chart)
                     throws java.io.IOException
Throws:
java.io.IOException

writeBubbleChart

public void writeBubbleChart(JRChart chart)
                      throws java.io.IOException
Throws:
java.io.IOException

writeStackedBarChart

public void writeStackedBarChart(JRChart chart)
                          throws java.io.IOException
Throws:
java.io.IOException

writeStackedBar3DChart

public void writeStackedBar3DChart(JRChart chart)
                            throws java.io.IOException
Throws:
java.io.IOException

writeLineChart

public void writeLineChart(JRChart chart)
                    throws java.io.IOException
Throws:
java.io.IOException

writeTimeSeriesChart

public void writeTimeSeriesChart(JRChart chart)
                          throws java.io.IOException
Throws:
java.io.IOException

writeHighLowDataset

public void writeHighLowDataset(JRHighLowDataset dataset)
                         throws java.io.IOException
Throws:
java.io.IOException

writeHighLowChart

public void writeHighLowChart(JRChart chart)
                       throws java.io.IOException
Throws:
java.io.IOException

writeGanttChart

public void writeGanttChart(JRChart chart)
                     throws java.io.IOException
Throws:
java.io.IOException

writeCandlestickChart

public void writeCandlestickChart(JRChart chart)
                           throws java.io.IOException
Throws:
java.io.IOException

writeAreaChart

public void writeAreaChart(JRChart chart)
                    throws java.io.IOException
Throws:
java.io.IOException

writeScatterChart

public void writeScatterChart(JRChart chart)
                       throws java.io.IOException
Throws:
java.io.IOException

writeXyAreaChart

public void writeXyAreaChart(JRChart chart)
                      throws java.io.IOException
Throws:
java.io.IOException

writeXyBarChart

public void writeXyBarChart(JRChart chart)
                     throws java.io.IOException
Throws:
java.io.IOException

writeXyLineChart

public void writeXyLineChart(JRChart chart)
                      throws java.io.IOException
Throws:
java.io.IOException

writeMeterChart

public void writeMeterChart(JRChart chart)
                     throws java.io.IOException
Writes the definition of a meter chart to the output stream.

Parameters:
chart - the meter chart to write
Throws:
java.io.IOException

writeThermometerChart

public void writeThermometerChart(JRChart chart)
                           throws java.io.IOException
Writes the description of a thermometer chart to the output stream.

Parameters:
chart - the thermometer chart to write
Throws:
java.io.IOException

writeMultiAxisChart

public void writeMultiAxisChart(JRChart chart)
                         throws java.io.IOException
Writes the definition of a multiple axis chart to the output stream.

Parameters:
chart - the multiple axis chart to write
Throws:
java.io.IOException

writeStackedAreaChart

public void writeStackedAreaChart(JRChart chart)
                           throws java.io.IOException
Throws:
java.io.IOException

writeChartTag

public void writeChartTag(JRChart chart)
                   throws java.io.IOException
Throws:
java.io.IOException

writeCrosstab

public void writeCrosstab(JRCrosstab crosstab)
                   throws java.io.IOException
Throws:
java.io.IOException

writeCrosstabRowGroup

protected void writeCrosstabRowGroup(JRCrosstabRowGroup group)
                              throws java.io.IOException
Throws:
java.io.IOException

writeCrosstabColumnGroup

protected void writeCrosstabColumnGroup(JRCrosstabColumnGroup group)
                                 throws java.io.IOException
Throws:
java.io.IOException

writeBucket

protected void writeBucket(JRCrosstabBucket bucket)
                    throws java.io.IOException
Throws:
java.io.IOException

writeCrosstabMeasure

protected void writeCrosstabMeasure(JRCrosstabMeasure measure)
                             throws java.io.IOException
Throws:
java.io.IOException

writeCrosstabCell

protected void writeCrosstabCell(JRCrosstabCell cell)
                          throws java.io.IOException
Throws:
java.io.IOException

writeCellContents

protected void writeCellContents(JRCellContents contents)
                          throws java.io.IOException
Throws:
java.io.IOException

writeCrosstabParameter

protected void writeCrosstabParameter(JRCrosstabParameter parameter)
                               throws java.io.IOException
Throws:
java.io.IOException

writeDataset

public void writeDataset(JRDataset dataset)
                  throws java.io.IOException
Throws:
java.io.IOException

writeDatasetContents

protected void writeDatasetContents(JRDataset dataset)
                             throws java.io.IOException
Throws:
java.io.IOException

writeDatasetRun

public void writeDatasetRun(JRDatasetRun datasetRun)
                     throws java.io.IOException
Outputs the XML representation of a subdataset run object.

Parameters:
datasetRun - the subdataset run
Throws:
java.io.IOException

writeFrame

public void writeFrame(JRFrame frame)
                throws java.io.IOException
Throws:
java.io.IOException

writeHyperlinkParameters

protected void writeHyperlinkParameters(JRHyperlinkParameter[] parameters)
                                 throws java.io.IOException
Throws:
java.io.IOException

writeHyperlinkParameter

protected void writeHyperlinkParameter(JRHyperlinkParameter parameter)
                                throws java.io.IOException
Throws:
java.io.IOException

writeHyperlink

public void writeHyperlink(java.lang.String tagName,
                           JRHyperlink hyperlink)
                    throws java.io.IOException
Throws:
java.io.IOException

writeHyperlink

public void writeHyperlink(java.lang.String tagName,
                           XmlNamespace namespace,
                           JRHyperlink hyperlink)
                    throws java.io.IOException
Throws:
java.io.IOException

toWriteConditionalStyles

protected boolean toWriteConditionalStyles()
Description copied from class: JRXmlBaseWriter
Decides whether conditional styles are to be written.

Specified by:
toWriteConditionalStyles in class JRXmlBaseWriter
Returns:
whether conditional styles are to be written

getXmlWriteHelper

public JRXmlWriteHelper getXmlWriteHelper()
Returns the XML write helper used by this report writer. The helper can be used to output XML elements and attributes.

Returns:
the XML write helper used by this report writer

getUnderlyingWriter

public java.io.Writer getUnderlyingWriter()
Returns the underlying stream to which this writer outputs to.

Returns:
the underlying stream used by this writer

writeComponentElement

public void writeComponentElement(JRComponentElement componentElement)
                           throws java.io.IOException
Throws:
java.io.IOException

getNamespace

protected XmlNamespace getNamespace()

writeGenericElement

public void writeGenericElement(JRGenericElement element)
                         throws java.io.IOException
Throws:
java.io.IOException


© 2001-2010 Jaspersoft Corporation www.jaspersoft.com