org.jfree.report.modules.output.xml
Class XMLWriter

java.lang.Object
  extended byorg.jfree.report.function.AbstractFunction
      extended byorg.jfree.report.modules.output.xml.XMLWriter
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, Expression, Function, ReportListener, java.io.Serializable

public class XMLWriter
extends AbstractFunction

The XMLWriter is the content creation function used to create the XML content. This implementation does no layouting, the bands and elements are written in the defined order.

The xml writer is intended as simple example on how to write OutputFunctions, the XML-code generated is very simple and easy to understand. If you seek complexer XML-Outputs, have a look at the HTML-Writer, this implementation is able to write XHTML output.

Author:
Thomas Morgner
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.jfree.report.function.Expression
AUTOACTIVATE_PROPERTY
 
Constructor Summary
XMLWriter()
          Creates a new XMLWriter function.
 
Method Summary
 int getDependencyLevel()
          The dependency level defines the level of execution for this function.
 java.lang.Object getValue()
          Return the self reference of this writer.
 java.io.Writer getWriter()
          returns the assigned writer for the output.
 void groupFinished(ReportEvent event)
          Writes the footer of the current group.
 void groupStarted(ReportEvent event)
          Writes the header of the current group.
 void itemsAdvanced(ReportEvent event)
          Writes the itemband.
 void itemsFinished(ReportEvent event)
          Closes the itemband section.
 void itemsStarted(ReportEvent event)
          Starts the itembands section.
 void reportFinished(ReportEvent event)
          Writes the report footer.
 void reportStarted(ReportEvent event)
          Writes the report header.
 void setDependencyLevel(int deplevel)
          Overrides the depency level.
 void setWriter(java.io.Writer w)
          Defines the writer for the XML-output.
 
Methods inherited from class org.jfree.report.function.AbstractFunction
clone, getDataRow, getInstance, getName, getProperties, getProperty, getProperty, initialize, isActive, reportDone, reportInitialized, setDataRow, setName, setProperties, setProperty
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLWriter

public XMLWriter()
Creates a new XMLWriter function. The Writer gets a dependency level of -1.

Method Detail

getWriter

public java.io.Writer getWriter()
returns the assigned writer for the output.

Returns:
the writer.

setWriter

public void setWriter(java.io.Writer w)
Defines the writer for the XML-output.

Parameters:
w - the writer.

reportStarted

public void reportStarted(ReportEvent event)
Writes the report header.

Specified by:
reportStarted in interface ReportListener
Overrides:
reportStarted in class AbstractFunction
Parameters:
event - the event.

reportFinished

public void reportFinished(ReportEvent event)
Writes the report footer.

Specified by:
reportFinished in interface ReportListener
Overrides:
reportFinished in class AbstractFunction
Parameters:
event - the event.

groupStarted

public void groupStarted(ReportEvent event)
Writes the header of the current group.

Specified by:
groupStarted in interface ReportListener
Overrides:
groupStarted in class AbstractFunction
Parameters:
event - the event.

groupFinished

public void groupFinished(ReportEvent event)
Writes the footer of the current group.

Specified by:
groupFinished in interface ReportListener
Overrides:
groupFinished in class AbstractFunction
Parameters:
event - the event.

itemsAdvanced

public void itemsAdvanced(ReportEvent event)
Writes the itemband.

Specified by:
itemsAdvanced in interface ReportListener
Overrides:
itemsAdvanced in class AbstractFunction
Parameters:
event - the event.

itemsStarted

public void itemsStarted(ReportEvent event)
Starts the itembands section.

The next events will be itemsAdvanced events until the itemsFinished event is raised.

Specified by:
itemsStarted in interface ReportListener
Overrides:
itemsStarted in class AbstractFunction
Parameters:
event - The event.

itemsFinished

public void itemsFinished(ReportEvent event)
Closes the itemband section.

The itemBand is finished, the report starts to close open groups.

Specified by:
itemsFinished in interface ReportListener
Overrides:
itemsFinished in class AbstractFunction
Parameters:
event - The event.

getValue

public java.lang.Object getValue()
Return the self reference of this writer.

Returns:
the value of the function.

getDependencyLevel

public int getDependencyLevel()
The dependency level defines the level of execution for this function. Higher dependency functions are executed before lower dependency functions. For ordinary functions and expressions, the range for dependencies is defined to start from 0 (lowest dependency possible) to 2^31 (upper limit of int).

PageLayouter functions override the default behaviour an place them self at depency level -1, an so before any userdefined function.

Specified by:
getDependencyLevel in interface Expression
Overrides:
getDependencyLevel in class AbstractFunction
Returns:
the level.

setDependencyLevel

public void setDependencyLevel(int deplevel)
Overrides the depency level. Should be lower than any other function depency.

Specified by:
setDependencyLevel in interface Expression
Overrides:
setDependencyLevel in class AbstractFunction
Parameters:
deplevel - the new depency level.