Class MasterReport
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.Element
-
- org.pentaho.reporting.engine.classic.core.Section
-
- org.pentaho.reporting.engine.classic.core.AbstractReportDefinition
-
- org.pentaho.reporting.engine.classic.core.MasterReport
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<Element>
,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 theTableModel
,Expression
s orReportParameterValues
. 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):- the report header and footer can be reached by using
getReportHeader()
andgetReportFooter()
- the page header and page footer can be reached by using
getPageHeader()
andgetPageFooter()
- the item band is reachable with
getItemBand()
- the no-data band is reachable with
getNoDataBand()
- the watermark band is reachable with
getWaterMark()
getGroup(int groupLevel)
. The group header and footer are accessible through the group object, so usegetGroup(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
Expression
s and.core.function.Function
s 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 theConfiguration
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).- Author:
- David Gilbert, Thomas Morgner
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
REPORT_DATE_PROPERTY
Key for the 'report date' property.-
Fields inherited from class org.pentaho.reporting.engine.classic.core.Element
ANONYMOUS_ELEMENT_PREFIX
-
-
Constructor Summary
Constructors Constructor Description MasterReport()
The default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MasterReport
clone()
Clones the report.static ResourceBundleFactory
computeAndInitResourceBundleFactory(ResourceBundleFactory resourceBundleFactory, ReportEnvironment environment)
MasterReport
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.String
getContentCacheKey()
DataFactory
getDataFactory()
Returns the data factory that has been assigned to this report.ReportDefinition
getMasterReport()
Returns the master-report element.ModifiableReportParameterDefinition
getModifiableParameterDefinition()
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()
ResourceBundleFactory
getResourceBundleFactory()
Returns the resource bundle factory for this report definition.org.pentaho.reporting.libraries.resourceloader.ResourceManager
getResourceManager()
Returns the resource manager that was responsible for loading the report.ElementStyleDefinition
getStyleDefinition()
org.pentaho.reporting.libraries.resourceloader.ResourceKey
getStyleSheetReference()
String
getTitle()
boolean
isStrictLegacyMode()
void
setBundle(org.pentaho.reporting.libraries.docbundle.DocumentBundle bundle)
void
setCompatibilityLevel(Integer level)
void
setContentCacheKey(String contentCacheKey)
void
setDataFactory(DataFactory dataFactory)
Sets the data factory for the report.void
setPageDefinition(PageDefinition format)
Defines the logical page definition for this report.void
setParameterDefinition(ReportParameterDefinition parameterDefinition)
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
setStrictLegacyMode(boolean strict)
void
setStyleDefinition(ElementStyleDefinition styleDefinition)
void
setStyleSheetReference(org.pentaho.reporting.libraries.resourceloader.ResourceKey styleSheetReference)
protected void
updateChangedFlagInternal(ReportElement element, int type, Object parameter)
Updates the change flag and notifies the parent, if this element has a parent.void
updateLegacyConfiguration()
-
Methods inherited from class org.pentaho.reporting.engine.classic.core.AbstractReportDefinition
addExpression, addGroup, addGroup, addPreProcessor, addReportModelListener, addStructureFunction, fireModelLayoutChanged, getAutoSort, getContentBase, getCrosstabCellBody, getDataSchemaDefinition, getDatasourceChangeTracker, getDefaultStyleSheet, getDefinitionSource, getDetailsFooter, getDetailsHeader, getElement, getElementCount, getExpressions, getGroup, getGroupByName, getGroupCount, getItemBand, getNoDataBand, getNonVisualsChangeTracker, getPageFooter, getPageHeader, getPreProcessor, getPreProcessorCount, getPreProcessors, getQuery, getQueryLimit, getQueryTimeout, getRelationalGroup, getReportDefinition, getReportFooter, getReportHeader, getRootGroup, getStructureFunction, getStructureFunctionCount, getStructureFunctions, getUserQueryLimit, getWatermark, isQueryLimitInherited, removeElement, removeExpression, removeGroup, removeGroup, removePreProcessor, removeReportModelListener, removeStructureFunction, setAutoSort, setContentBase, setDataSchemaDefinition, setDefinitionSource, setElementAt, setExpressions, setPageFooter, setPageHeader, setQuery, setQueryLimit, setQueryLimitInheritance, setQueryTimeout, setReportFooter, setReportHeader, setRootGroup, setUserQueryLimit, setWatermark
-
Methods inherited from class org.pentaho.reporting.engine.classic.core.Section
iterator, registerAsChild, unregisterAsChild, unregisterParent, validateLooping
-
Methods inherited from class org.pentaho.reporting.engine.classic.core.Element
copyAttributes, copyInto, derive, getAttribute, getAttributeExpression, getAttributeExpressionNames, getAttributeExpressionNamespaces, getAttributeExpressions, getAttributeNames, getAttributeNamespaces, getAttributes, getAttributeTyped, getChangeTracker, getChildElementByType, getChildElementsByName, getChildElementsByType, getComputedStyle, getDataSource, getElementContext, getElementType, getElementTypeName, getFirstAttribute, getHRefTarget, getId, getMetaData, getName, getObjectID, getParent, getParentSection, getStyle, getStyleExpression, getStyleExpressions, getTreeLock, isDynamicContent, isVisible, notifyElement, notifyNodeChildAdded, notifyNodeChildRemoved, notifyNodePropertiesChanged, notifyNodePropertiesChanged, notifyNodeStructureChanged, setAttribute, setAttribute, setAttributeExpression, setChangeTracker, setComputedStyle, setDataSource, setDynamicContent, setElementType, setHRefTarget, setId, setName, setParent, setStyleExpression, setVisible, toString, updateInternalChangeFlag
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface org.pentaho.reporting.engine.classic.core.ReportElement
getAttribute, getAttributeExpression, getAttributeExpressionNames, getAttributeExpressionNamespaces, getAttributeNames, getAttributeNamespaces, getAttributes, getAttributeTyped, getChangeTracker, getChildElementByType, getChildElementsByName, getChildElementsByType, getComputedStyle, getElementContext, getElementType, getFirstAttribute, getId, getMetaData, getName, getObjectID, getParentSection, getStyle, getStyleExpression, getStyleExpressions, getTreeLock, setAttribute, setAttribute, setAttributeExpression, setComputedStyle, setStyleExpression
-
-
-
-
Field Detail
-
REPORT_DATE_PROPERTY
public static final String REPORT_DATE_PROPERTY
Key for the 'report date' property.- See Also:
- Constant Field Values
-
-
Method Detail
-
computeAndInitResourceBundleFactory
public static ResourceBundleFactory computeAndInitResourceBundleFactory(ResourceBundleFactory resourceBundleFactory, ReportEnvironment environment)
-
getResourceBundleFactory
public ResourceBundleFactory getResourceBundleFactory()
Returns the resource bundle factory for this report definition. TheResourceBundleFactory
is used in internationalized reports to create the resourcebundles holding the localized resources.- Overrides:
getResourceBundleFactory
in classAbstractReportDefinition
- Returns:
- the assigned resource bundle factory.
-
setResourceBundleFactory
public void setResourceBundleFactory(ResourceBundleFactory resourceBundleFactory)
Redefines the resource bundle factory for the report.- Overrides:
setResourceBundleFactory
in classAbstractReportDefinition
- Parameters:
resourceBundleFactory
- the new resource bundle factory, never null.- Throws:
NullPointerException
- if the given ResourceBundleFactory is null.
-
getBundle
public org.pentaho.reporting.libraries.docbundle.DocumentBundle getBundle()
-
setBundle
public void setBundle(org.pentaho.reporting.libraries.docbundle.DocumentBundle bundle)
-
getParameterDefinition
public ReportParameterDefinition getParameterDefinition()
-
setParameterDefinition
public void setParameterDefinition(ReportParameterDefinition parameterDefinition)
-
getModifiableParameterDefinition
public ModifiableReportParameterDefinition getModifiableParameterDefinition()
-
getReportEnvironment
public ReportEnvironment getReportEnvironment()
-
setReportEnvironment
public void setReportEnvironment(ReportEnvironment reportEnvironment)
-
getTitle
public String getTitle()
-
getPageDefinition
public PageDefinition getPageDefinition()
Returns the logical page definition for this report.- Returns:
- the page definition.
-
setPageDefinition
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 theConfiguration
key "org.pentaho.reporting.engine.classic.core.NoPrinterAvailable" to "false" and JFreeReport will use a hardcoded default page format instead.- Parameters:
format
- the default format (null
permitted).
-
getDataFactory
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 classAbstractReportDefinition
- Returns:
- the data factory.
-
setDataFactory
public void setDataFactory(DataFactory dataFactory)
Sets the data factory for the report.- Specified by:
setDataFactory
in classAbstractReportDefinition
- Parameters:
dataFactory
- the data factory for the report, never null.
-
clone
public MasterReport clone()
Clones the report.- Specified by:
clone
in interfaceDataTarget
- Overrides:
clone
in classAbstractReportDefinition
- Returns:
- the clone.
-
derive
public MasterReport derive(boolean preserveElementInstanceIds)
Description copied from class:Element
Creates a deep copy of this element and regenerates all instance-ids.- Overrides:
derive
in classAbstractReportDefinition
- Parameters:
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.- Returns:
- the copy of the element.
-
getReportConfiguration
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.- Returns:
- the report configuration.
-
getConfiguration
public org.pentaho.reporting.libraries.base.config.Configuration getConfiguration()
Returns the report's configuration.- Returns:
- the configuration.
-
getResourceManager
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 classAbstractReportDefinition
- Returns:
- the resource manager, never null.
-
setResourceManager
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.- Parameters:
resourceManager
- the new resource manager or null.
-
getParameterValues
public ReportParameterValues getParameterValues()
-
updateChangedFlagInternal
protected void updateChangedFlagInternal(ReportElement element, int type, Object parameter)
Description copied from class:Element
Updates the change flag and notifies the parent, if this element has a parent.- Overrides:
updateChangedFlagInternal
in classElement
- Parameters:
element
- the element that caused the notification.type
- the notification type.parameter
- the optional parameter further describing the event.
-
getCompatibilityLevel
public Integer getCompatibilityLevel()
-
setCompatibilityLevel
public void setCompatibilityLevel(Integer level)
-
updateLegacyConfiguration
public void updateLegacyConfiguration()
-
getStyleDefinition
public ElementStyleDefinition getStyleDefinition()
-
setStyleDefinition
public void setStyleDefinition(ElementStyleDefinition styleDefinition)
-
getStyleSheetReference
public org.pentaho.reporting.libraries.resourceloader.ResourceKey getStyleSheetReference()
-
setStyleSheetReference
public void setStyleSheetReference(org.pentaho.reporting.libraries.resourceloader.ResourceKey styleSheetReference)
-
getContentCacheKey
public String getContentCacheKey()
-
setContentCacheKey
public void setContentCacheKey(String contentCacheKey)
-
isStrictLegacyMode
public boolean isStrictLegacyMode()
-
setStrictLegacyMode
public void setStrictLegacyMode(boolean strict)
-
getMasterReport
public ReportDefinition getMasterReport()
Description copied from class:Element
Returns the master-report element. This will be a MasterReport while outside of the report processing. Inside the report processing (when called from a report-definition contained in a report-state), this will be a ReportDefinitionImpl.- Overrides:
getMasterReport
in classElement
- Returns:
- the master report.
-
-