Package net.sf.jasperreports.engine.fill
Class JRFillSubreport
- java.lang.Object
-
- net.sf.jasperreports.engine.fill.JRFillElement
-
- net.sf.jasperreports.engine.fill.JRFillSubreport
-
- All Implemented Interfaces:
Cloneable,DynamicPropertiesHolder,JRFillCloneable,JRChild,JRCloneable,JRCommonElement,JRElement,JRIdentifiable,JRPropertiesHolder,JRStyleContainer,JRStyleSetter,JRSubreport,JRVisitable
- Direct Known Subclasses:
ComponentFillSubreport
public class JRFillSubreport extends JRFillElement implements JRSubreport
- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description static StringEXCEPTION_MESSAGE_KEY_NO_REWINDABLE_DATA_SOURCEstatic StringEXCEPTION_MESSAGE_KEY_PROPERTY_NOT_SETstatic StringEXCEPTION_MESSAGE_KEY_UNKNOWN_SOURCE_CLASSstatic StringEXCEPTION_MESSAGE_KEY_UNSUPPORTED_SECTION_TYPEprotected JRPrintPageprintPagestatic StringPROPERTY_SUBREPORT_GENERATE_RECTANGLEProperty used to specify when rectangle elements should be generated for subreports during the report filling.protected FillerSubreportParentsubFillerParentstatic StringSUBREPORT_GENERATE_RECTANGLE_ALWAYSprotected JRBaseFillersubreportFiller-
Fields inherited from class net.sf.jasperreports.engine.fill.JRFillElement
band, conditionalStylesContainer, currentEvaluation, currentStyle, defaultPopulateTemplateStyle, defaultStyleProvider, delayedEvaluationsMap, dynamicProperties, dynamicTransferProperties, elementGroup, EXCEPTION_MESSAGE_KEY_INVALID_BOOKMARK_LEVEL, expressionEvaluator, exprStyle, fillContainerContext, filler, hasDynamicPopulateTemplateStyle, initStyle, mergedProperties, originProvider, parent, printElementOriginator, printWhenGroupChanges, propertyExpressions, providerStyle, staticProperties, staticTransferProperties, styleProviders, templates
-
Fields inherited from interface net.sf.jasperreports.engine.JRElement
PROPERTY_ELEMENT_TEMPLATE_POPULATE_STYLE
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedJRFillSubreport(JRBaseFiller filler, JRSubreport subreport, JRFillObjectFactory factory)protectedJRFillSubreport(JRFillSubreport subreport, JRFillCloneFactory factory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcancelSubreportFill()voidcollectExpressions(JRExpressionCollector collector)JRFillCloneablecreateClone(JRFillCloneFactory factory)Creates a working clone of itself.protected JRTemplateElementcreateElementTemplate()protected DatasetExpressionEvaluatorcreateEvaluator()protected FillerSubreportParentcreateFillerParent(DatasetExpressionEvaluator evaluator)protected voidevaluate(byte evaluation)protected Map<String,Object>evaluateParameterValues(byte evaluation)protected JasperReportSourceevaluateReportSource(byte evaluation)protected voidevaluateSubreport(byte evaluation)protected voidevictReportEvaluator()protected JRPrintElementfill()protected voidfillSubreport()protected StringgenerateRectangleOption()JRExpressiongetConnectionExpression()protected intgetContentsStretchHeight()JRExpressiongetDataSourceExpression()JRExpressiongetExpression()protected JRTemplateRectanglegetJRTemplateRectangle()ModeEnumgetModeValue()Returns the element transparency mode.OverflowTypegetOverflowType()JRSubreportParameter[]getParameters()JRExpressiongetParametersMapExpression()static Map<String,Object>getParameterValues(BaseReportFiller filler, JRFillExpressionEvaluator expressionEvaluator, JRExpression parametersMapExpression, JRDatasetParameter[] subreportParameters, byte evaluation, boolean ignoreNullExpressions, boolean removeResourceBundle, boolean removeFormatFactory)Utility method used for constructing a parameter values map for subreports, sub datasets and crosstabs.static Map<String,Object>getParameterValues(BaseReportFiller filler, JRExpression parametersMapExpression, JRDatasetParameter[] subreportParameters, byte evaluation, boolean ignoreNullExpressions, boolean removeResourceBundle, boolean removeFormatFactory)Utility method used for constructing a parameter values map for subreports, sub datasets and crosstabs.protected intgetPrintContentsWidth()protected Collection<JRPrintElement>getPrintElements()protected JasperReportgetReport()protected StringgetReportLocation()protected StringgetReportName()static JasperReportSourcegetReportSource(Object source, Boolean isUsingCache, BaseReportFiller filler)JRSubreportReturnValue[]getReturnValues()Returns the list of subreport copied values.protected JRSubreportRunnerFactorygetRunnerFactory()BooleangetUsingCache()Indicates if the engine is loading the current subreport from cache.protected voidinitSubreportFiller(DatasetExpressionEvaluator evaluator)protected booleanisReorderBandElements()BooleanisRunToBottom()Specifies whether the subreport element will consume the entire vertical space available on the report page.protected booleanisSplitTypePreventInhibited(boolean isTopLevelCall)static JasperReportloadReport(Object source, BaseReportFiller filler)protected DatasetExpressionEvaluatorloadReportEvaluator()protected static JasperReportSourceloadReportSource(Object reportSource, String contextLocation, BaseReportFiller filler)protected booleanprepare(int availableHeight, boolean isOverflow)protected voidregisterReportStyles(List<JRStyle> styles)protected voidresolveElement(JRPrintElement element, byte evaluation)Resolves an element.voidrewind()protected voidsetBand(JRFillBand band)voidsetOverflowType(OverflowType overflowType)voidsetRunToBottom(Boolean runToBottom)Sets the flag that Specifies whether the subreport element will consume the entire vertical space available on the report page.voidsetUsingCache(Boolean isUsingCache)Specifies if the engine should be loading the current subreport from cache.voidsubreportPageFilled()booleanusingCache()protected voidvalidateReport()protected voidverifyBandHeights()voidvisit(JRVisitor visitor)-
Methods inherited from class net.sf.jasperreports.engine.fill.JRFillElement
_moveDependantElements, _stretchElement, _stretchElementToHeight, addDependantElement, addDynamicProperty, clone, clone, clone, collectDelayedEvaluations, collectDelayedEvaluations, collectDelayedEvaluations, collectStyleDelayedEvaluations, collectStyleProviderDelayedEvaluations, delayedEvaluate, delayedEvaluationUpdatesTemplate, evaluateExpression, evaluatePrintWhenExpression, evaluateProperties, evaluateStyle, getBackcolor, getBand, getBookmarkLevel, getCollapsedHeightAbove, getCollapsedHeightBelow, getConditionalStylesContainer, getDefaultStyleProvider, getDependantElements, getDynamicProperties, getElementGroup, getElementOrigin, getElementTemplate, getEvaluatedProperties, getEvaluationTimeValue, getField, getFiller, getForecolor, getGroupElements, getHeight, getInitStyle, getKey, getOwnBackcolor, getOwnForecolor, getOwnModeValue, getParent, getParentProperties, getPositionTypeValue, getPrepareHeight, getPrintWhenExpression, getPrintWhenGroupChanges, getPropertiesMap, getPropertyExpressions, getRelativeY, getStretchHeight, getStretchTypeValue, getStyle, getStyleExpression, getStyleNameReference, getStyleResolver, getTemplate, getTimeZone, getUUID, getVariable, getWidth, getX, getY, hasDynamicProperties, hasDynamicProperty, hasProperties, initDelayedEvaluationPrint, initDelayedEvaluations, initStyleProviders, isAlreadyPrinted, isAutoEvaluateNow, isDelayedStyleEvaluation, isEvaluateAuto, isEvaluateNow, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isPrintWhenExpressionNull, isPrintWhenTrue, isRemoveLineWhenBlank, isReprinted, isToPrint, isValueRepeating, moveDependantElements, performDelayedEvaluation, registerTemplate, reset, resolveElement, setAlreadyPrinted, setBackcolor, setCollapsedHeightAbove, setCollapsedHeightBelow, setConditionalStylesContainer, setCurrentEvaluation, setExpressionEvaluator, setForecolor, setHeight, setMode, setOriginProvider, setPositionType, setPrepareHeight, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setPrintWhenExpressionNull, setPrintWhenTrue, setRelativeY, setRemoveLineWhenBlank, setReprinted, setShrinkable, setStretchHeight, setStretchType, setStyle, setStyleNameReference, setToPrint, setValueRepeating, setWidth, setX, setY, stretchElement, stretchElementToContainer, stretchElementToElementGroup, stretchElementToHeight, stretchHeightFinal, toPopulateTemplateStyle, transferProperties, transferProperties
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.jasperreports.engine.JRCloneable
clone
-
Methods inherited from interface net.sf.jasperreports.engine.JRCommonElement
getBackcolor, getForecolor, getHeight, getOwnBackcolor, getOwnForecolor, getOwnModeValue, getWidth, setBackcolor, setForecolor, setMode
-
Methods inherited from interface net.sf.jasperreports.engine.JRElement
clone, getElementGroup, getKey, getPositionTypeValue, getPrintWhenExpression, getPrintWhenGroupChanges, getPropertyExpressions, getStretchTypeValue, getStyleExpression, getX, getY, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isRemoveLineWhenBlank, setPositionType, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setRemoveLineWhenBlank, setStretchType, setWidth, setX
-
Methods inherited from interface net.sf.jasperreports.engine.JRIdentifiable
getUUID
-
Methods inherited from interface net.sf.jasperreports.engine.JRPropertiesHolder
getParentProperties, getPropertiesMap, hasProperties
-
Methods inherited from interface net.sf.jasperreports.engine.JRStyleContainer
getDefaultStyleProvider, getStyle, getStyleNameReference
-
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_PROPERTY_NOT_SET
public static final String EXCEPTION_MESSAGE_KEY_PROPERTY_NOT_SET
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_NO_REWINDABLE_DATA_SOURCE
public static final String EXCEPTION_MESSAGE_KEY_NO_REWINDABLE_DATA_SOURCE
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_UNSUPPORTED_SECTION_TYPE
public static final String EXCEPTION_MESSAGE_KEY_UNSUPPORTED_SECTION_TYPE
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_UNKNOWN_SOURCE_CLASS
public static final String EXCEPTION_MESSAGE_KEY_UNKNOWN_SOURCE_CLASS
- See Also:
- Constant Field Values
-
PROPERTY_SUBREPORT_GENERATE_RECTANGLE
public static final String PROPERTY_SUBREPORT_GENERATE_RECTANGLE
Property used to specify when rectangle elements should be generated for subreports during the report filling. If the property value isalways, rectangle elements will be always generated, otherwise they will be created only if the subreport element is not transparent or it has properties- See Also:
- Constant Field Values
-
SUBREPORT_GENERATE_RECTANGLE_ALWAYS
public static final String SUBREPORT_GENERATE_RECTANGLE_ALWAYS
- See Also:
- Constant Field Values
-
subreportFiller
protected JRBaseFiller subreportFiller
-
subFillerParent
protected FillerSubreportParent subFillerParent
-
printPage
protected JRPrintPage printPage
-
-
Constructor Detail
-
JRFillSubreport
protected JRFillSubreport(JRBaseFiller filler, JRSubreport subreport, JRFillObjectFactory factory)
-
JRFillSubreport
protected JRFillSubreport(JRFillSubreport subreport, JRFillCloneFactory factory)
-
-
Method Detail
-
setBand
protected void setBand(JRFillBand band)
- Overrides:
setBandin classJRFillElement
-
getModeValue
public ModeEnum getModeValue()
Description copied from interface:JRCommonElementReturns the element transparency mode. The default value depends on the type of the report element. Graphic elements like rectangles and lines are opaque by default, but the images are transparent. Both static texts and text fields are transparent by default, and so are the subreport elements.- Specified by:
getModeValuein interfaceJRCommonElement- Overrides:
getModeValuein classJRFillElement
-
usingCache
public boolean usingCache()
-
isRunToBottom
public Boolean isRunToBottom()
Description copied from interface:JRSubreportSpecifies whether the subreport element will consume the entire vertical space available on the report page.- Specified by:
isRunToBottomin interfaceJRSubreport- Returns:
- whether the subreport element will consume the entire space down to the bottom of the page
- See Also:
JRSubreport.setRunToBottom(Boolean)
-
setRunToBottom
public void setRunToBottom(Boolean runToBottom)
Description copied from interface:JRSubreportSets the flag that Specifies whether the subreport element will consume the entire vertical space available on the report page.This flag should be set to
trueif the subreport needs to always print its column and page footers at the bottom of the report page, even when the subreport data does not stretch to the bottom.Note that when
isFloatColumnFooteris set for the subreport, the column footers will not be printed at the bottom of the page even if this flag is set.- Specified by:
setRunToBottomin interfaceJRSubreport- Parameters:
runToBottom- whether the subreport element will consume the entire space down to the bottom of the page
-
getOverflowType
public OverflowType getOverflowType()
- Specified by:
getOverflowTypein interfaceJRSubreport
-
setOverflowType
public void setOverflowType(OverflowType overflowType)
- Specified by:
setOverflowTypein interfaceJRSubreport
-
getParametersMapExpression
public JRExpression getParametersMapExpression()
- Specified by:
getParametersMapExpressionin interfaceJRSubreport
-
getParameters
public JRSubreportParameter[] getParameters()
- Specified by:
getParametersin interfaceJRSubreport
-
getConnectionExpression
public JRExpression getConnectionExpression()
- Specified by:
getConnectionExpressionin interfaceJRSubreport
-
getDataSourceExpression
public JRExpression getDataSourceExpression()
- Specified by:
getDataSourceExpressionin interfaceJRSubreport
-
getExpression
public JRExpression getExpression()
- Specified by:
getExpressionin interfaceJRSubreport
-
getJRTemplateRectangle
protected JRTemplateRectangle getJRTemplateRectangle()
-
createElementTemplate
protected JRTemplateElement createElementTemplate()
- Specified by:
createElementTemplatein classJRFillElement
-
getPrintElements
protected Collection<JRPrintElement> getPrintElements()
-
getPrintContentsWidth
protected int getPrintContentsWidth()
-
subreportPageFilled
public void subreportPageFilled()
-
evaluate
protected void evaluate(byte evaluation) throws JRException- Specified by:
evaluatein classJRFillElement- Throws:
JRException
-
evaluateReportSource
protected JasperReportSource evaluateReportSource(byte evaluation) throws JRException
- Throws:
JRException
-
getReportSource
public static JasperReportSource getReportSource(Object source, Boolean isUsingCache, BaseReportFiller filler) throws JRException
- Throws:
JRException
-
loadReportSource
protected static JasperReportSource loadReportSource(Object reportSource, String contextLocation, BaseReportFiller filler) throws JRException
- Throws:
JRException
-
loadReport
public static JasperReport loadReport(Object source, BaseReportFiller filler) throws JRException
- Throws:
JRException
-
evaluateSubreport
protected void evaluateSubreport(byte evaluation) throws JRException- Throws:
JRException
-
getReport
protected JasperReport getReport()
-
evaluateParameterValues
protected Map<String,Object> evaluateParameterValues(byte evaluation) throws JRException
- Throws:
JRException
-
loadReportEvaluator
protected DatasetExpressionEvaluator loadReportEvaluator() throws JRException
- Throws:
JRException
-
evictReportEvaluator
protected void evictReportEvaluator()
-
createEvaluator
protected DatasetExpressionEvaluator createEvaluator() throws JRException
- Throws:
JRException
-
isReorderBandElements
protected boolean isReorderBandElements()
-
initSubreportFiller
protected void initSubreportFiller(DatasetExpressionEvaluator evaluator) throws JRException
- Throws:
JRException
-
createFillerParent
protected FillerSubreportParent createFillerParent(DatasetExpressionEvaluator evaluator) throws JRException
- Throws:
JRException
-
getParameterValues
public static Map<String,Object> getParameterValues(BaseReportFiller filler, JRExpression parametersMapExpression, JRDatasetParameter[] subreportParameters, byte evaluation, boolean ignoreNullExpressions, boolean removeResourceBundle, boolean removeFormatFactory) throws JRException
Utility method used for constructing a parameter values map for subreports, sub datasets and crosstabs.- Parameters:
filler- report fillerparametersMapExpression- expression that yields bulk parameter values mapsubreportParameters- list of individual parameter valuesevaluation- evaluation typeignoreNullExpressions- whether to ignore individual parameter value expressionsremoveResourceBundle- whether to remove theREPORT_RESOURCE_BUNDLEvalue from the bulk values map- Returns:
- the parameter values map
- Throws:
JRException
-
getParameterValues
public static Map<String,Object> getParameterValues(BaseReportFiller filler, JRFillExpressionEvaluator expressionEvaluator, JRExpression parametersMapExpression, JRDatasetParameter[] subreportParameters, byte evaluation, boolean ignoreNullExpressions, boolean removeResourceBundle, boolean removeFormatFactory) throws JRException
Utility method used for constructing a parameter values map for subreports, sub datasets and crosstabs.- Parameters:
filler- report fillerexpressionEvaluator- expression evaluatorparametersMapExpression- expression that yields bulk parameter values mapsubreportParameters- list of individual parameter valuesevaluation- evaluation typeignoreNullExpressions- whether to ignore individual parameter value expressionsremoveResourceBundle- whether to remove theREPORT_RESOURCE_BUNDLEvalue from the bulk values map- Returns:
- the parameter values map
- Throws:
JRException
-
fillSubreport
@continuable protected void fillSubreport() throws JRException- Throws:
JRException
-
prepare
protected boolean prepare(int availableHeight, boolean isOverflow) throws JRException- Overrides:
preparein classJRFillElement- Throws:
JRException
-
rewind
public void rewind() throws JRException- Specified by:
rewindin classJRFillElement- Throws:
JRException
-
cancelSubreportFill
protected void cancelSubreportFill() throws JRException- Throws:
JRException
-
fill
protected JRPrintElement fill()
- Specified by:
fillin classJRFillElement
-
generateRectangleOption
protected String generateRectangleOption()
-
collectExpressions
public void collectExpressions(JRExpressionCollector collector)
- Specified by:
collectExpressionsin interfaceJRElement
-
visit
public void visit(JRVisitor visitor)
- Specified by:
visitin interfaceJRVisitable
-
getReturnValues
public JRSubreportReturnValue[] getReturnValues()
Description copied from interface:JRSubreportReturns the list of subreport copied values.- Specified by:
getReturnValuesin interfaceJRSubreport- Returns:
- the list of subreport copied values.
-
validateReport
protected void validateReport() throws JRException- Throws:
JRException
-
verifyBandHeights
protected void verifyBandHeights() throws JRException- Throws:
JRException
-
resolveElement
protected void resolveElement(JRPrintElement element, byte evaluation)
Description copied from class:JRFillElementResolves an element.- Specified by:
resolveElementin classJRFillElement- Parameters:
element- the elementevaluation- the evaluation type
-
getUsingCache
public Boolean getUsingCache()
Description copied from interface:JRSubreportIndicates if the engine is loading the current subreport from cache. Implementations of this method return the actual value for the internal flag that was explicitly set on this subreport.- Specified by:
getUsingCachein interfaceJRSubreport- Returns:
- Boolean.TRUE if the subreport should be loaded from cache, Boolean.FALSE otherwise or null in case the flag was never explicitly set on this subreport element
-
setUsingCache
public void setUsingCache(Boolean isUsingCache)
Description copied from interface:JRSubreportSpecifies if the engine should be loading the current subreport from cache. If set to Boolean.TRUE, the reporting engine will try to recognize previously loaded subreports using their specified source. For example, it will recognize an subreport if the subreport source is a file name that it has already loaded, or if it is the same URL.If set to null, the engine will rely on some default value which depends on the type of the subreport expression. The cache is turned on by default only for subreports that have java.lang.String objects in their expressions.
- Specified by:
setUsingCachein interfaceJRSubreport
-
createClone
public JRFillCloneable createClone(JRFillCloneFactory factory)
Description copied from interface:JRFillCloneableCreates a working clone of itself.- Specified by:
createClonein interfaceJRFillCloneable- Parameters:
factory- the clone factory to use while creating the clone- Returns:
- a working clone of itself
-
getRunnerFactory
protected JRSubreportRunnerFactory getRunnerFactory() throws JRException
- Throws:
JRException
-
getContentsStretchHeight
protected int getContentsStretchHeight()
-
getReportLocation
protected String getReportLocation()
-
getReportName
protected String getReportName()
-
isSplitTypePreventInhibited
protected boolean isSplitTypePreventInhibited(boolean isTopLevelCall)
-
-