Class AbstractReportDefinition
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.Element
-
- org.pentaho.reporting.engine.classic.core.Section
-
- org.pentaho.reporting.engine.classic.core.AbstractReportDefinition
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<Element>
,DataTarget
,ReportDefinition
,ReportElement
- Direct Known Subclasses:
MasterReport
,SubReport
public abstract class AbstractReportDefinition extends Section implements ReportDefinition
The AbstractReportDefinition serves as base-implementation for both the SubReport and the global JFreeReport instance. There's no point to subclass this class any further. ReportDefinitions define the query string to "default" by default, change this to reflect the accepted queries in your data-source.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.pentaho.reporting.engine.classic.core.Element
ANONYMOUS_ELEMENT_PREFIX
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractReportDefinition()
Creates a new instance.protected
AbstractReportDefinition(InstanceID id)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addExpression(Expression function)
Adds a function to the report's collection of expressions.void
addGroup(CrosstabGroup group)
Adds a crosstab group.void
addGroup(RelationalGroup group)
Adds a group to the report.void
addPreProcessor(ReportPreProcessor preProcessor)
void
addReportModelListener(ReportModelListener listener)
void
addStructureFunction(StructureFunction function)
Adds a structural function to the report.AbstractReportDefinition
clone()
Clones the report.AbstractReportDefinition
derive(boolean preserveElementInstanceIds)
Creates a deep copy of this element and regenerates all instance-ids.void
fireModelLayoutChanged(ReportElement node, int type, Object parameter)
Boolean
getAutoSort()
org.pentaho.reporting.libraries.resourceloader.ResourceKey
getContentBase()
Returns the content base of this report.CrosstabCellBody
getCrosstabCellBody()
abstract DataFactory
getDataFactory()
Returns the data factory that has been assigned to this report.DataSchemaDefinition
getDataSchemaDefinition()
long
getDatasourceChangeTracker()
ElementStyleSheet
getDefaultStyleSheet()
Creates the global stylesheet for this element type.org.pentaho.reporting.libraries.resourceloader.ResourceKey
getDefinitionSource()
Returns the resource-key of the file that defined this element.DetailsFooter
getDetailsFooter()
Returns the details header band.DetailsHeader
getDetailsHeader()
Returns the details header band.Element
getElement(int index)
Returns the element stored add the given index.int
getElementCount()
Returns the number of elements in this section.ExpressionCollection
getExpressions()
Returns the expressions for the report.Group
getGroup(int groupIndex)
Returns the group at the specified index or null, if there is no such group.RelationalGroup
getGroupByName(String name)
Searches a group by its defined name.int
getGroupCount()
Returns the number of groups in this report.ItemBand
getItemBand()
Returns the report's item band.NoDataBand
getNoDataBand()
Returns the report's no-data band.long
getNonVisualsChangeTracker()
PageFooter
getPageFooter()
Returns the page footer.PageHeader
getPageHeader()
Returns the page header.ReportPreProcessor
getPreProcessor(int index)
int
getPreProcessorCount()
ReportPreProcessor[]
getPreProcessors()
String
getQuery()
Returns a new query or query-name that is used when retrieving the data from the data-factory.int
getQueryLimit()
int
getQueryTimeout()
RelationalGroup
getRelationalGroup(int groupIndex)
ReportDefinition
getReportDefinition()
Returns the currently assigned report definition.ReportFooter
getReportFooter()
Returns the page footer.ReportHeader
getReportHeader()
Returns the report header.ResourceBundleFactory
getResourceBundleFactory()
Deprecated.abstract org.pentaho.reporting.libraries.resourceloader.ResourceManager
getResourceManager()
Deprecated.Group
getRootGroup()
Returns the list of groups for the report.StructureFunction
getStructureFunction(int index)
Returns the structure function at the given position.int
getStructureFunctionCount()
Returns the number of structural functions added to the report.StructureFunction[]
getStructureFunctions()
Returns a copy of all structure functions contained in the report.int
getUserQueryLimit()
Watermark
getWatermark()
Returns the report's watermark band.boolean
isQueryLimitInherited()
protected void
removeElement(Element element)
Removes an element from the section.void
removeExpression(Expression expression)
void
removeGroup(CrosstabGroup group)
void
removeGroup(RelationalGroup deleteGroup)
void
removePreProcessor(ReportPreProcessor preProcessor)
void
removeReportModelListener(ReportModelListener listener)
void
removeStructureFunction(StructureFunction f)
Removes the given function from the collection of structure functions.void
setAutoSort(Boolean sort)
void
setContentBase(org.pentaho.reporting.libraries.resourceloader.ResourceKey key)
Defines the content base for the report.abstract void
setDataFactory(DataFactory dataFactory)
Sets the data factory for the report.void
setDataSchemaDefinition(DataSchemaDefinition dataSchemaDefinition)
void
setDefinitionSource(org.pentaho.reporting.libraries.resourceloader.ResourceKey key)
void
setElementAt(int position, Element element)
void
setExpressions(ExpressionCollection expressions)
Sets the expressions for the report.void
setPageFooter(PageFooter footer)
Sets the page footer.void
setPageHeader(PageHeader header)
Sets the page header.void
setQuery(String query)
Defines a new query or query-name that is used when retrieving the data from the data-factory.void
setQueryLimit(int queryLimit)
void
setQueryLimitInheritance(boolean queryLimitInheritance)
void
setQueryTimeout(int queryTimeout)
void
setReportFooter(ReportFooter footer)
Sets the report footer.void
setReportHeader(ReportHeader header)
Sets the report header.void
setResourceBundleFactory(ResourceBundleFactory resourceBundleFactory)
Deprecated.void
setRootGroup(Group rootGroup)
void
setUserQueryLimit(int queryLimit)
void
setWatermark(Watermark band)
Sets the watermark band for the report.-
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, getMasterReport, 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, updateChangedFlagInternal, 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.ReportDefinition
getPageDefinition
-
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
-
-
-
-
Constructor Detail
-
AbstractReportDefinition
protected AbstractReportDefinition(InstanceID id)
-
AbstractReportDefinition
protected AbstractReportDefinition()
Creates a new instance. This initializes all properties to their defaults - especially for subreports you have to set sensible values before you can use them later.
-
-
Method Detail
-
getResourceBundleFactory
@Deprecated public ResourceBundleFactory getResourceBundleFactory()
Deprecated.Returns the resource bundle factory for this report definition. TheResourceBundleFactory
is used in internationalized reports to create the resourcebundles holding the localized resources.- Returns:
- the assigned resource bundle factory.
-
setResourceBundleFactory
@Deprecated public void setResourceBundleFactory(ResourceBundleFactory resourceBundleFactory)
Deprecated.Redefines the resource bundle factory for the report.- Parameters:
resourceBundleFactory
- the new resource bundle factory, never null.- Throws:
NullPointerException
- if the given ResourceBundleFactory is null.
-
getPreProcessorCount
public int getPreProcessorCount()
-
getPreProcessors
public ReportPreProcessor[] getPreProcessors()
-
getPreProcessor
public ReportPreProcessor getPreProcessor(int index)
-
addPreProcessor
public void addPreProcessor(ReportPreProcessor preProcessor)
-
removePreProcessor
public void removePreProcessor(ReportPreProcessor preProcessor)
-
getRootGroup
public Group getRootGroup()
Description copied from interface:ReportDefinition
Returns the list of groups for the report.- Specified by:
getRootGroup
in interfaceReportDefinition
- Returns:
- The list of groups.
-
setRootGroup
public void setRootGroup(Group rootGroup)
-
setReportHeader
public void setReportHeader(ReportHeader header)
Sets the report header.- Parameters:
header
- the report header (null
not permitted).
-
getReportHeader
public ReportHeader getReportHeader()
Returns the report header.- Specified by:
getReportHeader
in interfaceReportDefinition
- Returns:
- the report header (never
null
).
-
setReportFooter
public void setReportFooter(ReportFooter footer)
Sets the report footer.- Parameters:
footer
- the report footer (null
not permitted).
-
getReportFooter
public ReportFooter getReportFooter()
Returns the page footer.- Specified by:
getReportFooter
in interfaceReportDefinition
- Returns:
- the report footer (never
null
).
-
setPageHeader
public void setPageHeader(PageHeader header)
Sets the page header.- Parameters:
header
- the page header (null
not permitted).
-
getPageHeader
public PageHeader getPageHeader()
Returns the page header.- Specified by:
getPageHeader
in interfaceReportDefinition
- Returns:
- the page header (never
null
).
-
setPageFooter
public void setPageFooter(PageFooter footer)
Sets the page footer.- Parameters:
footer
- the page footer (null
not permitted).
-
getPageFooter
public PageFooter getPageFooter()
Returns the page footer.- Specified by:
getPageFooter
in interfaceReportDefinition
- Returns:
- the page footer (never
null
).
-
setWatermark
public void setWatermark(Watermark band)
Sets the watermark band for the report.- Parameters:
band
- the new watermark band (null
not permitted).
-
getWatermark
public Watermark getWatermark()
Returns the report's watermark band.- Specified by:
getWatermark
in interfaceReportDefinition
- Returns:
- the watermark band (never
null
).
-
getNoDataBand
public NoDataBand getNoDataBand()
Returns the report's no-data band.- Specified by:
getNoDataBand
in interfaceReportDefinition
- Returns:
- the no-data band (never
null
).
-
getItemBand
public ItemBand getItemBand()
Returns the report's item band.- Specified by:
getItemBand
in interfaceReportDefinition
- Returns:
- the item band (never
null
).
-
getDetailsHeader
public DetailsHeader getDetailsHeader()
Returns the details header band.- Specified by:
getDetailsHeader
in interfaceReportDefinition
- Returns:
- The details header band.
-
getDetailsFooter
public DetailsFooter getDetailsFooter()
Returns the details header band.- Specified by:
getDetailsFooter
in interfaceReportDefinition
- Returns:
- The details header band.
-
addGroup
public void addGroup(RelationalGroup group)
Adds a group to the report. This replaces the group body on the group with a new data-group-body composed of the existing itemband and no-databand.- Parameters:
group
- the group.
-
addGroup
public void addGroup(CrosstabGroup group)
Adds a crosstab group. This replaces any existing crosstabs and all the details sections.- Parameters:
group
-
-
removeGroup
public void removeGroup(CrosstabGroup group)
-
removeGroup
public void removeGroup(RelationalGroup deleteGroup)
-
getGroupCount
public int getGroupCount()
Returns the number of groups in this report.Every report has at least one group defined.
- Specified by:
getGroupCount
in interfaceReportDefinition
- Returns:
- the group count.
-
getRelationalGroup
public RelationalGroup getRelationalGroup(int groupIndex)
-
getGroup
public Group getGroup(int groupIndex)
Returns the group at the specified index or null, if there is no such group.- Specified by:
getGroup
in interfaceReportDefinition
- Parameters:
groupIndex
- the group index.- Returns:
- the requested group.
- Throws:
IllegalArgumentException
- if the count is negative.IndexOutOfBoundsException
- if the count is greater than the number of defined groups.
-
getGroupByName
public RelationalGroup getGroupByName(String name)
Searches a group by its defined name. This method returns null, if the group was not found.- Parameters:
name
- the name of the group.- Returns:
- the group or null if not found.
-
addExpression
public void addExpression(Expression function)
Adds a function to the report's collection of expressions.- Parameters:
function
- the function.
-
getQueryTimeout
public int getQueryTimeout()
- Specified by:
getQueryTimeout
in interfaceReportDefinition
-
setQueryTimeout
public void setQueryTimeout(int queryTimeout)
-
getQueryLimit
public int getQueryLimit()
- Specified by:
getQueryLimit
in interfaceReportDefinition
-
setQueryLimit
public void setQueryLimit(int queryLimit)
-
setQueryLimitInheritance
public void setQueryLimitInheritance(boolean queryLimitInheritance)
-
isQueryLimitInherited
public boolean isQueryLimitInherited()
-
getUserQueryLimit
public int getUserQueryLimit()
-
setUserQueryLimit
public void setUserQueryLimit(int queryLimit)
-
getQuery
public String getQuery()
Returns a new query or query-name that is used when retrieving the data from the data-factory.- Specified by:
getQuery
in interfaceReportDefinition
- Returns:
- the query-string.
-
setQuery
public void setQuery(String query)
Defines a new query or query-name that is used when retrieving the data from the data-factory.- Parameters:
query
- the query-string.- See Also:
DataFactory.queryData(String, DataRow)
-
getExpressions
public ExpressionCollection getExpressions()
Returns the expressions for the report. When adding or removing expressions on the list, make sure to call "notifyStructureChanged" afterwards when in design-mode.- Returns:
- the expressions.
-
setExpressions
public void setExpressions(ExpressionCollection expressions)
Sets the expressions for the report.- Parameters:
expressions
- the expressions (null
not permitted).
-
clone
public AbstractReportDefinition clone()
Clones the report.- Specified by:
clone
in interfaceDataTarget
- Overrides:
clone
in classSection
- Returns:
- the clone.
-
derive
public AbstractReportDefinition derive(boolean preserveElementInstanceIds)
Description copied from class:Element
Creates a deep copy of this element and regenerates all instance-ids.- Overrides:
derive
in classSection
- 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.
-
setElementAt
public void setElementAt(int position, Element element)
- Specified by:
setElementAt
in classSection
-
removeElement
protected void removeElement(Element element)
Description copied from class:Section
Removes an element from the section.- Specified by:
removeElement
in classSection
- Parameters:
element
- the element to be section.
-
getElementCount
public int getElementCount()
Description copied from class:Section
Returns the number of elements in this section.- Specified by:
getElementCount
in classSection
- Returns:
- the number of elements of this section.
-
getElement
public Element getElement(int index)
Description copied from class:Section
Returns the element stored add the given index.- Specified by:
getElement
in classSection
- Parameters:
index
- the element position within this section- Returns:
- the element
-
setContentBase
public void setContentBase(org.pentaho.reporting.libraries.resourceloader.ResourceKey key)
Defines the content base for the report. The content base will be used to resolve relative URLs during the report generation and resource loading. If there is no content base defined, it will be impossible to resolve relative paths.- Parameters:
key
- the content base or null.
-
getContentBase
public org.pentaho.reporting.libraries.resourceloader.ResourceKey getContentBase()
Returns the content base of this report. The content base is used to resolve relative URLs during the report generation and resource loading. If there is no content base defined, it will be impossible to resolve relative paths.- Overrides:
getContentBase
in classElement
- Returns:
- the content base or null, if no content base is defined.
-
setDefinitionSource
public void setDefinitionSource(org.pentaho.reporting.libraries.resourceloader.ResourceKey key)
-
getDefinitionSource
public org.pentaho.reporting.libraries.resourceloader.ResourceKey getDefinitionSource()
Description copied from class:Element
Returns the resource-key of the file that defined this element. This method may return null if the whole report was created in memory.- Overrides:
getDefinitionSource
in classElement
- Returns:
- the the definition source.
-
getReportDefinition
public ReportDefinition getReportDefinition()
Returns the currently assigned report definition.- Specified by:
getReportDefinition
in interfaceReportElement
- Overrides:
getReportDefinition
in classElement
- Returns:
- the report definition or null, if no report has been assigned.
-
getDataFactory
public abstract DataFactory getDataFactory()
Returns the data factory that has been assigned to this report. The data factory will never be null.- Returns:
- the data factory.
-
setDataFactory
public abstract void setDataFactory(DataFactory dataFactory)
Sets the data factory for the report.- Parameters:
dataFactory
- the data factory for the report, never null.
-
addReportModelListener
public void addReportModelListener(ReportModelListener listener)
-
removeReportModelListener
public void removeReportModelListener(ReportModelListener listener)
-
fireModelLayoutChanged
public void fireModelLayoutChanged(ReportElement node, int type, Object parameter)
-
getDatasourceChangeTracker
public long getDatasourceChangeTracker()
-
getNonVisualsChangeTracker
public long getNonVisualsChangeTracker()
-
removeExpression
public void removeExpression(Expression expression)
-
getDataSchemaDefinition
public DataSchemaDefinition getDataSchemaDefinition()
-
setDataSchemaDefinition
public void setDataSchemaDefinition(DataSchemaDefinition dataSchemaDefinition)
-
getResourceManager
@Deprecated public abstract org.pentaho.reporting.libraries.resourceloader.ResourceManager getResourceManager()
Deprecated.This method has only meaning for master-reports. This handle will be removed in the next majore release.- Returns:
-
addStructureFunction
public void addStructureFunction(StructureFunction function)
Adds a structural function to the report. Structural functions perform content preparation and maintainance operations before elements are layouted or printed. Structural function can live on their own processing level and are evaluated after the user expressions but before the layout expressions have been evaluated.- Parameters:
function
- the structure function.
-
getStructureFunctionCount
public int getStructureFunctionCount()
Returns the number of structural functions added to the report.- Returns:
- the function count.
-
getStructureFunction
public StructureFunction getStructureFunction(int index)
Returns the structure function at the given position.- Parameters:
index
- the position of the function in the list.- Returns:
- the function, never null.
- Throws:
IndexOutOfBoundsException
- if the index is invalid.
-
removeStructureFunction
public void removeStructureFunction(StructureFunction f)
Removes the given function from the collection of structure functions. This removes only the first occurence of the function, in case a function has been added twice.- Parameters:
f
- the function to be removed.
-
getStructureFunctions
public StructureFunction[] getStructureFunctions()
Returns a copy of all structure functions contained in the report. Modifying the function instances will not alter the functions contained in the report.- Returns:
- the functions.
-
getDefaultStyleSheet
public ElementStyleSheet getDefaultStyleSheet()
Description copied from class:Section
Creates the global stylesheet for this element type. The global stylesheet is an immutable stylesheet that provides reasonable default values for some of the style keys. The global default stylesheet is always the last stylesheet that will be queried for values.- Specified by:
getDefaultStyleSheet
in interfaceReportElement
- Overrides:
getDefaultStyleSheet
in classSection
- Returns:
- the global stylesheet.
-
getCrosstabCellBody
public CrosstabCellBody getCrosstabCellBody()
- Specified by:
getCrosstabCellBody
in interfaceReportDefinition
-
setAutoSort
public void setAutoSort(Boolean sort)
-
getAutoSort
public Boolean getAutoSort()
-
-