Class 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 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):

    • the report header and footer can be reached by using getReportHeader() and getReportFooter()

    • the page header and page footer can be reached by using getPageHeader() and getPageFooter()

    • the item band is reachable with getItemBand()

    • the no-data band is reachable with getNoDataBand()

    • the watermark band is reachable with getWaterMark()

    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 .core.function.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 Detail


        public static final String REPORT_DATE_PROPERTY
        Key for the 'report date' property.
        See Also:
        Constant Field Values
    • Constructor Detail

      • MasterReport

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

      • getBundle

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

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

        public void setReportEnvironment​(ReportEnvironment reportEnvironment)
      • getTitle

        public String getTitle()
      • getPageDefinition

        public PageDefinition getPageDefinition()
        Returns the logical page definition for this report.
        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 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).
      • 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 class AbstractReportDefinition
        the data factory.
      • setDataFactory

        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.
      • derive

        public MasterReport derive​(boolean preserveElementInstanceIds)
        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.
      • 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.

        the report configuration.
      • getConfiguration

        public org.pentaho.reporting.libraries.base.config.Configuration getConfiguration()
        Returns the report's configuration.
        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 class AbstractReportDefinition
        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.
        resourceManager - the new resource manager or null.
      • 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.
        updateChangedFlagInternal in class Element
        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()
      • 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.
        getMasterReport in class Element
        the master report.