com.jrefinery.report.targets.table.csv
Class CSVTableProcessor

java.lang.Object
  |
  +--com.jrefinery.report.targets.table.TableProcessor
        |
        +--com.jrefinery.report.targets.table.csv.CSVTableProcessor

public class CSVTableProcessor
extends TableProcessor

The CSVTableProcessor coordinates the output for the layouted CSV output. The bands are layouted and the layouted contents are printed into the csv-file.

For data oriented csv output try the com.jrefinery.report.targets.csv.CSVProcessor. The used writer is not closed after the processing, the caller is responsible to close the writer.

The CellSeparator can be used to alter the separator character, f.i. to create tab-separated files.

Author:
Thomas Morgner
See Also:
CSVProcessor

Field Summary
static java.lang.String SEPARATOR_DEFAULT
          The default value for the separator string (",").
static java.lang.String SEPARATOR_KEY
          the key for the separator string.
 
Constructor Summary
CSVTableProcessor(JFreeReport report)
          Creates a new CSV table processor for the given report.
CSVTableProcessor(JFreeReport report, java.lang.String separator)
          Creates a new CSV table processor for the given report and uses the given separator string.
 
Method Summary
 TableProducer createProducer(boolean dummy)
          Creates the CSVTableProducer.
protected  java.lang.String getReportConfigurationPrefix()
          Gets the report configuration prefix for that processor.
 java.lang.String getSeparator()
          Gets the separator string for the generated output.
 java.io.Writer getWriter()
          Gets the writer, which should be used to output the generated content.
 void setSeparator(java.lang.String separator)
          Defines the separator string for the generated output.
 void setWriter(java.io.Writer writer)
          Sets the writer, that should be used to write the generated content.
 
Methods inherited from class com.jrefinery.report.targets.table.TableProcessor
configure, getProperties, getProperty, getProperty, getPropertyNames, getReport, isStrictLayout, processReport, setProperty, setStrictLayout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SEPARATOR_KEY

public static final java.lang.String SEPARATOR_KEY
the key for the separator string.

See Also:
Constant Field Values

SEPARATOR_DEFAULT

public static final java.lang.String SEPARATOR_DEFAULT
The default value for the separator string (",").

See Also:
Constant Field Values
Constructor Detail

CSVTableProcessor

public CSVTableProcessor(JFreeReport report)
                  throws ReportProcessingException,
                         FunctionInitializeException
Creates a new CSV table processor for the given report.

The default separator is a comma (","), but this can be overridden in the report configuration (key: com.jrefinery.report.targets.csv.separator).

Parameters:
report - the report to process.
Throws:
ReportProcessingException - if the report initialization failed
FunctionInitializeException - if the table writer initialization failed.

CSVTableProcessor

public CSVTableProcessor(JFreeReport report,
                         java.lang.String separator)
                  throws ReportProcessingException,
                         FunctionInitializeException
Creates a new CSV table processor for the given report and uses the given separator string.

Parameters:
report - the report to process.
separator - the value separator (null not permitted).
Throws:
ReportProcessingException - if the report initialization failed
FunctionInitializeException - if the table writer initialization failed.
java.lang.NullPointerException - if the given separator is null.
Method Detail

getSeparator

public java.lang.String getSeparator()
Gets the separator string for the generated output.

Returns:
The defined separator for the output.

setSeparator

public void setSeparator(java.lang.String separator)
Defines the separator string for the generated output.

Parameters:
separator - the defined separator for the output (null not permitted).
Throws:
java.lang.NullPointerException - if the given separator is null.

getWriter

public java.io.Writer getWriter()
Gets the writer, which should be used to output the generated content.

Returns:
the writer.

setWriter

public void setWriter(java.io.Writer writer)
Sets the writer, that should be used to write the generated content.

Parameters:
writer - the writer.

createProducer

public TableProducer createProducer(boolean dummy)
Creates the CSVTableProducer. The TableProducer is responsible to create the table.

Specified by:
createProducer in class TableProcessor
Parameters:
dummy - true, if dummy mode is enabled, and no writing should be done, false otherwise.
Returns:
the created table producer, never null.

getReportConfigurationPrefix

protected java.lang.String getReportConfigurationPrefix()
Gets the report configuration prefix for that processor. This prefix defines how to map the property names into the global report configuration.

Specified by:
getReportConfigurationPrefix in class TableProcessor
Returns:
the report configuration prefix.