org.eclipse.birt.chart.device.pdf_3.7.2.v20120213

16:41:23.889 INFO  jd.cli.Main - Decompiling org.eclipse.birt.chart.device.pdf_3.7.2.v20120213.jar
package org.eclipse.birt.chart.device.pdf;

import org.eclipse.birt.chart.device.svg.SVGDisplayServer;

public class PDFDisplayServer
  extends SVGDisplayServer
{}

/* Location:
 * Qualified Name:     org.eclipse.birt.chart.device.pdf.PDFDisplayServer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.birt.chart.device.pdf;

import org.eclipse.birt.chart.device.IDeviceRenderer;
import org.eclipse.birt.chart.device.svg.SVGInteractiveRenderer;
import org.eclipse.birt.chart.event.PrimitiveRenderEvent;

public class PDFInteractiveRenderer
  extends SVGInteractiveRenderer
{
  public PDFInteractiveRenderer(IDeviceRenderer device)
  {
    super(device);
  }
  
  public void addInteractivity() {}
  
  protected void groupPrimitive(PrimitiveRenderEvent pre, boolean drawText) {}
  
  protected void ungroupPrimitive(PrimitiveRenderEvent pre, boolean drawText) {}
}

/* Location:
 * Qualified Name:     org.eclipse.birt.chart.device.pdf.PDFInteractiveRenderer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.birt.chart.device.pdf;

import org.apache.batik.transcoder.DefaultErrorHandler;
import org.apache.batik.transcoder.TranscoderException;

class PDFRendererImpl$1
  extends DefaultErrorHandler
{
  PDFRendererImpl$1(PDFRendererImpl paramPDFRendererImpl) {}
  
  public void error(TranscoderException te)
  {
    te.printStackTrace();
  }
  
  public void warning(TranscoderException te)
  {
    te.printStackTrace();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.birt.chart.device.pdf.PDFRendererImpl.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.birt.chart.device.pdf;

import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.StringReader;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.apache.batik.transcoder.DefaultErrorHandler;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.fop.svg.PDFTranscoder;
import org.eclipse.birt.chart.device.svg.SVGRendererImpl;
import org.eclipse.birt.chart.device.util.ChartTextRenderer;
import org.eclipse.birt.chart.event.InteractionEvent;
import org.eclipse.birt.chart.exception.ChartException;
import org.eclipse.birt.chart.log.ILogger;
import org.eclipse.birt.chart.log.Logger;
import org.eclipse.birt.chart.util.PluginSettings;
import org.eclipse.birt.chart.util.SecurityUtil;
import org.w3c.dom.Document;

public class PDFRendererImpl
  extends SVGRendererImpl
{
  private static ILogger logger = Logger.getLogger("org.eclipse.birt.chart.device.svg/trace");
  
  protected void init()
  {
    PluginSettings ps = PluginSettings.instance();
    try
    {
      _ids = ps.getDisplayServer("ds.PDF");
      
      _tr = new ChartTextRenderer(_ids);
      ivRenderer = new PDFInteractiveRenderer(this);
    }
    catch (ChartException pex)
    {
      logger.log(pex);
    }
  }
  
  public void enableInteraction(InteractionEvent ie)
    throws ChartException
  {}
  
  public void setProperty(String sProperty, Object oValue)
  {
    if (!sProperty.equals("device.component")) {
      if (!sProperty.equals("javascript.code.list")) {
        if (!sProperty.equals("javascript.ref.list")) {
          if (sProperty.equals("resize.svg")) {
            _resizeSVG = false;
          } else {
            super.setProperty(sProperty, oValue);
          }
        }
      }
    }
  }
  
  protected void addGroupStructure(Object block) {}
  
  public void after()
    throws ChartException
  {
    if ((oOutputIdentifier instanceof OutputStream))
    {
      try
      {
        transcode2PDF(new StringReader(serializeGeneratedDocumentToString(dom)), 
          (OutputStream)oOutputIdentifier);
      }
      catch (Exception ex)
      {
        throw new ChartException("org.eclipse.birt.chart.device.svg", 
          11, 
          ex);
      }
    }
    else if ((oOutputIdentifier instanceof String))
    {
      FileOutputStream fos = null;
      try
      {
        fos = SecurityUtil.newFileOutputStream((String)oOutputIdentifier);
        Reader r = new StringReader(serializeGeneratedDocumentToString(dom));
        
        transcode2PDF(r, fos);
        fos.close();
      }
      catch (Exception ex)
      {
        throw new ChartException("org.eclipse.birt.chart.device.svg", 
          11, 
          ex);
      }
    }
    else
    {
      throw new ChartException("org.eclipse.birt.chart.device.svg", 
        11, 
        "SVGRendererImpl.exception.UnableToWriteChartImage", 
        new Object[] {
        oOutputIdentifier }, 
        
        null);
    }
  }
  
  protected void transcode2PDF(TranscoderInput tcin, TranscoderOutput tcout)
    throws TranscoderException
  {
    PDFTranscoder t = new PDFTranscoder();
    
    t.setErrorHandler(new DefaultErrorHandler()
    {
      public void error(TranscoderException te)
      {
        te.printStackTrace();
      }
      
      public void warning(TranscoderException te)
      {
        te.printStackTrace();
      }
    });
    t.transcode(tcin, tcout);
  }
  
  protected void transcode2PDF(Document dom, OutputStream ostream)
    throws TranscoderException
  {
    TranscoderInput tcin = new TranscoderInput(dom);
    TranscoderOutput tcout = new TranscoderOutput(ostream);
    transcode2PDF(tcin, tcout);
    try
    {
      ostream.flush();
    }
    catch (IOException localIOException) {}
  }
  
  protected void transcode2PDF(Reader r, OutputStream ostream)
    throws TranscoderException
  {
    TranscoderInput tcin = new TranscoderInput(r);
    TranscoderOutput tcout = new TranscoderOutput(ostream);
    transcode2PDF(tcin, tcout);
    try
    {
      ostream.flush();
    }
    catch (IOException localIOException) {}
  }
  
  protected String serializeGeneratedDocumentToString(Document generatedDocument)
    throws Exception
  {
    if (generatedDocument == null) {
      return null;
    }
    OutputStreamWriter writer = null;
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    writer = SecurityUtil.newOutputStreamWriter(stream, "UTF-8");
    DOMSource source = new DOMSource(generatedDocument);
    StreamResult result = new StreamResult(writer);
    
    TransformerFactory transFactory = SecurityUtil.newTransformerFactory();
    Transformer transformer = transFactory.newTransformer();
    transformer.transform(source, result);
    
    return stream.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.birt.chart.device.pdf.PDFRendererImpl
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.birt.chart.device.pdf.plugin;

import org.eclipse.core.runtime.Plugin;

public class ChartDevicePDFPlugin
  extends Plugin
{
  public static final String PLUGIN_ID = "org.eclipse.birt.chart.device.pdf";
}

/* Location:
 * Qualified Name:     org.eclipse.birt.chart.device.pdf.plugin.ChartDevicePDFPlugin
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
1

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd