org.jfree.report.modules.output.csv
Class CSVWriter

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

public class CSVWriter
extends AbstractFunction

The CSV Writer is the content creation function used to create the CSV content. This implementation does no layouting, the DataRow's raw data is written to the supplied writer.

Author:
Thomas Morgner.
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.jfree.report.function.Expression
AUTOACTIVATE_PROPERTY
 
Constructor Summary
CSVWriter()
          DefaulConstructor.
 
Method Summary
 int getDependencyLevel()
          The dependency level defines the level of execution for this function.
 java.lang.String getSeparator()
          Gets the separator which is used to separate columns in a row.
 java.lang.Object getValue()
          Return a selfreference of this CSVWriter.
 java.io.Writer getWriter()
          Returns the writer used to output the generated data.
 void groupFinished(ReportEvent event)
          Writes the GroupFooter of the active group.
 void groupStarted(ReportEvent event)
          Writes the GroupHeader of the current group.
 boolean isWriteDataRowNames()
          Returns whether to print dataRow column names as header.
 void itemsAdvanced(ReportEvent event)
          Writes the current ItemBand.
 void reportFinished(ReportEvent event)
          Writes the ReportFooter.
 void reportStarted(ReportEvent event)
          Writes the ReportHeader and (if defined) the dataRow names.
 void setDependencyLevel(int deplevel)
          Overrides the depency level.
 void setSeparator(java.lang.String separator)
          Defines the separator, which is used to separate columns in a row.
 void setWriteDataRowNames(boolean writeDataRowNames)
          Defines, whether to print column names in the first row.
 void setWriter(java.io.Writer w)
          Defines the writer which should be used to output the generated data.
 
Methods inherited from class org.jfree.report.function.AbstractFunction
clone, getDataRow, getInstance, getName, getProperties, getProperty, getProperty, initialize, isActive, itemsFinished, itemsStarted, 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

CSVWriter

public CSVWriter()
DefaulConstructor. Creates a CSVWriter with a dependency level of -1 and a default CSVQuoter.

Method Detail

isWriteDataRowNames

public boolean isWriteDataRowNames()
Returns whether to print dataRow column names as header.

Returns:
true, if column names are printed, false otherwise.

setWriteDataRowNames

public void setWriteDataRowNames(boolean writeDataRowNames)
Defines, whether to print column names in the first row.

Parameters:
writeDataRowNames - true, if column names are printed, false otherwise

getWriter

public java.io.Writer getWriter()
Returns the writer used to output the generated data.

Returns:
the writer

setWriter

public void setWriter(java.io.Writer w)
Defines the writer which should be used to output the generated data.

Parameters:
w - the writer

setSeparator

public void setSeparator(java.lang.String separator)
Defines the separator, which is used to separate columns in a row.

Parameters:
separator - the separator string, never null.
Throws:
java.lang.NullPointerException - if the separator is null.
java.lang.IllegalArgumentException - if the separator is an empty string.

getSeparator

public java.lang.String getSeparator()
Gets the separator which is used to separate columns in a row.

Returns:
the separator, never null.

reportStarted

public void reportStarted(ReportEvent event)
Writes the ReportHeader and (if defined) the dataRow names.

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

reportFinished

public void reportFinished(ReportEvent event)
Writes the ReportFooter.

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

groupStarted

public void groupStarted(ReportEvent event)
Writes the GroupHeader 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 GroupFooter of the active group.

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

itemsAdvanced

public void itemsAdvanced(ReportEvent event)
Writes the current ItemBand.

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

getValue

public java.lang.Object getValue()
Return a selfreference of this CSVWriter. This selfreference is used to confiugre the output process.

Returns:
this CSVWriter.

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.