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

项目:jasperreports    文件:JROriginExporterFilterFactory.java   
@Override
public ExporterFilter getFilter(JRExporterContext exporterContext)
{
    JRAbstractExporter<?, ?, ?, ?> exporter = 
        exporterContext.getExporterRef() instanceof JRAbstractExporter<?, ?, ?, ?> 
        ? (JRAbstractExporter<?, ?, ?, ?>)exporterContext.getExporterRef() 
        : null;
    if (exporter != null)
    {
        String originFilterPrefix = exporter.getExporterPropertiesPrefix() 
                + JROriginExporterFilter.PROPERTY_EXCLUDE_ORIGIN_PREFIX;
        return 
            JROriginExporterFilter.getFilter(
                exporterContext.getJasperReportsContext(),
                exporterContext.getExportedReport().getPropertiesMap(), 
                originFilterPrefix
                );
    }
    return null;
}
项目:jasperreports    文件:ParametersExporterConfigurationFactory.java   
/**
     * 
     */
    private final C getProxy(Class<?> clazz, InvocationHandler handler)
    {
//      @SuppressWarnings("rawtypes")
//      List allInterfaces = ClassUtils.getAllInterfaces(clazz);

        @SuppressWarnings("unchecked")
        C proxy =
            (C)Proxy.newProxyInstance(
                JRAbstractExporter.class.getClassLoader(),
//              (Class<?>[]) allInterfaces.toArray(new Class<?>[allInterfaces.size()]),
                new Class<?>[]{clazz},
                handler
                );

        return proxy;
    }
项目:jasperreports    文件:MatcherExporterFilter.java   
public static MatcherExporterFilter getInstance(JRExporterContext exporterContext)
{
    MatcherExporterFilter filter = null;

    Exporter exporter = exporterContext.getExporterRef();
    JRAbstractExporter typedExporter = exporter instanceof JRAbstractExporter ? (JRAbstractExporter)exporter : null;

    if (typedExporter != null)
    {
        String exporterKey = typedExporter.getExporterKey();
        if (exporterKey != null)
        {
            Set<String> includes = new HashSet<String>();
            Set<String> excludes = new HashSet<String>();
            List<MatcherExportFilterMapping> mappings = exporterContext.getJasperReportsContext().getExtensions(MatcherExportFilterMapping.class);
            for (MatcherExportFilterMapping mapping : mappings)
            {
                if (exporterKey.equals(mapping.getExporterKey()))
                {
                    if (mapping.isIncludes())
                    {
                        includes.add(mapping.getValue());
                    }
                    else
                    {
                        excludes.add(mapping.getValue());
                    }
                }
            }

            filter = new MatcherExporterFilter(includes, excludes);
        }
    }

    return filter;
}
项目:jasperreports    文件:DocumentBuilder.java   
/**
 *
 */
public static JRPrintElementIndex getPrintElementIndex(String imageName)
{
    if (!imageName.startsWith(IMAGE_NAME_PREFIX))
    {
        throw 
            new JRRuntimeException(
                JRAbstractExporter.EXCEPTION_MESSAGE_KEY_INVALID_IMAGE_NAME,
                new Object[]{imageName});
    }

    return JRPrintElementIndex.parsePrintElementIndex(imageName.substring(IMAGE_NAME_PREFIX_LEGTH));
}
项目:jasperreports    文件:ElementKeyExporterFilterFactory.java   
/**
 * The exported report is searched for element exclusion properties, and
 * if any is found a {@link ElementKeyExporterFilter} instance is returned.
 * 
 * Each property results in a excluded element key in the following manner:
 * <ul>
 *  <li>If the property value is not empty, it is used as excluded element key.</li>
 *  <li>Otherwise, the property suffix is used as element key.</li>
 * </ul>
 * 
 * @see #PROPERTY_EXCLUDED_KEY_PREFIX
 */
@Override
public ExporterFilter getFilter(JRExporterContext exporterContext)
        throws JRException
{
    ExporterFilter filter = null;

    JRAbstractExporter<?, ?, ?, ?> exporter = 
        exporterContext.getExporterRef() instanceof JRAbstractExporter<?, ?, ?, ?> 
        ? (JRAbstractExporter<?, ?, ?, ?>)exporterContext.getExporterRef() 
        : null;

    if (exporter != null)
    {
        String excludeKeyPrefix = 
            exporter.getExporterPropertiesPrefix() + PROPERTY_EXCLUDED_KEY_PREFIX;
        JRPropertiesUtil propsUtil = JRPropertiesUtil.getInstance(
                exporterContext.getJasperReportsContext());
        List<PropertySuffix> props = propsUtil.getAllProperties(
                exporterContext.getExportedReport(), excludeKeyPrefix);
        if (!props.isEmpty())
        {
            Set<String> excludedKeys = new HashSet<String>();
            for (Iterator<PropertySuffix> it = props.iterator(); it.hasNext();)
            {
                PropertySuffix prop = it.next();
                String key = prop.getValue();
                if (key == null || key.length() == 0)
                {
                    key = prop.getSuffix();
                }
                excludedKeys.add(key);
            }

            filter = new ElementKeyExporterFilter(excludedKeys);
        }
    }

    return filter;
}
项目:com.opendoorlogistics    文件:ReporterComponent.java   
private static void export(JRAbstractExporter exporter, JasperPrint printable, String filename, String extension, boolean openAfter) {
    try {
        exporter.setParameter(JRExporterParameter.JASPER_PRINT, printable);
        File file = new File(filename + "." + extension);
        exporter.setParameter(JRExporterParameter.OUTPUT_FILE,file );
        exporter.exportReport();

        if(openAfter && Desktop.isDesktopSupported() && Desktop.getDesktop()!=null){
            Desktop.getDesktop().open(file);
        }

    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
}
项目:nextreports-server    文件:JasperReportsUtil.java   
@SuppressWarnings("deprecation")
private static byte[] getBytes(JRAbstractExporter exporter, ByteArrayOutputStream baos,
                                  JasperPrint jasperPrint) throws JRException {

       printNextReportsParameters();

       // for csv delimiter
       //exporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, ";");
       exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
       exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);

       if (exporter instanceof JRPdfExporter) {
           exporter.setParameter(JRExporterParameter.CHARACTER_ENCODING, encoding);

           // create embedded pdf font (like in nextreports)
           if (embeddedFont != null) {
               HashMap<FontKey, PdfFont> fontMap = new HashMap<FontKey, PdfFont>();
               FontKey key = new FontKey("Arial", false, false);
               PdfFont font = new PdfFont(embeddedFont, BaseFont.IDENTITY_H, true);
               fontMap.put(key, font);
               exporter.setParameter(JRPdfExporterParameter.FONT_MAP, fontMap);
           }
       } else {
           exporter.setParameter(JRExporterParameter.CHARACTER_ENCODING, "UTF-8");
       }

       exporter.exportReport();
       return baos.toByteArray();
   }
项目:PDFReporter-Studio    文件:AExportAction.java   
protected void exportWithProgress(File file, JRExportProgressMonitor monitor) throws Throwable {
    JRAbstractExporter<?, ?, ?, ?> exporter = getExporter(jContext, monitor, file);
    exporter.setExporterInput(new SimpleExporterInput(getReportViewer().getReport()));

    exporter.exportReport();
}
项目:PDFReporter-Studio    文件:AExportAction.java   
protected abstract JRAbstractExporter<?, ?, ?, ?> getExporter(JasperReportsConfiguration jContext,
JRExportProgressMonitor monitor, File file);
项目:PDFReporter-Studio    文件:ExportAsJasperReportsAction.java   
@Override
protected JRAbstractExporter<?, ?, ?, ?> getExporter(JasperReportsConfiguration jContext,
        JRExportProgressMonitor monitor, File file) {
    return null;
}