net.sf.jasperreports.engine.fill
Class JRFillSubreport

java.lang.Object
  extended by net.sf.jasperreports.engine.fill.JRFillElement
      extended by net.sf.jasperreports.engine.fill.JRFillSubreport
All Implemented Interfaces:
java.lang.Cloneable, JRFillCloneable, JRChild, JRCloneable, JRCommonElement, JRElement, JRIdentifiable, JRPropertiesHolder, JRStyleContainer, JRStyleSetter, JRSubreport, JRVisitable
Direct Known Subclasses:
FillTableSubreport

public class JRFillSubreport
extends JRFillElement
implements JRSubreport

Version:
$Id: JRFillSubreport.java 5340 2012-05-04 10:41:48Z lucianc $
Author:
Teodor Danciu (teodord@users.sourceforge.net)

Field Summary
protected  JRBaseFiller subreportFiller
           
 
Fields inherited from class net.sf.jasperreports.engine.fill.JRFillElement
band, conditionalStylesContainer, currentEvaluation, currentStyle, defaultStyleProvider, delayedEvaluationsMap, dynamicProperties, elementGroup, elementId, expressionEvaluator, filler, initStyle, mergedProperties, originProvider, parent, printWhenGroupChanges, staticProperties, templates
 
Constructor Summary
protected JRFillSubreport(JRBaseFiller filler, JRSubreport subreport, JRFillObjectFactory factory)
           
 
Method Summary
protected  void cancelSubreportFill()
           
 void collectExpressions(JRExpressionCollector collector)
           
protected  void copyValue(JRFillSubreportReturnValue returnValue)
           
protected  void copyValues()
          Copies the values from the subreport to the variables of the master report.
 JRFillCloneable createClone(JRFillCloneFactory factory)
          Creates a working clone of itself.
protected  JRSubreportReturnValue createDistinctCountHelperReturnValue(JRSubreportReturnValue returnValue)
           
protected  JRTemplateElement createElementTemplate()
           
protected  DatasetExpressionEvaluator createEvaluator()
           
protected  JRSubreportReturnValue createHelperReturnValue(JRSubreportReturnValue returnValue, java.lang.String nameSuffix, CalculationEnum calculation)
           
protected  void evaluate(byte evaluation)
           
protected  java.util.Map<java.lang.String,java.lang.Object> evaluateParameterValues(byte evaluation)
           
protected  JasperReport evaluateReport(byte evaluation)
           
protected  void evaluateSubreport(byte evaluation)
           
protected  JRPrintElement fill()
           
protected  void fillSubreport()
           
 JRExpression getConnectionExpression()
           
protected  int getContentsStretchHeight()
           
 JRExpression getDataSourceExpression()
           
 JRExpression getExpression()
           
protected  JRTemplateRectangle getJRTemplateRectangle()
           
 ModeEnum getModeValue()
          Returns the element transparency mode.
 JRSubreportParameter[] getParameters()
           
 JRExpression getParametersMapExpression()
           
static java.util.Map<java.lang.String,java.lang.Object> getParameterValues(JRBaseFiller 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.
static java.util.Map<java.lang.String,java.lang.Object> getParameterValues(JRBaseFiller 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.
protected  java.util.Collection<JRPrintElement> getPrintElements()
           
 JRSubreportReturnValue[] getReturnValues()
          Returns the list of subreport copied values.
protected  JRSubreportRunnerFactory getRunnerFactory()
           
 java.lang.Boolean getUsingCache()
          Indicates if the engine is loading the current subreport from cache.
protected  void initSubreportFiller(DatasetExpressionEvaluator evaluator)
           
 java.lang.Boolean isOwnUsingCache()
          Deprecated. Replaced by getUsingCache().
 java.lang.Boolean isRunToBottom()
          Specifies whether the subreport element will consume the entire vertical space available on the report page.
 boolean isUsingCache()
          Deprecated. Replaced by getUsingCache().
protected  DatasetExpressionEvaluator loadReportEvaluator()
           
protected  boolean prepare(int availableHeight, boolean isOverflow)
           
protected  void resolveElement(JRPrintElement element, byte evaluation)
          Resolves an element.
 void rewind()
           
protected  void saveReturnVariables()
           
 void setRunToBottom(java.lang.Boolean runToBottom)
          Sets the flag that Specifies whether the subreport element will consume the entire vertical space available on the report page.
 void setUsingCache(java.lang.Boolean isUsingCache)
          Specifies if the engine should be loading the current subreport from cache.
 void subreportPageFilled()
           
 boolean usesForReturnValue(java.lang.String variableName)
           
 boolean usingCache()
           
protected  void validateReport()
           
protected  void verifyBandHeights()
           
 void visit(JRVisitor visitor)
           
 
Methods inherited from class net.sf.jasperreports.engine.fill.JRFillElement
addDependantElement, clone, clone, collectDelayedEvaluations, collectDelayedEvaluations, collectDelayedEvaluations, collectStyleDelayedEvaluations, delayedEvaluate, evaluateExpression, evaluatePrintWhenExpression, evaluateProperties, getBackcolor, getBand, getDefaultStyleProvider, getDependantElements, getElementGroup, getElementOrigin, getElementTemplate, getEvaluatedProperties, getEvaluationTimeValue, getField, getForecolor, getGroupElements, getHeight, getKey, getOwnBackcolor, getOwnForecolor, getOwnModeValue, getParentProperties, getPositionTypeValue, getPrintWhenExpression, getPrintWhenGroupChanges, getPropertiesMap, getPropertyExpressions, getRelativeY, getStretchHeight, getStretchTypeValue, getStyle, getStyleNameReference, getTemplate, getUUID, getVariable, getWidth, getX, getY, hasProperties, initDelayedEvaluationPrint, initDelayedEvaluations, isAlreadyPrinted, isAutoEvaluateNow, isDelayedStyleEvaluation, isEvaluateAuto, isEvaluateNow, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isPrintWhenExpressionNull, isPrintWhenTrue, isRemoveLineWhenBlank, isReprinted, isToPrint, isValueRepeating, moveDependantElements, performDelayedEvaluation, registerTemplate, reset, resolveElement, setAlreadyPrinted, setBackcolor, setBand, setConditionalStylesContainer, setCurrentEvaluation, setForecolor, setHeight, setMode, setOriginProvider, setPositionType, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setPrintWhenExpressionNull, setPrintWhenTrue, setRelativeY, setRemoveLineWhenBlank, setReprinted, setShrinkable, setStretchHeight, setStretchType, setStyle, setStyleNameReference, setToPrint, setValueRepeating, setWidth, setX, setY, stretchElement, stretchHeightFinal, 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.JRElement
getElementGroup, getKey, getPositionTypeValue, getPrintWhenExpression, getPrintWhenGroupChanges, getPropertyExpressions, getStretchTypeValue, getX, getY, isPrintInFirstWholeBand, isPrintRepeatedValues, isPrintWhenDetailOverflows, isRemoveLineWhenBlank, setPositionType, setPrintInFirstWholeBand, setPrintRepeatedValues, setPrintWhenDetailOverflows, setRemoveLineWhenBlank, setStretchType, setWidth, setX
 
Methods inherited from interface net.sf.jasperreports.engine.JRChild
clone
 
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.JRStyleContainer
getDefaultStyleProvider, getStyle, getStyleNameReference
 
Methods inherited from interface net.sf.jasperreports.engine.JRIdentifiable
getUUID
 
Methods inherited from interface net.sf.jasperreports.engine.JRPropertiesHolder
getParentProperties, getPropertiesMap, hasProperties
 

Field Detail

subreportFiller

protected JRBaseFiller subreportFiller
Constructor Detail

JRFillSubreport

protected JRFillSubreport(JRBaseFiller filler,
                          JRSubreport subreport,
                          JRFillObjectFactory factory)
Method Detail

getModeValue

public ModeEnum getModeValue()
Description copied from interface: JRCommonElement
Returns 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:
getModeValue in interface JRCommonElement
Overrides:
getModeValue in class JRFillElement

isUsingCache

public boolean isUsingCache()
Deprecated. Replaced by getUsingCache().

Description copied from interface: JRSubreport
Indicates if the engine is loading the current subreport from cache. Implementations of this method rely on default values that depend on the type of the subreport expression if a value was not explicitly set of this flag.

Specified by:
isUsingCache in interface JRSubreport
Returns:
true if the subreport should be loaded from cache, false otherwise

usingCache

public boolean usingCache()

isRunToBottom

public java.lang.Boolean isRunToBottom()
Description copied from interface: JRSubreport
Specifies whether the subreport element will consume the entire vertical space available on the report page.

Specified by:
isRunToBottom in interface JRSubreport
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(java.lang.Boolean runToBottom)
Description copied from interface: JRSubreport
Sets 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 true if 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 isFloatColumnFooter is 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:
setRunToBottom in interface JRSubreport
Parameters:
runToBottom - whether the subreport element will consume the entire space down to the bottom of the page

getParametersMapExpression

public JRExpression getParametersMapExpression()
Specified by:
getParametersMapExpression in interface JRSubreport

getParameters

public JRSubreportParameter[] getParameters()
Specified by:
getParameters in interface JRSubreport

getConnectionExpression

public JRExpression getConnectionExpression()
Specified by:
getConnectionExpression in interface JRSubreport

getDataSourceExpression

public JRExpression getDataSourceExpression()
Specified by:
getDataSourceExpression in interface JRSubreport

getExpression

public JRExpression getExpression()
Specified by:
getExpression in interface JRSubreport

getJRTemplateRectangle

protected JRTemplateRectangle getJRTemplateRectangle()

createElementTemplate

protected JRTemplateElement createElementTemplate()
Specified by:
createElementTemplate in class JRFillElement

getPrintElements

protected java.util.Collection<JRPrintElement> getPrintElements()

subreportPageFilled

public void subreportPageFilled()

evaluate

protected void evaluate(byte evaluation)
                 throws JRException
Specified by:
evaluate in class JRFillElement
Throws:
JRException

evaluateReport

protected JasperReport evaluateReport(byte evaluation)
                               throws JRException
Throws:
JRException

evaluateSubreport

protected void evaluateSubreport(byte evaluation)
                          throws JRException
Throws:
JRException

evaluateParameterValues

protected java.util.Map<java.lang.String,java.lang.Object> evaluateParameterValues(byte evaluation)
                                                                            throws JRException
Throws:
JRException

loadReportEvaluator

protected DatasetExpressionEvaluator loadReportEvaluator()
                                                  throws JRException
Throws:
JRException

createEvaluator

protected DatasetExpressionEvaluator createEvaluator()
                                              throws JRException
Throws:
JRException

initSubreportFiller

protected void initSubreportFiller(DatasetExpressionEvaluator evaluator)
                            throws JRException
Throws:
JRException

saveReturnVariables

protected void saveReturnVariables()

getParameterValues

public static java.util.Map<java.lang.String,java.lang.Object> getParameterValues(JRBaseFiller 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 filler
parametersMapExpression - expression that yields bulk parameter values map
subreportParameters - list of individual parameter values
evaluation - evaluation type
ignoreNullExpressions - whether to ignore individual parameter value expressions
removeResourceBundle - whether to remove the REPORT_RESOURCE_BUNDLE value from the bulk values map
Returns:
the parameter values map
Throws:
JRException

getParameterValues

public static java.util.Map<java.lang.String,java.lang.Object> getParameterValues(JRBaseFiller 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 filler
expressionEvaluator - expression evaluator
parametersMapExpression - expression that yields bulk parameter values map
subreportParameters - list of individual parameter values
evaluation - evaluation type
ignoreNullExpressions - whether to ignore individual parameter value expressions
removeResourceBundle - whether to remove the REPORT_RESOURCE_BUNDLE value from the bulk values map
Returns:
the parameter values map
Throws:
JRException

fillSubreport

protected void fillSubreport()
                      throws JRException
Throws:
JRException

prepare

protected boolean prepare(int availableHeight,
                          boolean isOverflow)
                   throws JRException
Overrides:
prepare in class JRFillElement
Throws:
JRException

rewind

public void rewind()
            throws JRException
Specified by:
rewind in class JRFillElement
Throws:
JRException

cancelSubreportFill

protected void cancelSubreportFill()
                            throws JRException
Throws:
JRException

fill

protected JRPrintElement fill()
Specified by:
fill in class JRFillElement

collectExpressions

public void collectExpressions(JRExpressionCollector collector)
Specified by:
collectExpressions in interface JRElement

visit

public void visit(JRVisitor visitor)
Specified by:
visit in interface JRVisitable

createHelperReturnValue

protected JRSubreportReturnValue createHelperReturnValue(JRSubreportReturnValue returnValue,
                                                         java.lang.String nameSuffix,
                                                         CalculationEnum calculation)

createDistinctCountHelperReturnValue

protected JRSubreportReturnValue createDistinctCountHelperReturnValue(JRSubreportReturnValue returnValue)

getReturnValues

public JRSubreportReturnValue[] getReturnValues()
Description copied from interface: JRSubreport
Returns the list of subreport copied values.

Specified by:
getReturnValues in interface JRSubreport
Returns:
the list of subreport copied values.

usesForReturnValue

public boolean usesForReturnValue(java.lang.String variableName)

copyValues

protected void copyValues()
Copies the values from the subreport to the variables of the master report.


copyValue

protected void copyValue(JRFillSubreportReturnValue returnValue)

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: JRFillElement
Resolves an element.

Specified by:
resolveElement in class JRFillElement
Parameters:
element - the element
evaluation - the evaluation type

isOwnUsingCache

public java.lang.Boolean isOwnUsingCache()
Deprecated. Replaced by getUsingCache().

Description copied from interface: JRSubreport
Indicates 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:
isOwnUsingCache in interface JRSubreport
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

getUsingCache

public java.lang.Boolean getUsingCache()
Description copied from interface: JRSubreport
Indicates 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:
getUsingCache in interface JRSubreport
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(java.lang.Boolean isUsingCache)
Description copied from interface: JRSubreport
Specifies 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:
setUsingCache in interface JRSubreport

createClone

public JRFillCloneable createClone(JRFillCloneFactory factory)
Description copied from interface: JRFillCloneable
Creates a working clone of itself.

Specified by:
createClone in interface JRFillCloneable
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()


© 2001-2010 Jaspersoft Corporation www.jaspersoft.com