com.jrefinery.report.targets.table
Class TableProcessor

java.lang.Object
  |
  +--com.jrefinery.report.targets.table.TableProcessor
Direct Known Subclasses:
CSVTableProcessor, ExcelProcessor, HtmlProcessor, RTFProcessor

public abstract class TableProcessor
extends java.lang.Object

The TableProcessor is the abstract base class for all table based output targets. It handles the initialisation of the report writer and starts and manages the report process.

Implementing classes should supply a table producer by implementing the createProducer method.

Author:
Thomas Morgner

Constructor Summary
TableProcessor(JFreeReport report)
          Creates a new TableProcessor.
 
Method Summary
protected  void configure()
          Copies all report configuration properties which match the configuration prefix of this table processor into the property set of this processor.
protected abstract  TableProducer createProducer(boolean dummy)
          Creates a TableProducer.
protected  java.util.Properties getProperties()
          Gets the internal properties storage.
 java.lang.Object getProperty(java.lang.String property)
          Queries the property named with property.
 java.lang.Object getProperty(java.lang.String property, java.lang.Object defaultValue)
          Queries the property named with property.
protected  java.util.Iterator getPropertyNames()
          Returns an enumeration of the property names.
protected  JFreeReport getReport()
          Returns the private copy of the used report.
protected abstract  java.lang.String getReportConfigurationPrefix()
          Gets the report configuration prefix for that processor.
 boolean isStrictLayout()
          Returns the strict layout flag.
 void processReport()
          Processes the report.
 void setProperty(java.lang.String property, java.lang.Object value)
          Defines a property for this output target.
 void setStrictLayout(boolean strictLayout)
          Defines the strict layout flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableProcessor

public TableProcessor(JFreeReport report)
               throws ReportProcessingException,
                      FunctionInitializeException
Creates a new TableProcessor. The TableProcessor creates a private copy of the supplied report.

Parameters:
report - the report that should be processed.
Throws:
ReportProcessingException - if the report initialization failed
FunctionInitializeException - if the table writer initialization failed.
Method Detail

isStrictLayout

public boolean isStrictLayout()
Returns the strict layout flag.

Returns:
true, if a stricter layouting algorithm should be used, false otherwise.
See Also:
TableGrid.isStrict()

setStrictLayout

public void setStrictLayout(boolean strictLayout)
Defines the strict layout flag.

Parameters:
strictLayout - true, if a stricter layouting algorithm should be used, false otherwise.
See Also:
TableGrid.isStrict()

getReport

protected JFreeReport getReport()
Returns the private copy of the used report. The report is initialized for the report writing, so handle with care.

Returns:
the local report.

processReport

public void processReport()
                   throws ReportProcessingException
Processes the report. The generated output is written using the defined writer, the report is repaginated before the final writing.

Throws:
ReportProcessingException - if the report processing failed.

createProducer

protected abstract TableProducer createProducer(boolean dummy)
Creates a TableProducer. The TableProducer is responsible to create the table.

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

setProperty

public void setProperty(java.lang.String property,
                        java.lang.Object value)
Defines a property for this output target. Properties are the standard way of configuring an output target.

Parameters:
property - the name of the property to set (null not permitted).
value - the value of the property. If the value is null, the property is removed from the output target.

getProperty

public java.lang.Object getProperty(java.lang.String property)
Queries the property named with property. If the property is not found, null is returned.

Parameters:
property - the name of the property to be queried
Returns:
the value stored under the given property name
Throws:
java.lang.NullPointerException - if property is null

getProperty

public java.lang.Object getProperty(java.lang.String property,
                                    java.lang.Object defaultValue)
Queries the property named with property. If the property is not found, the default value is returned.

Parameters:
property - the name of the property to be queried
defaultValue - the defaultvalue returned if there is no such property
Returns:
the value stored under the given property name
Throws:
java.lang.NullPointerException - if property is null

getPropertyNames

protected java.util.Iterator getPropertyNames()
Returns an enumeration of the property names.

Returns:
the enumeration.

getProperties

protected java.util.Properties getProperties()
Gets the internal properties storage.

Returns:
the internal properties storage.

getReportConfigurationPrefix

protected abstract 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.

Returns:
the report configuration prefix.

configure

protected void configure()
Copies all report configuration properties which match the configuration prefix of this table processor into the property set of this processor.