net.sf.jasperreports.engine.fill
Class JRBaseFiller

java.lang.Object
  extended by net.sf.jasperreports.engine.fill.JRBaseFiller
All Implemented Interfaces:
JRVirtualPrintPage.IdentityDataProvider, JRDefaultFontProvider, JRDefaultStyleProvider
Direct Known Subclasses:
JRHorizontalFiller, JRVerticalFiller

public abstract class JRBaseFiller
extends java.lang.Object
implements JRDefaultStyleProvider, JRVirtualPrintPage.IdentityDataProvider

Version:
$Id: JRBaseFiller.java 2087 2008-02-12 14:53:19Z teodord $
Author:
Teodor Danciu (teodord@users.sourceforge.net)

Nested Class Summary
 class JRBaseFiller.BoundElementMap
          Map class to be used for bound elements.
protected static interface JRBaseFiller.DefaultStyleListener
           
protected static class JRBaseFiller.PageIdentityDataProvider
           
 
Field Summary
protected  JRFillBand background
           
protected  java.util.List bands
          List of JRFillBand objects containing all bands of the report.
protected  int bottomMargin
           
protected  java.util.Map boundElements
          Bound element maps indexed by JREvaluationTime objects.
protected  JRCalculator calculator
           
protected  int columnCount
           
protected  JRFillBand columnFooter
           
protected  int columnFooterOffsetY
           
protected  JRFillBand columnHeader
           
protected  int columnHeaderOffsetY
           
protected  int columnIndex
           
protected  int columnSpacing
           
protected  int columnWidth
           
protected  java.util.Map datasetMap
          Map of datasets (JRFillDataset objects} indexed by name.
protected  java.util.Map dateFormatCache
           
protected  JRReportFont defaultFont
           
protected  JRStyle defaultStyle
           
protected  JRFillBand detail
           
protected  FileResolver fileResolver
           
protected  JRFillContext fillContext
           
protected  java.lang.String fillerId
           
protected  JRReportFont[] fonts
           
protected  FormatFactory formatFactory
           
protected  JRFillGroup[] groups
           
protected  boolean isCreatingNewPage
           
protected  boolean isFirstColumnBand
           
protected  boolean isFirstPageBand
           
protected  boolean isFloatColumnFooter
           
protected  boolean isLastPageFooter
           
protected  boolean isNewColumn
           
protected  boolean isNewGroup
           
protected  boolean isNewPage
           
protected  boolean isPerPageBoundElements
           
protected  boolean isSummaryNewPage
           
protected  boolean isTitleNewPage
           
protected  JasperPrint jasperPrint
           
protected  JasperReport jasperReport
          The report.
protected  int lastPageColumnFooterOffsetY
           
protected  JRFillBand lastPageFooter
           
protected  int leftMargin
           
protected  JRFillDataset mainDataset
          Main report dataset.
protected  JRFillBand missingFillBand
           
protected  java.lang.String name
           
protected  JRFillBand noData
           
protected  java.util.Map numberFormatCache
           
protected  int offsetX
           
protected  int offsetY
           
protected  byte orientation
           
protected  JRFillBand pageFooter
           
protected  JRFillBand pageHeader
           
protected  int pageHeight
           
protected  int pageWidth
           
protected  JRBaseFiller parentFiller
           
protected  byte printOrder
           
protected  JRPrintPage printPage
           
protected  int printPageStretchHeight
           
protected  java.lang.ClassLoader reportClassLoader
           
protected  JRFillReportTemplate[] reportTemplates
           
protected  int rightMargin
           
protected  JRAbstractScriptlet scriptlet
           
protected  JRStyle[] styles
           
protected  java.util.Set subfillers
          Collection of subfillers
protected  JRFillBand summary
           
protected  JRFillBand title
           
protected  int topMargin
           
protected  java.net.URLStreamHandlerFactory urlHandlerFactory
           
protected  JRVirtualizer virtualizer
           
protected  byte whenNoDataType
           
protected  byte whenResourceMissingType
          the resource missing handling type
 
Constructor Summary
protected JRBaseFiller(JasperReport jasperReport, JREvaluator initEvaluator, JRBaseFiller parentFiller)
           
 
Method Summary
protected  void addBoundElement(JRFillElement element, JRPrintElement printElement, byte evaluationType, JRGroup group, JRFillBand band)
           
protected  void addBoundElement(JRFillElement element, JRPrintElement printElement, JREvaluationTime evaluationTime)
           
protected  void addDefaultStyleListener(JRBaseFiller.DefaultStyleListener listener)
           
protected  void addPage(JRPrintPage page)
           
protected  void addPageIdentityDataProvider()
           
protected  void addPrintStyle(JRStyle style)
           
protected  void addVariableCalculationReq(java.lang.String variableName, byte calculation)
          Adds a variable calculation request.
 void cancelFill()
          Cancells the fill process.
protected  void collectIncludedTemplates(JRTemplate template, java.util.List externalStyles, java.util.Set loadedLocations)
           
protected  java.util.List collectStyles()
           
protected  void collectStyles(JRTemplate template, java.util.List externalStyles, java.util.Set loadedLocations)
           
protected  java.util.List collectTemplateStyles()
           
protected  void createReportTemplates(JRFillObjectFactory factory)
           
protected  java.lang.Object evaluateExpression(JRExpression expression, byte evaluation)
          Evaluates an expression
 JasperPrint fill(java.util.Map parameterValues)
           
 JasperPrint fill(java.util.Map parameterValues, java.sql.Connection conn)
           
 JasperPrint fill(java.util.Map parameterValues, JRDataSource ds)
           
protected abstract  void fillReport()
           
protected  JRPrintPage getCurrentPage()
           
protected  int getCurrentPageStretchHeight()
           
protected  java.text.Format getDateFormat(java.lang.String pattern)
           
 JRReportFont getDefaultFont()
          Returns a default font.
 JRStyle getDefaultStyle()
          Returns a default style.
protected  JRFillField getField(java.lang.String fieldName)
          Returns a report field.
protected  java.util.Map getFieldsMap()
          Returns the report fields indexed by name.
protected  JRReportFont[] getFonts()
           
protected  FormatFactory getFormatFactory()
          Returns the report format factory.
 JRVirtualPrintPage.ObjectIDPair[] getIdentityData(JRVirtualPrintPage page)
          Collect all of the identity data the the JRBaseFiller needs to know.
 JasperPrint getJasperPrint()
           
protected  JasperReport getJasperReport()
          Returns the report.
protected  java.util.Locale getLocale()
          Returns the report locale.
 JRFillDataset getMainDataset()
           
protected  int getMasterColumnCount()
           
protected  java.text.Format getNumberFormat(java.lang.String pattern)
           
protected  java.util.Map getParametersMap()
          Returns the report parameters indexed by name.
 JRStyledTextParser getStyledTextParser()
           
protected  java.util.TimeZone getTimeZone()
          Returns the report time zone.
protected  JRFillVariable getVariable(java.lang.String variableName)
          Returns a report variable.
protected  java.util.Map getVariablesMap()
          Returns the report variables indexed by name.
 java.lang.Object getVariableValue(java.lang.String variableName)
          Returns the value of a variable.
protected  byte getWhenResourceMissingType()
           
protected  boolean hasMasterFormatFactory()
           
protected  boolean hasMasterLocale()
           
protected  boolean hasMasterTimeZone()
           
protected  boolean isBandOverFlowAllowed()
           
protected  boolean isInterrupted()
           
protected  boolean isSubreport()
           
protected  void loadStyles()
           
protected  void lookupExternalDefaultStyle(java.util.Collection styleList)
           
protected  JRPrintPage newPage()
           
protected  boolean next()
           
protected  void registerSubfiller(JRBaseFiller subfiller)
           
protected  void removePageIdentityDataProvider()
           
protected  void resolveBandBoundElements(JRFillBand band, byte evaluation)
          Resloves elements which are to be evaluated at band level.
protected  void resolveBoundElements(JREvaluationTime evaluationTime, byte evaluation)
           
protected  void resolveColumnBoundElements(byte evaluation)
          Resolves elements which are to be evaluated at column level.
protected  void resolveGroupBoundElements(byte evaluation, boolean isFinal)
          Resolves elements which are to be evaluated at group level.
protected  void resolvePageBoundElements(byte evaluation)
          Resolves elements which are to be evaluated at page level.
protected  void resolveReportBoundElements()
          Resolves elements which are to be evaluated at report level.
protected  void setBandOverFlowAllowed(boolean splittableBand)
           
protected  void setConnectionParameterValue(java.util.Map parameterValues, java.sql.Connection conn)
           
protected  void setDatasourceParameterValue(java.util.Map parameterValues, JRDataSource ds)
           
protected  void setDefaultStyle(JRStyle style)
           
 void setIdentityData(JRVirtualPrintPage page, JRVirtualPrintPage.ObjectIDPair[] identityData)
          Sets the identity date for a virtualized page.
protected  void setInterrupted(boolean isInterrupted)
           
protected abstract  void setPageHeight(int pageHeight)
           
protected  void setParameter(JRFillParameter parameter, java.lang.Object value)
          Sets a parameter's value.
protected  void setParameter(java.lang.String parameterName, java.lang.Object value)
          Sets a parameter's value.
protected  void setParameters(java.util.Map parameterValues)
           
protected  void setSubreportRunner(JRSubreportRunner runner)
           
protected  void suspendSubreportRunner()
           
protected  void unregisterSubfiller(JRBaseFiller subfiller)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fillerId

protected final java.lang.String fillerId

parentFiller

protected JRBaseFiller parentFiller

name

protected java.lang.String name

columnCount

protected int columnCount

printOrder

protected byte printOrder

pageWidth

protected int pageWidth

pageHeight

protected int pageHeight

orientation

protected byte orientation

whenNoDataType

protected byte whenNoDataType

columnWidth

protected int columnWidth

columnSpacing

protected int columnSpacing

leftMargin

protected int leftMargin

rightMargin

protected int rightMargin

topMargin

protected int topMargin

bottomMargin

protected int bottomMargin

isTitleNewPage

protected boolean isTitleNewPage

isSummaryNewPage

protected boolean isSummaryNewPage

isFloatColumnFooter

protected boolean isFloatColumnFooter

whenResourceMissingType

protected byte whenResourceMissingType
the resource missing handling type


reportTemplates

protected JRFillReportTemplate[] reportTemplates

defaultFont

protected JRReportFont defaultFont

fonts

protected JRReportFont[] fonts

defaultStyle

protected JRStyle defaultStyle

styles

protected JRStyle[] styles

mainDataset

protected JRFillDataset mainDataset
Main report dataset.


groups

protected JRFillGroup[] groups

missingFillBand

protected JRFillBand missingFillBand

background

protected JRFillBand background

title

protected JRFillBand title

pageHeader

protected JRFillBand pageHeader

columnHeader

protected JRFillBand columnHeader

detail

protected JRFillBand detail

columnFooter

protected JRFillBand columnFooter

pageFooter

protected JRFillBand pageFooter

lastPageFooter

protected JRFillBand lastPageFooter

summary

protected JRFillBand summary

noData

protected JRFillBand noData

virtualizer

protected JRVirtualizer virtualizer

reportClassLoader

protected java.lang.ClassLoader reportClassLoader

formatFactory

protected FormatFactory formatFactory

urlHandlerFactory

protected java.net.URLStreamHandlerFactory urlHandlerFactory

fileResolver

protected FileResolver fileResolver

fillContext

protected JRFillContext fillContext

boundElements

protected java.util.Map boundElements
Bound element maps indexed by JREvaluationTime objects.


jasperPrint

protected JasperPrint jasperPrint

printPage

protected JRPrintPage printPage

printPageStretchHeight

protected int printPageStretchHeight

bands

protected java.util.List bands
List of JRFillBand objects containing all bands of the report.


subfillers

protected java.util.Set subfillers
Collection of subfillers


calculator

protected JRCalculator calculator

scriptlet

protected JRAbstractScriptlet scriptlet

datasetMap

protected java.util.Map datasetMap
Map of datasets (JRFillDataset objects} indexed by name.


jasperReport

protected JasperReport jasperReport
The report.


isPerPageBoundElements

protected boolean isPerPageBoundElements

dateFormatCache

protected java.util.Map dateFormatCache

numberFormatCache

protected java.util.Map numberFormatCache

isCreatingNewPage

protected boolean isCreatingNewPage

isNewPage

protected boolean isNewPage

isNewColumn

protected boolean isNewColumn

isNewGroup

protected boolean isNewGroup

isFirstPageBand

protected boolean isFirstPageBand

isFirstColumnBand

protected boolean isFirstColumnBand

columnIndex

protected int columnIndex

offsetX

protected int offsetX

offsetY

protected int offsetY

columnHeaderOffsetY

protected int columnHeaderOffsetY

columnFooterOffsetY

protected int columnFooterOffsetY

lastPageColumnFooterOffsetY

protected int lastPageColumnFooterOffsetY

isLastPageFooter

protected boolean isLastPageFooter
Constructor Detail

JRBaseFiller

protected JRBaseFiller(JasperReport jasperReport,
                       JREvaluator initEvaluator,
                       JRBaseFiller parentFiller)
                throws JRException
Throws:
JRException
Method Detail

getParametersMap

protected java.util.Map getParametersMap()
Returns the report parameters indexed by name.

Returns:
the report parameters map

getFieldsMap

protected java.util.Map getFieldsMap()
Returns the report fields indexed by name.

Returns:
the report fields map

getVariablesMap

protected java.util.Map getVariablesMap()
Returns the report variables indexed by name.

Returns:
the report variables map

getVariable

protected JRFillVariable getVariable(java.lang.String variableName)
Returns a report variable.

Parameters:
variableName - the variable name
Returns:
the variable

getField

protected JRFillField getField(java.lang.String fieldName)
Returns a report field.

Parameters:
fieldName - the field name
Returns:
the field

getStyledTextParser

public JRStyledTextParser getStyledTextParser()

getJasperPrint

public JasperPrint getJasperPrint()

getDefaultFont

public JRReportFont getDefaultFont()
Description copied from interface: JRDefaultFontProvider
Returns a default font.

Specified by:
getDefaultFont in interface JRDefaultFontProvider

getDefaultStyle

public JRStyle getDefaultStyle()
Description copied from interface: JRDefaultStyleProvider
Returns a default style.

Specified by:
getDefaultStyle in interface JRDefaultStyleProvider

isSubreport

protected boolean isSubreport()

isInterrupted

protected boolean isInterrupted()

setInterrupted

protected void setInterrupted(boolean isInterrupted)

getCurrentPage

protected JRPrintPage getCurrentPage()

getFonts

protected JRReportFont[] getFonts()

getCurrentPageStretchHeight

protected int getCurrentPageStretchHeight()

setPageHeight

protected abstract void setPageHeight(int pageHeight)

fill

public JasperPrint fill(java.util.Map parameterValues,
                        java.sql.Connection conn)
                 throws JRException
Throws:
JRException

setConnectionParameterValue

protected void setConnectionParameterValue(java.util.Map parameterValues,
                                           java.sql.Connection conn)

fill

public JasperPrint fill(java.util.Map parameterValues,
                        JRDataSource ds)
                 throws JRException
Throws:
JRException

setDatasourceParameterValue

protected void setDatasourceParameterValue(java.util.Map parameterValues,
                                           JRDataSource ds)

fill

public JasperPrint fill(java.util.Map parameterValues)
                 throws JRException
Throws:
JRException

addPrintStyle

protected void addPrintStyle(JRStyle style)
                      throws JRException
Throws:
JRException

addDefaultStyleListener

protected void addDefaultStyleListener(JRBaseFiller.DefaultStyleListener listener)

setDefaultStyle

protected void setDefaultStyle(JRStyle style)

loadStyles

protected void loadStyles()
                   throws JRException
Throws:
JRException

collectStyles

protected java.util.List collectStyles()
                                throws JRException
Throws:
JRException

collectTemplateStyles

protected java.util.List collectTemplateStyles()
                                        throws JRException
Throws:
JRException

collectStyles

protected void collectStyles(JRTemplate template,
                             java.util.List externalStyles,
                             java.util.Set loadedLocations)
                      throws JRException
Throws:
JRException

collectIncludedTemplates

protected void collectIncludedTemplates(JRTemplate template,
                                        java.util.List externalStyles,
                                        java.util.Set loadedLocations)
                                 throws JRException
Throws:
JRException

lookupExternalDefaultStyle

protected void lookupExternalDefaultStyle(java.util.Collection styleList)

fillReport

protected abstract void fillReport()
                            throws JRException
Throws:
JRException

setParameters

protected void setParameters(java.util.Map parameterValues)
                      throws JRException
Throws:
JRException

getLocale

protected java.util.Locale getLocale()
Returns the report locale.

Returns:
the report locale

getTimeZone

protected java.util.TimeZone getTimeZone()
Returns the report time zone.

Returns:
the report time zone

getFormatFactory

protected FormatFactory getFormatFactory()
Returns the report format factory.

Returns:
the report format factory

getDateFormat

protected java.text.Format getDateFormat(java.lang.String pattern)

getNumberFormat

protected java.text.Format getNumberFormat(java.lang.String pattern)

hasMasterFormatFactory

protected boolean hasMasterFormatFactory()

hasMasterLocale

protected boolean hasMasterLocale()

hasMasterTimeZone

protected boolean hasMasterTimeZone()

setParameter

protected void setParameter(java.lang.String parameterName,
                            java.lang.Object value)
                     throws JRException
Sets a parameter's value.

Parameters:
parameterName - the parameter name
value - the value
Throws:
JRException

setParameter

protected void setParameter(JRFillParameter parameter,
                            java.lang.Object value)
                     throws JRException
Sets a parameter's value.

Parameters:
parameter - the parameter
value - the value
Throws:
JRException

next

protected boolean next()
                throws JRException
Throws:
JRException

resolveBoundElements

protected void resolveBoundElements(JREvaluationTime evaluationTime,
                                    byte evaluation)
                             throws JRException
Throws:
JRException

resolveReportBoundElements

protected void resolveReportBoundElements()
                                   throws JRException
Resolves elements which are to be evaluated at report level.

Throws:
JRException

resolvePageBoundElements

protected void resolvePageBoundElements(byte evaluation)
                                 throws JRException
Resolves elements which are to be evaluated at page level.

Parameters:
evaluation - the evaluation type
Throws:
JRException

resolveColumnBoundElements

protected void resolveColumnBoundElements(byte evaluation)
                                   throws JRException
Resolves elements which are to be evaluated at column level.

Parameters:
evaluation - the evaluation type
Throws:
JRException

resolveGroupBoundElements

protected void resolveGroupBoundElements(byte evaluation,
                                         boolean isFinal)
                                  throws JRException
Resolves elements which are to be evaluated at group level.

Parameters:
evaluation - the evaluation type
isFinal -
Throws:
JRException

newPage

protected JRPrintPage newPage()

getVariableValue

public java.lang.Object getVariableValue(java.lang.String variableName)
Returns the value of a variable.

Parameters:
variableName - the variable name
Returns:
the variable value
Throws:
JRRuntimeException - when the variable does not exist

resolveBandBoundElements

protected void resolveBandBoundElements(JRFillBand band,
                                        byte evaluation)
                                 throws JRException
Resloves elements which are to be evaluated at band level.

Parameters:
band - the band
evaluation - the evaluation type
Throws:
JRException

addVariableCalculationReq

protected void addVariableCalculationReq(java.lang.String variableName,
                                         byte calculation)
Adds a variable calculation request.

Parameters:
variableName - the variable name
calculation - the calculation type

cancelFill

public void cancelFill()
                throws JRException
Cancells the fill process.

Throws:
JRException

registerSubfiller

protected void registerSubfiller(JRBaseFiller subfiller)

unregisterSubfiller

protected void unregisterSubfiller(JRBaseFiller subfiller)

addPage

protected void addPage(JRPrintPage page)

addPageIdentityDataProvider

protected void addPageIdentityDataProvider()

removePageIdentityDataProvider

protected void removePageIdentityDataProvider()

evaluateExpression

protected java.lang.Object evaluateExpression(JRExpression expression,
                                              byte evaluation)
                                       throws JRException
Evaluates an expression

Parameters:
expression - the expression
evaluation - the evaluation type
Returns:
the evaluation result
Throws:
JRException

getWhenResourceMissingType

protected byte getWhenResourceMissingType()

getJasperReport

protected JasperReport getJasperReport()
Returns the report.

Returns:
the report

isBandOverFlowAllowed

protected boolean isBandOverFlowAllowed()

setBandOverFlowAllowed

protected void setBandOverFlowAllowed(boolean splittableBand)

getMasterColumnCount

protected int getMasterColumnCount()

getMainDataset

public JRFillDataset getMainDataset()

addBoundElement

protected void addBoundElement(JRFillElement element,
                               JRPrintElement printElement,
                               byte evaluationType,
                               JRGroup group,
                               JRFillBand band)

addBoundElement

protected void addBoundElement(JRFillElement element,
                               JRPrintElement printElement,
                               JREvaluationTime evaluationTime)

getIdentityData

public JRVirtualPrintPage.ObjectIDPair[] getIdentityData(JRVirtualPrintPage page)
Collect all of the identity data the the JRBaseFiller needs to know.

All the bound elements on the page are collected and transformed into identity objects.

Specified by:
getIdentityData in interface JRVirtualPrintPage.IdentityDataProvider
Parameters:
page - the page to get the identity data for

setIdentityData

public void setIdentityData(JRVirtualPrintPage page,
                            JRVirtualPrintPage.ObjectIDPair[] identityData)
Sets the identity date for a virtualized page.

The identity data consists of bound elements located on the page. Pairs of identity hash code and objects are stored when the page is virtualized. When the page gets devirtualized, the original objects are substituted in the bound maps based on their identity hash code.

Specified by:
setIdentityData in interface JRVirtualPrintPage.IdentityDataProvider
Parameters:
page - the virtualized page
identityData - the identity data

setSubreportRunner

protected void setSubreportRunner(JRSubreportRunner runner)

suspendSubreportRunner

protected void suspendSubreportRunner()
                               throws JRException
Throws:
JRException

createReportTemplates

protected void createReportTemplates(JRFillObjectFactory factory)


© 2001-2006 JasperSoft Corporation www.jaspersoft.com