public class JRVirtualizationContext extends Object implements Serializable, VirtualizationListener<VirtualElementsData>
| Modifier and Type | Field and Description |
|---|---|
static String |
EXCEPTION_MESSAGE_KEY_LOCKING_INTERRUPTED |
static String |
EXCEPTION_MESSAGE_KEY_RENDERER_NOT_FOUND_IN_CONTEXT |
static String |
EXCEPTION_MESSAGE_KEY_TEMPLATE_NOT_FOUND_IN_CONTEXT |
| Modifier | Constructor and Description |
|---|---|
|
JRVirtualizationContext(JasperReportsContext jasperReportsContext)
Constructs a context.
|
protected |
JRVirtualizationContext(JRVirtualizationContext parentContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(VirtualizationListener<VirtualElementsData> listener)
Adds a virtualization listener.
|
void |
afterExternalization(JRVirtualizable<VirtualElementsData> object) |
void |
afterInternalization(JRVirtualizable<VirtualElementsData> object)
Called after an object's data was made available to the object.
|
void |
beforeExternalization(JRVirtualizable<VirtualElementsData> object)
Called before an object's data is externalized.
|
void |
cacheRenderer(Renderable renderer)
Caches an image renderer.
|
void |
cacheTemplate(JRPrintElement element)
Caches the template of an element.
|
void |
cacheTemplate(JRTemplateElement template)
Caches an element template.
|
void |
dispose()
Marks this context as disposed in order to instruct the virtualizer
that pages owned by this context are no longer used.
|
Renderable |
getCachedRenderer(String id)
Retrieves a cached image renderer based on an ID.
|
JRTemplateElement |
getCachedTemplate(String templateId)
Retrieves a cached template.
|
JRVirtualizationContext |
getMasterContext() |
int |
getPageElementSize()
Returns the virtual page size used by the report.
|
static JRVirtualizationContext |
getRegistered(JasperPrint print)
Returns the virtualization context registered for a print object.
|
JRVirtualizer |
getVirtualizer()
Returns the virtualizer used by this context.
|
boolean |
hasCachedRenderer(String id)
Determines whether a cached image renderer for a specified ID exists.
|
boolean |
hasCachedTemplate(String id)
Determines whether a cached
template with a specified ID exists. |
boolean |
isDisposed()
Determines if this context is marked as disposed.
|
boolean |
isReadOnly()
Determines whether this context has been marked as read-only.
|
void |
lock()
Acquires a lock on this context.
|
static void |
register(JRVirtualizationContext context,
JasperPrint print)
Registers a virtualization context for
JasperPrint object. |
void |
removeListener(VirtualizationListener<VirtualElementsData> listener)
Remove a virtualization listener.
|
Object |
replaceSerializedObject(Object obj) |
Object |
resolveSerializedObject(Object obj) |
void |
setPageElementSize(int pageElementSize)
Set the virtual page size used by the report.
|
void |
setReadOnly(boolean readOnly)
Sets the read-only flag for this context.
|
protected void |
setVirtualizer(JRVirtualizer virtualizer) |
protected void |
traverseDeepElements(PrintElementVisitor<Void> visitor,
Collection<? extends JRPrintElement> elements)
Traverses all the elements on the page, including the ones placed inside
frames. |
boolean |
tryLock()
Attempts to acquire a lock on this context.
|
void |
unlock()
Releases the lock previously acquired on this context.
|
public static final String EXCEPTION_MESSAGE_KEY_LOCKING_INTERRUPTED
public static final String EXCEPTION_MESSAGE_KEY_RENDERER_NOT_FOUND_IN_CONTEXT
public static final String EXCEPTION_MESSAGE_KEY_TEMPLATE_NOT_FOUND_IN_CONTEXT
public JRVirtualizationContext(JasperReportsContext jasperReportsContext)
protected JRVirtualizationContext(JRVirtualizationContext parentContext)
public void addListener(VirtualizationListener<VirtualElementsData> listener)
listener - public void removeListener(VirtualizationListener<VirtualElementsData> listener)
listener - public void beforeExternalization(JRVirtualizable<VirtualElementsData> object)
VirtualizationListenerbeforeExternalization in interface VirtualizationListener<VirtualElementsData>JRVirtualizable.beforeExternalization()public void afterExternalization(JRVirtualizable<VirtualElementsData> object)
public void afterInternalization(JRVirtualizable<VirtualElementsData> object)
VirtualizationListenerafterInternalization in interface VirtualizationListener<VirtualElementsData>JRVirtualizable.afterInternalization()public void cacheRenderer(Renderable renderer)
renderer - the image whose renderer should be cachedpublic Renderable getCachedRenderer(String id)
id - the IDpublic boolean hasCachedRenderer(String id)
id - the IDtrue if and only if the context contains a cached renderer with the specified IDpublic boolean hasCachedTemplate(String id)
template with a specified ID exists.id - the template IDtrue if and only if the context contains a cached template with the specified IDpublic void cacheTemplate(JRTemplateElement template)
template - the template to cachepublic JRTemplateElement getCachedTemplate(String templateId)
templateId - the template IDpublic void cacheTemplate(JRPrintElement element)
element - the element whose template to cachepublic boolean isReadOnly()
setReadOnly(boolean)public void setReadOnly(boolean readOnly)
When in read-only mode, all the virtualizable objects belonging to this context are assumed final by the virtualizer and any change in a virtualizable object's data would be discarded on virtualization.
readOnly - the read-only flagpublic static void register(JRVirtualizationContext context, JasperPrint print)
JasperPrint object.context - the virtualization contextprint - the print objectpublic static JRVirtualizationContext getRegistered(JasperPrint print)
When the engine fills a report using a virtualizer, it registers
the virtualization context with the generated JasperPrint object so that the caller
would be able to retrieve the context based on the returned print object.
print - a print objectnull if no context
has been registeredpublic int getPageElementSize()
JRVirtualPrintPage.PROPERTY_VIRTUAL_PAGE_ELEMENT_SIZEpublic void setPageElementSize(int pageElementSize)
pageElementSize - the virtual page sizeJRVirtualPrintPage.PROPERTY_VIRTUAL_PAGE_ELEMENT_SIZEpublic JRVirtualizer getVirtualizer()
protected void setVirtualizer(JRVirtualizer virtualizer)
protected void traverseDeepElements(PrintElementVisitor<Void> visitor, Collection<? extends JRPrintElement> elements)
frames.visitor - element visitorpublic void lock()
public boolean tryLock()
public void unlock()
public void dispose()
public boolean isDisposed()
public JRVirtualizationContext getMasterContext()
Copyright © 2017. All rights reserved.