Class SubReport

  • All Implemented Interfaces:
    Serializable, Cloneable, Iterable<Element>, DataTarget, ReportDefinition, ReportElement
    Direct Known Subclasses:

    public class SubReport
    extends AbstractReportDefinition
    A subreport element. A subreport can be attached to a root-level band and will be printed afterwards. Subreports have their own tablemodel (queried with the sub-reports's defined query and the master report's data-factory).

    A sub-report that has been added to a root-level band will always be printed below the root-level band.

    Sub-reports can have import and export parameters. The parameter mapping can be defined freely, so a subreport is not required to use the same column names as the parent report.

    If a global import or export is defined (by adding the parameter mapping "*" => "*") the other defined parameter mappings will be ignored.

    Thomas Morgner
    See Also:
    Serialized Form
    • Constructor Detail

      • SubReport

        public SubReport()
        Creates a new subreport instance.
    • Method Detail

      • getPageDefinition

        public PageDefinition getPageDefinition()
        Returns the page definition assigned to the report definition. The page definition defines the report area and how the report is subdivided by the child pages.
        null, as subreports have no page-definition at all.
      • derive

        public SubReport derive​(boolean preserveElementInstanceIds)
        Clones the report.
        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 clone.
      • reconnectParent

        public void reconnectParent​(Section parentSection)
      • addExportParameter

        public void addExportParameter​(String outerName,
                                       String sourceColumn)
        Adds an export-parameter mapping to the subreport. The parameter specified by 'sourceColumn' will be made available with the name 'outerName' in the parent report.
        outerName - the name the parameter will get in the master report.
        sourceColumn - the source-column in the sub-report.
      • removeExportParameter

        public void removeExportParameter​(String outerName)
        Removes the export parameter from the mapping.
        outerName - the name of the parameter as it is known in the master report.
      • getExportMappings

        public ParameterMapping[] getExportMappings()
        Returns the parameter mappings for the subreport. The parameter mappings define how columns of the sub-report get mapped into the master report.
        the parameter mappings array.
      • setExportMappings

        public void setExportMappings​(ParameterMapping[] mappings)
      • addInputParameter

        public void addInputParameter​(String outerName,
                                      String sourceColumn)
        Adds an input-parameter mapping to the subreport. Input parameters define how columns that exist in the parent report get mapped into the subreport.

        Input parameter mapping happens only once, so after the report has been started, changes to the parameters will not pass through to the subreport.

        outerName - the name of the parent report's column that provides the data.
        sourceColumn - the name under which the parameter will be available in the subreport.
      • removeInputParameter

        public void removeInputParameter​(String sourceColumn)
        Removes the input parameter from the parameter mapping.
        sourceColumn - the name of the column of the subreport report that acts as source for the input parameter.
      • clearInputParameters

        public void clearInputParameters()
      • clearExportParameters

        public void clearExportParameters()
      • getInputMappings

        public ParameterMapping[] getInputMappings()
        Returns the input mappings defined for this subreport.
        the input mappings, never null.
      • setInputMappings

        public void setInputMappings​(ParameterMapping[] mappings)
      • isGlobalImport

        public boolean isGlobalImport()
        Checks whether a global import is defined. A global import effectly overrides all other imports.
        true, if there is a global import defined, false otherwise.
      • isGlobalExport

        public boolean isGlobalExport()
        Checks whether a global export is defined. A global export effectly overrides all other export mappings.
        true, if there is a global export defined, false otherwise.
      • setDataFactory

        public void setDataFactory​(DataFactory dataFactory)
        The (optional) data-factory for the subreport. If no datafactory is defined here, the subreport will use the master report's data-factory.
        Specified by:
        setDataFactory in class AbstractReportDefinition
        dataFactory -
      • getActivationExpression

        public Expression getActivationExpression()
      • setActivationExpression

        public void setActivationExpression​(Expression activationExpression)
      • 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.