Class MasterReport

  extended by org.pentaho.reporting.engine.classic.core.Element
      extended by org.pentaho.reporting.engine.classic.core.Section
          extended by org.pentaho.reporting.engine.classic.core.AbstractReportDefinition
              extended by org.pentaho.reporting.engine.classic.core.MasterReport
All Implemented Interfaces:
Serializable, Cloneable, DataTarget, ReportDefinition, ReportElement

public class MasterReport
extends AbstractReportDefinition

A JFreeReport instance is used as report template to define the visual layout of a report and to collect all data sources for the reporting. Possible data sources are the TableModel, Expressions or ReportParameterValues. The report is made up of 'bands', which are used repeatedly as necessary to generate small sections of the report.

Accessing the bands and the elements:

The different bands can be accessed using the main report definition (this class):

Groups can be queried using getGroup(int groupLevel). The group header and footer are accessible through the group object, so use getGroup(int groupLevel).getGroupHeader() and getGroup(int groupLevel).getGroupFooter().

All report elements share the same stylesheet collection. Report elements cannot be shared between two different report instances. Adding a report element to one band will remove it from the other one.

For dynamic computation of content you can add Expressions and Functions to the report.

Creating a new instance of JFreeReport seems to lock down the JDK on some Windows Systems, where no printer driver is installed. To prevent that behaviour on these systems, you can set the Configuration key "org.pentaho.reporting.engine.classic.core.NoPrinterAvailable" to "false" and JFreeReport will use a hardcoded default page format instead.

A JFreeReport object always acts as Master-Report. The JFreeReport object defines the global report-configuration, the report's datasource (through the DataFactory property) and the ResourceBundleFactory (for localization).

David Gilbert, Thomas Morgner
See Also:
Serialized Form

Field Summary
static String NAME_PROPERTY
          Key for the 'report name' property.
          Key for the 'report date' property.
Fields inherited from class org.pentaho.reporting.engine.classic.core.Element
Constructor Summary
          The default constructor.
Method Summary
 Object clone()
          Clones the report.
static ResourceBundleFactory computeAndInitResourceBundleFactory(ResourceBundleFactory resourceBundleFactory, ReportEnvironment environment)
 Element derive(boolean preserveElementInstanceIds)
          Creates a deep copy of this element and regenerates all instance-ids.
 org.pentaho.reporting.libraries.docbundle.DocumentBundle getBundle()
 Integer getCompatibilityLevel()
 org.pentaho.reporting.libraries.base.config.Configuration getConfiguration()
          Returns the report's configuration.
 DataFactory getDataFactory()
          Returns the data factory that has been assigned to this report.
 String getName()
          Returns the name of the report.
 PageDefinition getPageDefinition()
          Returns the logical page definition for this report.
 ReportParameterDefinition getParameterDefinition()
 ReportParameterValues getParameterValues()
 org.pentaho.reporting.libraries.base.config.ModifiableConfiguration getReportConfiguration()
          Returns the report configuration.
 ReportEnvironment getReportEnvironment()
 org.pentaho.reporting.libraries.resourceloader.ResourceManager getResourceManager()
          Returns the resource manager that was responsible for loading the report.
 String getTitle()
 void setBundle(org.pentaho.reporting.libraries.docbundle.DocumentBundle bundle)
 void setCompatibilityLevel(Integer level)
 void setDataFactory(DataFactory dataFactory)
          Sets the data factory for the report.
 void setName(String name)
          Sets the name of the report.
 void setPageDefinition(PageDefinition format)
          Defines the logical page definition for this report.
 void setParameterDefinition(ReportParameterDefinition parameterDefinition)
 void setProperty(String key, Object value)
          Deprecated. Properties should not be used. Use the master-report's parameters instead.
 void setReportEnvironment(ReportEnvironment reportEnvironment)
 void setResourceBundleFactory(ResourceBundleFactory resourceBundleFactory)
          Redefines the resource bundle factory for the report.
 void setResourceManager(org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager)
          Assigns a new resource manager or clears the current one.
 void updateLegacyConfiguration()
Methods inherited from class org.pentaho.reporting.engine.classic.core.AbstractReportDefinition
addExpression, addGroup, addGroup, addPreProcessor, addReportModelListener, addStructureFunction, fireModelLayoutChanged, getContentBase, getDataRow, getDataSchemaDefinition, getDatasourceChangeTracker, getDefinitionSource, getDetailsFooter, getDetailsHeader, getElement, getElementCount, getExpressions, getGroup, getGroupByName, getGroupCount, getItemBand, getNoDataBand, getNonVisualsChangeTracker, getPageFooter, getPageHeader, getPreProcessor, getPreProcessorCount, getPreProcessors, getProperties, getProperty, getQuery, getQueryLimit, getQueryTimeout, getReportDefinition, getReportFooter, getReportHeader, getResourceBundleFactory, getRootGroup, getStructureFunction, getStructureFunctionCount, getStructureFunctions, getStyleSheetCollection, getWatermark, removeExpression, removeGroup, removeGroup, removePreProcessor, removeReportModelListener, removeStructureFunction, setContentBase, setDataSchemaDefinition, setDefinitionSource, setDetailsFooter, setDetailsHeader, setElementAt, setExpressions, setGroups, setItemBand, setNoDataBand, setPageFooter, setPageHeader, setQuery, setQueryLimit, setQueryTimeout, setReportFooter, setReportHeader, setRootGroup, setWatermark
Methods inherited from class org.pentaho.reporting.engine.classic.core.Element
derive, getAttribute, getAttributeExpression, getAttributeExpressionNames, getAttributeExpressionNamespaces, getAttributeNames, getAttributeNamespaces, getAttributes, getChangeTracker, getDataSource, getElementType, getElementTypeName, getHRefTarget, getId, getMetaData, getObjectID, getParent, getParentSection, getStyle, getStyleExpression, getStyleExpressions, getTreeLock, getValue, isDynamicContent, isVisible, notifyNodeChildAdded, notifyNodeChildRemoved, notifyNodePropertiesChanged, notifyNodePropertiesChanged, notifyNodeStructureChanged, setAttribute, setAttribute, setAttributeExpression, setDataSource, setDynamicContent, setElementType, setHRefTarget, setId, setStyleExpression, setVisible, toString
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.pentaho.reporting.engine.classic.core.ReportElement
getAttribute, getAttributeExpression, getAttributeExpressionNames, getAttributeExpressionNamespaces, getAttributeNames, getAttributeNamespaces, getAttributes, getId, getMetaData, getObjectID, getParentSection, getStyle, getStyleExpression, getStyleExpressions, getTreeLock, setAttribute, setAttributeExpression, setStyleExpression

Field Detail


public static final String NAME_PROPERTY
Key for the 'report name' property.

See Also:
Constant Field Values


public static final String REPORT_DATE_PROPERTY
Key for the 'report date' property.

See Also:
Constant Field Values
Constructor Detail


public MasterReport()
The default constructor. Creates an empty but fully initialized report.

Method Detail


public void setResourceBundleFactory(ResourceBundleFactory resourceBundleFactory)
Redefines the resource bundle factory for the report.

setResourceBundleFactory in class AbstractReportDefinition
resourceBundleFactory - the new resource bundle factory, never null.
NullPointerException - if the given ResourceBundleFactory is null.


public org.pentaho.reporting.libraries.docbundle.DocumentBundle getBundle()


public void setBundle(org.pentaho.reporting.libraries.docbundle.DocumentBundle bundle)


public ReportParameterDefinition getParameterDefinition()


public void setParameterDefinition(ReportParameterDefinition parameterDefinition)


public ReportEnvironment getReportEnvironment()


public void setReportEnvironment(ReportEnvironment reportEnvironment)


public String getTitle()


public String getName()
Returns the name of the report.

You can reference the report name in your XML report template file using the key ''.

Specified by:
getName in interface ReportElement
getName in class Element
the name.


public void setName(String name)
Sets the name of the report.

The report name is stored as a property (key NAME_PROPERTY) inside the report properties. If you supply null as the name, the property is removed.

setName in class Element
name - the name of the report.


public PageDefinition getPageDefinition()
Returns the logical page definition for this report.

the page definition.


public void setPageDefinition(PageDefinition format)
Defines the logical page definition for this report. If no format is defined the system's default page format is used.

If there is no printer available and the JDK blocks during the printer discovery, you can set the Configuration key "org.pentaho.reporting.engine.classic.core.NoPrinterAvailable" to "false" and JFreeReport will use a hardcoded default page format instead.

format - the default format (null permitted).


public DataFactory getDataFactory()
Returns the data factory that has been assigned to this report. The data factory will never be null.

Specified by:
getDataFactory in class AbstractReportDefinition
the data factory.


public void setDataFactory(DataFactory dataFactory)
Sets the data factory for the report.

Specified by:
setDataFactory in class AbstractReportDefinition
dataFactory - the data factory for the report, never null.


public Object clone()
             throws CloneNotSupportedException
Clones the report.

Specified by:
clone in interface DataTarget
clone in class AbstractReportDefinition
the clone.
CloneNotSupportedException - this should never happen.


public Element derive(boolean preserveElementInstanceIds)
               throws CloneNotSupportedException
Description copied from class: Element
Creates a deep copy of this element and regenerates all instance-ids.

derive in class AbstractReportDefinition
preserveElementInstanceIds - defines whether this call generates new instance-ids for the derived elements. Instance-IDs are used by the report processor to recognize reoccurring elements and must not changed within the report run. Outside of the report processors new instance ids should be generated at all times to separate instances and to make them uniquely identifiable.
the copy of the element.


public org.pentaho.reporting.libraries.base.config.ModifiableConfiguration getReportConfiguration()
Returns the report configuration.

The report configuration is automatically set up when the report is first created, and uses the global JFreeReport configuration as its parent.

the report configuration.


public org.pentaho.reporting.libraries.base.config.Configuration getConfiguration()
Returns the report's configuration.

the configuration.


public org.pentaho.reporting.libraries.resourceloader.ResourceManager getResourceManager()
Returns the resource manager that was responsible for loading the report. This method will return a default manager if the report had been constructed otherwise.

The resource manager of the report should be used for all resource loading activities during the report processing.

Specified by:
getResourceManager in class AbstractReportDefinition
the resource manager, never null.


public void setResourceManager(org.pentaho.reporting.libraries.resourceloader.ResourceManager resourceManager)
Assigns a new resource manager or clears the current one. If no resource manager is set anymore, the next call to 'getResourceManager' will recreate one.

resourceManager - the new resource manager or null.


public ReportParameterValues getParameterValues()


public void setProperty(String key,
                        Object value)
Deprecated. Properties should not be used. Use the master-report's parameters instead.

Adds a property to the report.

If a property with the given name already exists, the property will be updated with the new value. If the supplied value is null, the property will be removed.

Developers are free to add any properties they want to a report, and then display those properties in the report. For example, you might add a '' property, so that you can display the username in the header of a report.

setProperty in class AbstractReportDefinition
key - the key.
value - the value.


public static ResourceBundleFactory computeAndInitResourceBundleFactory(ResourceBundleFactory resourceBundleFactory,
                                                                        ReportEnvironment environment)
                                                                 throws ReportProcessingException


public Integer getCompatibilityLevel()


public void setCompatibilityLevel(Integer level)


public void updateLegacyConfiguration()