Package net.sf.jasperreports.engine.fill
Class JRFillContext
- java.lang.Object
-
- net.sf.jasperreports.engine.fill.JRFillContext
-
public class JRFillContext extends java.lang.ObjectContext 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.
- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
- See Also:
JRBaseFiller
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceJRFillContext.FillCacheDisposable
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEXCEPTION_MESSAGE_KEY_MISSING_MARKUP_PROCESSOR_FACTORY
-
Constructor Summary
Constructors Constructor Description JRFillContext(BaseReportFiller masterFiller)Constructs a fill context.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddDataRecordResult(FillDatasetPosition fillPosition, java.lang.Object recorded)voidcacheDone()booleancancelRunningQuery()Cancels the running query.voidclearRunningQueryExecuter()Clears the running query executer.<T extends Deduplicable>
Tdeduplicate(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.voiddispose()protected intgeneratedFillerId()intgenerateFillElementId()Generates a fresh fill element Id.DataCacheHandlergetCacheHandler()protected java.lang.ObjectgetContextParameterValue(java.lang.String parameterName)DataRecordergetDataRecorder()DataSnapshotgetDataSnapshot()java.lang.ObjectgetFillCache(java.lang.String key)FillEventsgetFillEvents()RenderablegetLoadedRenderer(java.lang.Object source)Gets a cached image renderer.JasperReportSourcegetLoadedSubreport(java.lang.Object source)Gets a cached subreport.ReportTemplateSourcegetLoadedTemplate(java.lang.Object source)Gets a cached template.protected MarkupProcessorgetMarkupProcessor(java.lang.String markup)BaseReportFillergetMasterFiller()FormatFactorygetMasterFormatFactory()java.util.LocalegetMasterLocale()java.util.TimeZonegetMasterTimeZone()JRPrintPagegetPrintPage()Returns the current master print page.RenderersCachegetRenderersCache()ReportContextgetReportContext()protected JRStyledTextUtilgetStyledTextUtil()JRVirtualizationContextgetVirtualizationContext()Returns the virtualization context.booleanhasDataSnapshot()booleanhasLoadedRenderer(java.lang.Object source)Checks whether an image renderer given by source has already been loaded and cached.booleanhasLoadedSubreport(java.lang.Object source)Checks whether a subreport given by source has already been loaded and cached.booleanhasLoadedTemplate(java.lang.Object source)Checks whether a template given by source has already been loaded and cached.voidinit()booleanisCanceled()booleanisCollectingBookmarks()booleanisIgnorePagination()Decides whether the filling should ignore pagination.booleanisLegacyBandEvaluationEnabled()Deprecated.To be removed.booleanisLegacyElementStretchEnabled()Deprecated.To be removed.booleanisUsingVirtualizer()Decides whether virtualization is used by the filling process.voidlockVirtualizationContext()voidmarkCanceled()voidregisterLoadedRenderer(java.lang.Object source, Renderable renderer)Registers an image renderer loaded from a source.voidregisterLoadedSubreport(java.lang.Object source, JasperReportSource subreport)Registers a subreport loaded from a source.voidregisterLoadedTemplate(java.lang.Object source, ReportTemplateSource templateSource)Registers a template loaded from a source.voidregisterReportStyles(java.lang.String reportLocation, java.util.UUID id, java.util.List<JRStyle> styles)voidregisterReportStyles(JasperReport jasperReport, java.util.UUID id, java.util.List<JRStyle> styles)voidsetDetectParts(boolean detectParts)voidsetFillCache(java.lang.String key, java.lang.Object value)voidsetMasterFormatFactory(FormatFactory masterFormatFactory)voidsetMasterLocale(java.util.Locale masterLocale)voidsetMasterTimeZone(java.util.TimeZone masterTimeZone)voidsetPrintPage(JRPrintPage page)Sets the current master print page.voidsetReportContext(ReportContext reportContext)voidsetRunningQueryExecuter(JRQueryExecuter queryExecuter)Sets the running query executer.voidsetUsingVirtualizer(boolean usingVirtualizer)Sets the flag indicating whether a virtualizer is used by the filling process.booleantoDetectParts()voidunlockVirtualizationContext()
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_MISSING_MARKUP_PROCESSOR_FACTORY
public static final java.lang.String EXCEPTION_MESSAGE_KEY_MISSING_MARKUP_PROCESSOR_FACTORY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JRFillContext
public JRFillContext(BaseReportFiller masterFiller)
Constructs a fill context.
-
-
Method Detail
-
getMasterFiller
public BaseReportFiller getMasterFiller()
-
getStyledTextUtil
protected JRStyledTextUtil getStyledTextUtil()
-
init
public void init()
-
getFillEvents
public FillEvents getFillEvents()
-
hasLoadedRenderer
public boolean hasLoadedRenderer(java.lang.Object source)
Checks whether an image renderer given by source has already been loaded and cached.- Parameters:
source- the source of the image renderer- Returns:
- whether the image renderer has been cached
- See Also:
getLoadedRenderer(Object),registerLoadedRenderer(Object, Renderable)
-
getLoadedRenderer
public Renderable getLoadedRenderer(java.lang.Object source)
Gets a cached image renderer.- Parameters:
source- the source renderer of the image- Returns:
- the cached image renderer
- See Also:
registerLoadedRenderer(Object, Renderable)
-
registerLoadedRenderer
public void registerLoadedRenderer(java.lang.Object source, Renderable renderer)Registers an image renderer loaded from a source.The image renderer is cached for further use.
- Parameters:
source- the source that was used to load the image rendererrenderer- the loaded image renderer- See Also:
getLoadedRenderer(Object)
-
getRenderersCache
public RenderersCache getRenderersCache()
-
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, JasperReportSource)
-
getLoadedSubreport
public JasperReportSource getLoadedSubreport(java.lang.Object source)
Gets a cached subreport.- Parameters:
source- the source of the subreport- Returns:
- the cached subreport
- See Also:
registerLoadedSubreport(Object, JasperReportSource)
-
registerLoadedSubreport
public void registerLoadedSubreport(java.lang.Object source, JasperReportSource 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 subreportsubreport- 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:
trueif 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)
-
isIgnorePagination
public boolean isIgnorePagination()
Decides whether the filling should ignore pagination.- Returns:
- whether the filling should ignore pagination
- See Also:
JRParameter.IS_IGNORE_PAGINATION,BaseReportFiller.isIgnorePagination()
-
isLegacyElementStretchEnabled
public boolean isLegacyElementStretchEnabled()
Deprecated.To be removed.
-
isLegacyBandEvaluationEnabled
public boolean isLegacyBandEvaluationEnabled()
Deprecated.To be removed.
-
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 JRExceptionCancels the running query.- Returns:
trueif and only if there is a running query and it has been canceled.- Throws:
JRException
-
getVirtualizationContext
public JRVirtualizationContext getVirtualizationContext()
Returns the virtualization context.- Returns:
- the virtualization context
-
lockVirtualizationContext
public void lockVirtualizationContext()
-
unlockVirtualizationContext
public void unlockVirtualizationContext()
-
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, ReportTemplateSource)
-
getLoadedTemplate
public ReportTemplateSource getLoadedTemplate(java.lang.Object source)
Gets a cached template.- Parameters:
source- the source of the template- Returns:
- the cached template
- See Also:
registerLoadedTemplate(Object, ReportTemplateSource)
-
registerLoadedTemplate
public void registerLoadedTemplate(java.lang.Object source, ReportTemplateSource templateSource)Registers a template loaded from a source.The template is cached for further use.
- Parameters:
source- the source that was used to load the templatetemplateSource- the loaded template- See Also:
getLoadedTemplate(Object)
-
getMarkupProcessor
protected MarkupProcessor getMarkupProcessor(java.lang.String markup)
-
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()
-
markCanceled
public void markCanceled()
-
isCanceled
public boolean isCanceled()
-
getFillCache
public java.lang.Object getFillCache(java.lang.String key)
-
setFillCache
public void setFillCache(java.lang.String key, java.lang.Object value)
-
dispose
public void dispose()
-
isCollectingBookmarks
public boolean isCollectingBookmarks()
-
registerReportStyles
public void registerReportStyles(JasperReport jasperReport, java.util.UUID id, java.util.List<JRStyle> styles)
-
registerReportStyles
public void registerReportStyles(java.lang.String reportLocation, java.util.UUID id, java.util.List<JRStyle> styles)
-
toDetectParts
public boolean toDetectParts()
-
setDetectParts
public void setDetectParts(boolean detectParts)
-
-