net.sf.jasperreports.engine.base
Class JRVirtualPrintPage

java.lang.Object
  extended by net.sf.jasperreports.engine.base.JRVirtualPrintPage
All Implemented Interfaces:
java.io.Serializable, JRPrintPage, JRVirtualizable

public class JRVirtualPrintPage
extends java.lang.Object
implements JRPrintPage, JRVirtualizable, java.io.Serializable

A print page that can be virtualized to free heap memory.

Version:
$Id: JRVirtualPrintPage.java 3717 2010-04-09 10:01:33Z teodord $
Author:
John Bindel
See Also:
Serialized Form

Nested Class Summary
protected static interface JRVirtualPrintPage.ElementVisitor
           
protected  class JRVirtualPrintPage.ExternalizationElementVisitor
           
static interface JRVirtualPrintPage.IdentityDataProvider
          Classes that want to deal with the identity data should implement this.
protected  class JRVirtualPrintPage.InternalizationElementVisitor
           
protected static class JRVirtualPrintPage.JRIdHolderRenderer
          Dummy image renderer that only stores the ID of a cached renderer.
protected static class JRVirtualPrintPage.JRIdHolderTemplateElement
           
static class JRVirtualPrintPage.ObjectIDPair
          Identity objects are those that we want to replace when we devirtualize data.
 
Field Summary
protected  java.util.List elements
           
protected static org.apache.commons.logging.Log log
           
protected  JRVirtualizationContext virtualizationContext
           
 
Constructor Summary
JRVirtualPrintPage(JasperPrint printObject, JRVirtualizer virtualizer, JRVirtualizationContext virtualizationContext)
          Constructs a virtualizable page.
 
Method Summary
 void addElement(JRPrintElement element)
           
 void addIdentityDataProvider(JRVirtualPrintPage.IdentityDataProvider p)
           
 void afterExternalization()
          Called by the virtualizer after the object's data is externalized, but before the virtual data is removed.
 void afterInternalization()
          Called by the virtualizer after the object's data was made available to the object.
 void beforeExternalization()
          Called by the virtualizer before the object's data is externalized.
protected  void cacheInContext(JRPrintElement element)
           
protected  void cacheInContext(java.util.List elementList)
           
protected  void cleanVirtualData()
           
protected  void collectDeepElements(java.util.List elementsList, java.util.List deepElements)
           
protected  void ensureVirtualData()
           
protected  void finalize()
           
 JRVirtualizationContext getContext()
          Returns the virtualization context this object belongs to.
protected  java.util.List getDeepElements()
          Returns all the elements on the page, including the ones placed inside frames.
 java.util.List getElements()
           
 java.lang.Object getIdentityData()
          Used by the virtualizer to get identity data.
 java.lang.String getUID()
          Used by the virtualizer to identify the data for this object.
 java.lang.Object getVirtualData()
          Used by the virtualizer to get data.
 JRVirtualizer getVirtualizer()
          Gets the virtualizer.
 boolean isVirtualized()
           
 void removeIdentityDataProvider(JRVirtualPrintPage.IdentityDataProvider p)
           
 void removeVirtualData()
          Used by the virtualizer to remove the data from the object in memory so that it may be garbage collected.
protected  void restoreElementsData()
           
 void setElements(java.util.List elements)
           
protected  void setElementsExternalData()
           
protected  void setExternalizationRenderer(JRPrintImage image)
           
 void setIdentityData(java.lang.Object o)
          Used by the virtualizer to set identity data.
 void setVirtualData(java.lang.Object o)
          Used by the virtualizer to set data.
 void setVirtualizer(JRVirtualizer virtualizer)
          Sets the virtualizer.
protected  void traverseDeepElements(JRVirtualPrintPage.ElementVisitor visitor)
          Traverses all the elements on the page, including the ones placed inside frames.
protected  void traverseDeepElements(JRVirtualPrintPage.ElementVisitor visitor, java.util.List elementsList)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.commons.logging.Log log

elements

protected java.util.List elements

virtualizationContext

protected JRVirtualizationContext virtualizationContext
Constructor Detail

JRVirtualPrintPage

public JRVirtualPrintPage(JasperPrint printObject,
                          JRVirtualizer virtualizer,
                          JRVirtualizationContext virtualizationContext)
Constructs a virtualizable page.

Method Detail

getUID

public final java.lang.String getUID()
Description copied from interface: JRVirtualizable
Used by the virtualizer to identify the data for this object.

Specified by:
getUID in interface JRVirtualizable

setVirtualData

public void setVirtualData(java.lang.Object o)
Description copied from interface: JRVirtualizable
Used by the virtualizer to set data.

Specified by:
setVirtualData in interface JRVirtualizable

getVirtualData

public java.lang.Object getVirtualData()
Description copied from interface: JRVirtualizable
Used by the virtualizer to get data.

Specified by:
getVirtualData in interface JRVirtualizable

removeVirtualData

public void removeVirtualData()
Description copied from interface: JRVirtualizable
Used by the virtualizer to remove the data from the object in memory so that it may be garbage collected.

Specified by:
removeVirtualData in interface JRVirtualizable

setIdentityData

public void setIdentityData(java.lang.Object o)
Description copied from interface: JRVirtualizable
Used by the virtualizer to set identity data.

Specified by:
setIdentityData in interface JRVirtualizable

getIdentityData

public java.lang.Object getIdentityData()
Description copied from interface: JRVirtualizable
Used by the virtualizer to get identity data.

Specified by:
getIdentityData in interface JRVirtualizable

isVirtualized

public boolean isVirtualized()

setVirtualizer

public void setVirtualizer(JRVirtualizer virtualizer)
Sets the virtualizer.


getVirtualizer

public JRVirtualizer getVirtualizer()
Gets the virtualizer.


addIdentityDataProvider

public void addIdentityDataProvider(JRVirtualPrintPage.IdentityDataProvider p)

removeIdentityDataProvider

public void removeIdentityDataProvider(JRVirtualPrintPage.IdentityDataProvider p)

getElements

public java.util.List getElements()
Specified by:
getElements in interface JRPrintPage

ensureVirtualData

protected void ensureVirtualData()

setElements

public void setElements(java.util.List elements)
Specified by:
setElements in interface JRPrintPage

cleanVirtualData

protected void cleanVirtualData()

addElement

public void addElement(JRPrintElement element)
Specified by:
addElement in interface JRPrintPage

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

getDeepElements

protected java.util.List getDeepElements()
Returns all the elements on the page, including the ones placed inside frames.

Returns:
all the elements on the page

collectDeepElements

protected void collectDeepElements(java.util.List elementsList,
                                   java.util.List deepElements)

beforeExternalization

public void beforeExternalization()
Description copied from interface: JRVirtualizable
Called by the virtualizer before the object's data is externalized.

Specified by:
beforeExternalization in interface JRVirtualizable

setElementsExternalData

protected void setElementsExternalData()

setExternalizationRenderer

protected void setExternalizationRenderer(JRPrintImage image)

cacheInContext

protected void cacheInContext(java.util.List elementList)

cacheInContext

protected void cacheInContext(JRPrintElement element)

afterInternalization

public void afterInternalization()
Description copied from interface: JRVirtualizable
Called by the virtualizer after the object's data was made available to the object.

Specified by:
afterInternalization in interface JRVirtualizable

restoreElementsData

protected void restoreElementsData()

getContext

public JRVirtualizationContext getContext()
Description copied from interface: JRVirtualizable
Returns the virtualization context this object belongs to.

Specified by:
getContext in interface JRVirtualizable
Returns:
the virtualization context this object belongs to

afterExternalization

public void afterExternalization()
Description copied from interface: JRVirtualizable
Called by the virtualizer after the object's data is externalized, but before the virtual data is removed.

Specified by:
afterExternalization in interface JRVirtualizable

traverseDeepElements

protected void traverseDeepElements(JRVirtualPrintPage.ElementVisitor visitor)
Traverses all the elements on the page, including the ones placed inside frames.

Parameters:
visitor - element visitor

traverseDeepElements

protected void traverseDeepElements(JRVirtualPrintPage.ElementVisitor visitor,
                                    java.util.List elementsList)


Copyright © 2011. All Rights Reserved.