Package net.sf.jasperreports.engine.fill
Class JRFillContext
- java.lang.Object
-
- net.sf.jasperreports.engine.fill.JRFillContext
-
public class JRFillContext extends 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.
- Author:
- Lucian Chirita (lucianc@users.sourceforge.net)
- See Also:
JRBaseFiller
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
JRFillContext.FillCacheDisposable
-
Field Summary
Fields Modifier and Type Field Description static String
EXCEPTION_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 Modifier and Type Method Description void
addDataRecordResult(FillDatasetPosition fillPosition, Object recorded)
void
cacheDone()
boolean
cancelRunningQuery()
Cancels the running query.void
clearRunningQueryExecuter()
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.void
dispose()
protected int
generatedFillerId()
int
generateFillElementId()
Generates a fresh fill element Id.DataCacheHandler
getCacheHandler()
protected Object
getContextParameterValue(String parameterName)
DataRecorder
getDataRecorder()
DataSnapshot
getDataSnapshot()
Object
getFillCache(String key)
FillEvents
getFillEvents()
Renderable
getLoadedRenderer(Object source)
Gets a cached image renderer.JasperReportSource
getLoadedSubreport(Object source)
Gets a cached subreport.ReportTemplateSource
getLoadedTemplate(Object source)
Gets a cached template.protected MarkupProcessor
getMarkupProcessor(String markup)
BaseReportFiller
getMasterFiller()
FormatFactory
getMasterFormatFactory()
Locale
getMasterLocale()
TimeZone
getMasterTimeZone()
JRPrintPage
getPrintPage()
Returns the current master print page.RenderersCache
getRenderersCache()
ReportContext
getReportContext()
protected JRStyledTextUtil
getStyledTextUtil()
JRVirtualizationContext
getVirtualizationContext()
Returns the virtualization context.boolean
hasDataSnapshot()
boolean
hasLoadedRenderer(Object source)
Checks whether an image renderer given by source has already been loaded and cached.boolean
hasLoadedSubreport(Object source)
Checks whether a subreport given by source has already been loaded and cached.boolean
hasLoadedTemplate(Object source)
Checks whether a template given by source has already been loaded and cached.void
init()
boolean
isCanceled()
boolean
isCollectingBookmarks()
boolean
isIgnorePagination()
Decides whether the filling should ignore pagination.boolean
isUsingVirtualizer()
Decides whether virtualization is used by the filling process.void
lockVirtualizationContext()
void
markCanceled()
void
registerLoadedRenderer(Object source, Renderable renderer)
Registers an image renderer loaded from a source.void
registerLoadedSubreport(Object source, JasperReportSource subreport)
Registers a subreport loaded from a source.void
registerLoadedTemplate(Object source, ReportTemplateSource templateSource)
Registers a template loaded from a source.void
registerReportStyles(String reportLocation, UUID id, List<JRStyle> styles)
void
registerReportStyles(JasperReport jasperReport, UUID id, List<JRStyle> styles)
void
setDetectParts(boolean detectParts)
void
setFillCache(String key, Object value)
void
setMasterFormatFactory(FormatFactory masterFormatFactory)
void
setMasterLocale(Locale masterLocale)
void
setMasterTimeZone(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.boolean
toDetectParts()
void
unlockVirtualizationContext()
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_MISSING_MARKUP_PROCESSOR_FACTORY
public static final 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(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(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(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(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(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(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:
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)
-
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()
-
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
-
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 Locale getMasterLocale()
-
setMasterLocale
public void setMasterLocale(Locale masterLocale)
-
getMasterTimeZone
public TimeZone getMasterTimeZone()
-
setMasterTimeZone
public void setMasterTimeZone(TimeZone masterTimeZone)
-
hasLoadedTemplate
public boolean hasLoadedTemplate(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(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(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(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)
-
getCacheHandler
public DataCacheHandler getCacheHandler()
-
getDataSnapshot
public DataSnapshot getDataSnapshot()
-
hasDataSnapshot
public boolean hasDataSnapshot()
-
getDataRecorder
public DataRecorder getDataRecorder()
-
addDataRecordResult
public void addDataRecordResult(FillDatasetPosition fillPosition, Object recorded)
-
cacheDone
public void cacheDone()
-
markCanceled
public void markCanceled()
-
isCanceled
public boolean isCanceled()
-
dispose
public void dispose()
-
isCollectingBookmarks
public boolean isCollectingBookmarks()
-
registerReportStyles
public void registerReportStyles(JasperReport jasperReport, UUID id, List<JRStyle> styles)
-
registerReportStyles
public void registerReportStyles(String reportLocation, UUID id, List<JRStyle> styles)
-
toDetectParts
public boolean toDetectParts()
-
setDetectParts
public void setDetectParts(boolean detectParts)
-
-