Java 类net.sf.jasperreports.engine.JRVirtualizer 实例源码

项目:jasperreports    文件:JRLoader.java   
/**
 * Loads a JasperPrint object from a file, optionally using a virtualizer for
 * the object.
 * 
 * @param fileName the file name
 * @param virtualizer the virtualizer
 * @return a JasperPrint object
 * @throws JRException
 * @see JRVirtualizationHelper#setThreadVirtualizer(JRVirtualizer)
 */
public static JasperPrint loadJasperPrintFromFile(String fileName, JRVirtualizer virtualizer) throws JRException
{
    if (virtualizer != null)
    {
        JRVirtualizationHelper.setThreadVirtualizer(virtualizer);
    }
    try
    {
        return (JasperPrint) loadObjectFromFile(fileName);
    }
    finally
    {
        if (virtualizer != null)
        {
            JRVirtualizationHelper.clearThreadVirtualizer();
        }
    }
}
项目:jasperreports    文件:JRLoader.java   
/**
 * Loads a JasperPrint object from a file, optionally using a virtualizer for
 * the object.
 * 
 * @param file the file
 * @param virtualizer the virtualizer
 * @return a JasperPrint object
 * @throws JRException
 * @see JRVirtualizationHelper#setThreadVirtualizer(JRVirtualizer)
 */
public static JasperPrint loadJasperPrint(File file, JRVirtualizer virtualizer) throws JRException
{
    if (virtualizer != null)
    {
        JRVirtualizationHelper.setThreadVirtualizer(virtualizer);
    }
    try
    {
        return (JasperPrint) loadObject(file);
    }
    finally
    {
        if (virtualizer != null)
        {
            JRVirtualizationHelper.clearThreadVirtualizer();
        }
    }
}
项目:jasperreports    文件:JRLoader.java   
/**
 * Loads a JasperPrint object from a URL, optionally using a virtualizer for
 * the object.
 * 
 * @param url the URL
 * @param virtualizer the virtualizer
 * @return a JasperPrint object
 * @throws JRException
 * @see JRVirtualizationHelper#setThreadVirtualizer(JRVirtualizer)
 */
public static JasperPrint loadJasperPrint(URL url, JRVirtualizer virtualizer) throws JRException
{
    if (virtualizer != null)
    {
        JRVirtualizationHelper.setThreadVirtualizer(virtualizer);
    }
    try
    {
        return (JasperPrint) loadObject(url);
    }
    finally
    {
        if (virtualizer != null)
        {
            JRVirtualizationHelper.clearThreadVirtualizer();
        }
    }
}
项目:jasperreports    文件:JRLoader.java   
/**
 * Loads a JasperPrint object from a stream, optionally using a virtualizer for
 * the object.
 * 
 * @param is the stream
 * @param virtualizer the virtualizer
 * @return a JasperPrint object
 * @throws JRException
 * @see JRVirtualizationHelper#setThreadVirtualizer(JRVirtualizer)
 */
public static JasperPrint loadJasperPrint(InputStream is, JRVirtualizer virtualizer) throws JRException
{
    if (virtualizer != null)
    {
        JRVirtualizationHelper.setThreadVirtualizer(virtualizer);
    }
    try
    {
        return (JasperPrint) loadObject(is);
    }
    finally
    {
        if (virtualizer != null)
        {
            JRVirtualizationHelper.clearThreadVirtualizer();
        }
    }
}
项目:jasperreports    文件:JRVirtualizationContext.java   
private void setThreadVirtualizer()
{
    JRVirtualizer threadVirtualizer = JRVirtualizationHelper.getThreadVirtualizer();
    if (threadVirtualizer != null)
    {
        virtualizer = threadVirtualizer;
    }
}
项目:dynamicreports-jasper    文件:JasperPrintListFileHandler.java   
public JasperPrintListFileHandler(String directory, JRVirtualizer virtualizer) {
    this.virtualizer = virtualizer;
    if (directory != null) {
        this.directory = new File(directory);
    }
    printList = new PrintList();
    tempFiles = new ArrayList<File>();
}
项目:jasperreports    文件:JRVirtualizationContext.java   
/**
 * Returns the virtualizer used by this context.
 */
public JRVirtualizer getVirtualizer()
{
    return virtualizer;
}
项目:jasperreports    文件:JRVirtualizationContext.java   
protected void setVirtualizer(JRVirtualizer virtualizer)
{
    this.virtualizer = virtualizer;
}
项目:jasperreports    文件:BaseReportFiller.java   
protected void initVirtualizationContext(Map<String, Object> parameterValues)
{
    if (isSubreport())
    {
        if (fillContext.isUsingVirtualizer())
        {
            if (parent.isParentPagination())// using this method to tell between part and band parents 
            {
                // this is a filler of a subreport in a band parent, creating a subcontext for the subreport.
                // this allows setting a separate listener, and guarantees that
                // the current subreport page is not externalized.
                virtualizationContext = new JRVirtualizationContext(fillContext.getVirtualizationContext());//FIXME lucianc clear this context from the virtualizer

                // setting per subreport page size
                setVirtualPageSize(parameterValues);
            }
            else
            {
                // the parent is a part filler, using the master virtualization context
                //FIXMEBOOK JRVirtualPrintPage.PROPERTY_VIRTUAL_PAGE_ELEMENT_SIZE at part level is not used
                virtualizationContext = fillContext.getVirtualizationContext();
            }
        }
    }
    else
    {
        /* Virtualizer */
        JRVirtualizer virtualizer = (JRVirtualizer) parameterValues.get(JRParameter.REPORT_VIRTUALIZER);
        if (virtualizer == null)
        {
            return;
        }

        if (log.isDebugEnabled())
        {
            log.debug("Fill " + fillerId + ": using virtualizer " + virtualizer);
        }

        fillContext.setUsingVirtualizer(true);

        virtualizationContext = fillContext.getVirtualizationContext();
        virtualizationContext.setVirtualizer(virtualizer);

        setVirtualPageSize(parameterValues);

        JRVirtualizationContext.register(virtualizationContext, jasperPrint);
    }

    if (virtualizationContext != null && log.isDebugEnabled())
    {
        log.debug("filler " + fillerId + " created virtualization context " + virtualizationContext);
    }
}
项目:dynamicreports-jasper    文件:JasperReportBuilder.java   
public JasperReportBuilder setVirtualizer(JRVirtualizer virtualizer) {
    this.virtualizer = virtualizer;
    return this;
}
项目:jasperreports    文件:JRVirtualPrintPage.java   
/**
 * Constructs a virtualizable page.
 * 
 * @deprecated the virtualizer should be passed as part of the virtualization context,
 * use {@link #JRVirtualPrintPage(JasperPrint, JRVirtualizationContext)} instead
 */
public JRVirtualPrintPage(JasperPrint printObject, JRVirtualizer virtualizer, JRVirtualizationContext virtualizationContext)
{
    this(printObject, virtualizationContext);
}