net.sf.jasperreports.engine.fill
Class JRFillContext

java.lang.Object
  extended by net.sf.jasperreports.engine.fill.JRFillContext

public class JRFillContext
extends java.lang.Object

Context class shared by all the fillers involved in a report (master and subfillers).

The context is created by the master filler and inherited by the subfillers.

Version:
$Id: JRFillContext.java 5340 2012-05-04 10:41:48Z lucianc $
Author:
Lucian Chirita (lucianc@users.sourceforge.net)
See Also:
JRBaseFiller

Constructor Summary
JRFillContext(JasperReportsContext jasperReportsContext)
          Constructs a fill context.
 
Method Summary
 void addDataRecordResult(FillDatasetPosition fillPosition, java.lang.Object recorded)
           
 void cacheDone()
           
 boolean cancelRunningQuery()
          Cancels the running query.
 void clearRunningQueryExecuter()
          Clears the running query executer.
<T extends Deduplicable>
T
deduplicate(T object)
          Search for a duplicate of a given object in the fill context, and add the object to the context if no duplicate found.
 void ensureMasterPageAvailable()
          Ensures that the master page is available when virtualization is used.
protected  int generatedFillerId()
           
 int generateFillElementId()
          Generates a fresh fill element Id.
 DataCacheHandler getCacheHandler()
           
protected  java.lang.Object getContextParameterValue(java.lang.String parameterName)
           
 DataRecorder getDataRecorder()
           
 DataSnapshot getDataSnapshot()
           
 JRPrintImage getLoadedImage(java.lang.Object source)
          Gets a cached image.
 JasperReport getLoadedSubreport(java.lang.Object source)
          Gets a cached subreport.
 JRTemplate getLoadedTemplate(java.lang.Object source)
          Gets a cached template.
 FormatFactory getMasterFormatFactory()
           
 java.util.Locale getMasterLocale()
           
 java.util.TimeZone getMasterTimeZone()
           
 JRPrintPage getPrintPage()
          Returns the current master print page.
 ReportContext getReportContext()
           
 JRVirtualizationContext getVirtualizationContext()
          Returns the virtualization context.
 boolean hasDataSnapshot()
           
 boolean hasLoadedImage(java.lang.Object source)
          Checks whether an image given by source has already been loaded and cached.
 boolean hasLoadedSubreport(java.lang.Object source)
          Checks whether a subreport given by source has already been loaded and cached.
 boolean hasLoadedTemplate(java.lang.Object source)
          Checks whether a template given by source has already been loaded and cached.
 boolean isIgnorePagination()
          Decides whether the filling should ignore pagination.
 boolean isUsingVirtualizer()
          Decides whether virtualization is used by the filling process.
 void registerLoadedImage(java.lang.Object source, JRPrintImage image)
          Registers an image loaded from a source.
 void registerLoadedSubreport(java.lang.Object source, JasperReport subreport)
          Registers a subreport loaded from a source.
 void registerLoadedTemplate(java.lang.Object source, JRTemplate template)
          Registers a template loaded from a source.
 void setIgnorePagination(boolean ignorePagination)
          Sets the flag that decides whether pagination should be ignored during filling.
 void setMasterFormatFactory(FormatFactory masterFormatFactory)
           
 void setMasterLocale(java.util.Locale masterLocale)
           
 void setMasterTimeZone(java.util.TimeZone masterTimeZone)
           
 void setPrintPage(JRPrintPage page)
          Sets the current master print page.
 void setReportContext(ReportContext reportContext)
           
 void setRunningQueryExecuter(JRQueryExecuter queryExecuter)
          Sets the running query executer.
 void setUsingVirtualizer(boolean usingVirtualizer)
          Sets the flag indicating whether a virtualizer is used by the filling process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JRFillContext

public JRFillContext(JasperReportsContext jasperReportsContext)
Constructs a fill context.

Method Detail

hasLoadedImage

public boolean hasLoadedImage(java.lang.Object source)
Checks whether an image given by source has already been loaded and cached.

Parameters:
source - the source of the image
Returns:
whether the image has been cached
See Also:
getLoadedImage(Object), registerLoadedImage(Object, JRPrintImage)

getLoadedImage

public JRPrintImage getLoadedImage(java.lang.Object source)
Gets a cached image.

Parameters:
source - the source of the image
Returns:
the cached image
See Also:
registerLoadedImage(Object, JRPrintImage)

registerLoadedImage

public void registerLoadedImage(java.lang.Object source,
                                JRPrintImage image)
Registers an image loaded from a source.

The image is cached for further use.

Parameters:
source - the source that was used to load the image
image - the loaded image
See Also:
getLoadedImage(Object)

hasLoadedSubreport

public boolean hasLoadedSubreport(java.lang.Object source)
Checks whether a subreport given by source has already been loaded and cached.

Parameters:
source - the source of the subreport
Returns:
whether the subreport has been cached
See Also:
getLoadedSubreport(Object), registerLoadedSubreport(Object, JasperReport)

getLoadedSubreport

public JasperReport getLoadedSubreport(java.lang.Object source)
Gets a cached subreport.

Parameters:
source - the source of the subreport
Returns:
the cached subreport
See Also:
registerLoadedSubreport(Object, JasperReport)

registerLoadedSubreport

public void registerLoadedSubreport(java.lang.Object source,
                                    JasperReport subreport)
Registers a subreport loaded from a source.

The subreport is cached for further use.

Parameters:
source - the source that was used to load the subreport
subreport - the loaded subreport
See Also:
getLoadedSubreport(Object)

setUsingVirtualizer

public void setUsingVirtualizer(boolean usingVirtualizer)
Sets the flag indicating whether a virtualizer is used by the filling process.

Parameters:
usingVirtualizer - whether virtualization is used
See Also:
isUsingVirtualizer()

isUsingVirtualizer

public boolean isUsingVirtualizer()
Decides whether virtualization is used by the filling process.

Returns:
true if and only if a virtualizer is used
See Also:
setUsingVirtualizer(boolean), JRParameter.REPORT_VIRTUALIZER

setPrintPage

public void setPrintPage(JRPrintPage page)
Sets the current master print page.

Parameters:
page - the master print page
See Also:
getPrintPage()

getPrintPage

public JRPrintPage getPrintPage()
Returns the current master print page.

Returns:
the current master print page
See Also:
setPrintPage(JRPrintPage)

setIgnorePagination

public void setIgnorePagination(boolean ignorePagination)
Sets the flag that decides whether pagination should be ignored during filling.

Parameters:
ignorePagination -
See Also:
isIgnorePagination()

isIgnorePagination

public boolean isIgnorePagination()
Decides whether the filling should ignore pagination.

Returns:
whether the filling should ignore pagination
See Also:
setIgnorePagination(boolean), JRParameter.IS_IGNORE_PAGINATION

setRunningQueryExecuter

public void setRunningQueryExecuter(JRQueryExecuter queryExecuter)
Sets the running query executer.

This method is called before firing the query.

Parameters:
queryExecuter - the running query executer

clearRunningQueryExecuter

public void clearRunningQueryExecuter()
Clears the running query executer.

This method is called after the query has ended.


cancelRunningQuery

public boolean cancelRunningQuery()
                           throws JRException
Cancels the running query.

Returns:
true if and only if there is a running query and it has been canceled.
Throws:
JRException

ensureMasterPageAvailable

public void ensureMasterPageAvailable()
Ensures that the master page is available when virtualization is used.


getVirtualizationContext

public JRVirtualizationContext getVirtualizationContext()
Returns the virtualization context.

Returns:
the virtualization context

getMasterFormatFactory

public FormatFactory getMasterFormatFactory()

setMasterFormatFactory

public void setMasterFormatFactory(FormatFactory masterFormatFactory)

getMasterLocale

public java.util.Locale getMasterLocale()

setMasterLocale

public void setMasterLocale(java.util.Locale masterLocale)

getMasterTimeZone

public java.util.TimeZone getMasterTimeZone()

setMasterTimeZone

public void setMasterTimeZone(java.util.TimeZone masterTimeZone)

hasLoadedTemplate

public boolean hasLoadedTemplate(java.lang.Object source)
Checks whether a template given by source has already been loaded and cached.

Parameters:
source - the source of the template
Returns:
whether the template has been cached
See Also:
getLoadedTemplate(Object), registerLoadedTemplate(Object, JRTemplate)

getLoadedTemplate

public JRTemplate getLoadedTemplate(java.lang.Object source)
Gets a cached template.

Parameters:
source - the source of the templage
Returns:
the cached templage
See Also:
registerLoadedTemplate(Object, JRTemplate)

registerLoadedTemplate

public void registerLoadedTemplate(java.lang.Object source,
                                   JRTemplate template)
Registers a template loaded from a source.

The template is cached for further use.

Parameters:
source - the source that was used to load the template
template - the loaded templage
See Also:
getLoadedTemplate(Object)

deduplicate

public <T extends Deduplicable> T deduplicate(T object)
Search for a duplicate of a given object in the fill context, and add the object to the context if no duplicate found.

Parameters:
object - the object to be searched or added
Returns:
a duplicate of the object if found, or the passed object if not

generateFillElementId

public int generateFillElementId()
Generates a fresh fill element Id. This method is called once by each fill element, and the returned Id is used for the generated print elements.

Returns:
a generated Id for a fill element
See Also:
JRPrintElement.getSourceElementId()

generatedFillerId

protected int generatedFillerId()

getReportContext

public ReportContext getReportContext()

setReportContext

public void setReportContext(ReportContext reportContext)

getContextParameterValue

protected java.lang.Object getContextParameterValue(java.lang.String parameterName)

getCacheHandler

public DataCacheHandler getCacheHandler()

getDataSnapshot

public DataSnapshot getDataSnapshot()

hasDataSnapshot

public boolean hasDataSnapshot()

getDataRecorder

public DataRecorder getDataRecorder()

addDataRecordResult

public void addDataRecordResult(FillDatasetPosition fillPosition,
                                java.lang.Object recorded)

cacheDone

public void cacheDone()


© 2001-2010 Jaspersoft Corporation www.jaspersoft.com