net.sf.jasperreports.engine.export.oasis
Class JROpenDocumentExporter

java.lang.Object
  extended by net.sf.jasperreports.engine.JRAbstractExporter
      extended by net.sf.jasperreports.engine.export.oasis.JROpenDocumentExporter
All Implemented Interfaces:
JRExporter
Direct Known Subclasses:
JROdsExporter, JROdtExporter

public abstract class JROpenDocumentExporter
extends JRAbstractExporter

Exports a JasperReports document to ODF format. It has character output type and exports the document to a grid-based layout.

Version:
$Id: JROpenDocumentExporter.java 5217 2012-04-03 15:16:10Z teodord $
Author:
Teodor Danciu (teodord@users.sourceforge.net)

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.jasperreports.engine.JRAbstractExporter
JRAbstractExporter.BaseExporterContext, JRAbstractExporter.ParameterOverriddenResolver, JRAbstractExporter.ParameterOverrideResolver, JRAbstractExporter.ParameterResolver
 
Field Summary
protected  Color backcolor
           
protected  LinkedList<Color> backcolorStack
           
protected  String encoding
           
static String IMAGE_NAME_PREFIX
           
protected static int IMAGE_NAME_PREFIX_LEGTH
           
protected  List<JRPrintElementIndex> imagesToProcess
           
protected static String JR_PAGE_ANCHOR_PREFIX
           
protected  ExporterNature nature
           
protected  int pageIndex
           
protected  JRExportProgressMonitor progressMonitor
           
protected  Map<String,String> rendererToImagePathMap
           
protected  int reportIndex
           
protected  boolean startPage
           
protected  StyleCache styleCache
           
protected  int tableIndex
           
protected  Writer tempBodyWriter
           
protected  Writer tempStyleWriter
           
 
Fields inherited from class net.sf.jasperreports.engine.JRAbstractExporter
dateFormatCache, endPageIndex, filter, fontMap, globalOffsetX, globalOffsetY, hyperlinkProducerFactory, isModeBatch, jasperPrint, jasperPrintList, jasperReportsContext, numberFormatCache, parameters, PROPERTY_DEFAULT_FILTER_FACTORY, PROPERTY_SUFFIX_DEFAULT_FILTER_FACTORY, startPageIndex
 
Constructor Summary
JROpenDocumentExporter()
           
JROpenDocumentExporter(JasperReportsContext jasperReportsContext)
           
 
Method Summary
protected  void endHyperlink(boolean isText)
           
protected abstract  void exportAnchor(String anchorName)
           
protected abstract  void exportEllipse(TableBuilder tableBuilder, JRPrintEllipse ellipse, JRExporterGridCell gridCell)
           
protected  void exportFrame(TableBuilder tableBuilder, JRPrintFrame frame, JRExporterGridCell gridCell)
           
protected abstract  void exportGenericElement(TableBuilder tableBuilder, JRGenericPrintElement element, JRExporterGridCell gridCell)
           
protected  void exportGrid(JRGridLayout gridLayout, JRPrintElementIndex frameIndex)
           
protected abstract  void exportImage(TableBuilder tableBuilder, JRPrintImage image, JRExporterGridCell gridCell)
           
protected abstract  void exportLine(TableBuilder tableBuilder, JRPrintLine line, JRExporterGridCell gridCell)
           
protected  void exportPage(JRPrintPage page)
           
protected  void exportRectangle(TableBuilder tableBuilder, JRPrintRectangle rectangle, JRExporterGridCell gridCell)
           
 void exportReport()
          Actually starts the export process.
protected  void exportReportToOasisZip(OutputStream os)
           
protected  void exportStyledText(JRStyledText styledText, Locale locale, boolean startedHyperlink)
           
protected  void exportStyledTextRun(Map<AttributedCharacterIterator.Attribute,Object> attributes, String text, Locale locale, boolean startedHyperlink)
           
 void exportText(TableBuilder tableBuilder, JRPrintText text, JRExporterGridCell gridCell)
           
protected  JRPrintElementIndex getElementIndex(JRExporterGridCell gridCell)
           
protected abstract  ExporterNature getExporterNature(ExporterFilter filter)
           
protected abstract  String getExporterPropertiesPrefix()
           
protected  String getHyperlinkTarget(JRPrintHyperlink link)
           
protected  String getHyperlinkURL(JRPrintHyperlink link)
           
static JRPrintImage getImage(List<JasperPrint> jasperPrintList, JRPrintElementIndex imageIndex)
           
static JRPrintImage getImage(List<JasperPrint> jasperPrintList, String imageName)
           
static String getImageName(JRPrintElementIndex printElementIndex)
          protected void writeImageMap(String imageMapName, JRPrintHyperlink mainHyperlink, List imageMapAreas) throws IOException { writer.write("\n"); for (Iterator it = imageMapAreas.iterator(); it.hasNext();) { JRPrintImageAreaHyperlink areaHyperlink = (JRPrintImageAreaHyperlink) it.next(); JRPrintImageArea area = areaHyperlink.getArea(); writer.write(" \n"); } if (mainHyperlink.getHyperlinkTypeValue() !
protected  String getImagePath(Renderable renderer, boolean isLazy, JRExporterGridCell gridCell)
           
static JRPrintElementIndex getPrintElementIndex(String imageName)
           
protected  float getXAlignFactor(JRPrintImage image)
           
protected  float getYAlignFactor(JRPrintImage image)
           
protected  void insertPageAnchor()
           
protected  void restoreBackcolor()
           
protected  void setBackcolor(Color color)
           
protected  boolean startHyperlink(JRPrintHyperlink link, boolean isText)
           
 
Methods inherited from class net.sf.jasperreports.engine.JRAbstractExporter
createFilter, defaultParseNumber, getBooleanCellValue, getBooleanParameter, getCharacterParameter, getCustomHandler, getDateCellValue, getDateFormat, getExporterKey, getFloatParameter, getHyperlinkProducer, getIntegerParameter, getJasperReportsContext, getLocale, getNumberCellValue, getNumberFormat, getOffsetX, getOffsetY, getParameter, getParameterResolver, getParameters, getPropertiesUtil, getReportContext, getStringArrayParameter, getStringParameter, getStringParameterOrDefault, getStyledText, getStyledText, getTextFormatFactoryClass, getTextLocale, getTextTimeZone, getTextValue, getTextValueString, reset, resetClassLoader, resetExportContext, restoreElementOffsets, setClassLoader, setExportContext, setFontMap, setFrameElementsOffset, setHyperlinkProducerFactory, setInput, setJasperPrint, setOffset, setOffset, setOutput, setPageRange, setParameter, setParameters, setReportContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JR_PAGE_ANCHOR_PREFIX

protected static final String JR_PAGE_ANCHOR_PREFIX
See Also:
Constant Field Values

IMAGE_NAME_PREFIX

public static final String IMAGE_NAME_PREFIX
See Also:
Constant Field Values

IMAGE_NAME_PREFIX_LEGTH

protected static final int IMAGE_NAME_PREFIX_LEGTH

tempBodyWriter

protected Writer tempBodyWriter

tempStyleWriter

protected Writer tempStyleWriter

progressMonitor

protected JRExportProgressMonitor progressMonitor

rendererToImagePathMap

protected Map<String,String> rendererToImagePathMap

imagesToProcess

protected List<JRPrintElementIndex> imagesToProcess

reportIndex

protected int reportIndex

pageIndex

protected int pageIndex

tableIndex

protected int tableIndex

startPage

protected boolean startPage

encoding

protected String encoding

backcolorStack

protected LinkedList<Color> backcolorStack

backcolor

protected Color backcolor

styleCache

protected StyleCache styleCache

nature

protected ExporterNature nature
Constructor Detail

JROpenDocumentExporter

public JROpenDocumentExporter()
See Also:
JROpenDocumentExporter(JasperReportsContext)

JROpenDocumentExporter

public JROpenDocumentExporter(JasperReportsContext jasperReportsContext)
Method Detail

exportReport

public void exportReport()
                  throws JRException
Description copied from interface: JRExporter
Actually starts the export process.

Specified by:
exportReport in interface JRExporter
Specified by:
exportReport in class JRAbstractExporter
Throws:
JRException

getImage

public static JRPrintImage getImage(List<JasperPrint> jasperPrintList,
                                    String imageName)

getImage

public static JRPrintImage getImage(List<JasperPrint> jasperPrintList,
                                    JRPrintElementIndex imageIndex)

exportReportToOasisZip

protected void exportReportToOasisZip(OutputStream os)
                               throws JRException,
                                      IOException
Throws:
JRException
IOException

exportPage

protected void exportPage(JRPrintPage page)
                   throws JRException,
                          IOException
Throws:
JRException
IOException

exportGrid

protected void exportGrid(JRGridLayout gridLayout,
                          JRPrintElementIndex frameIndex)
                   throws IOException,
                          JRException
Throws:
IOException
JRException

exportLine

protected abstract void exportLine(TableBuilder tableBuilder,
                                   JRPrintLine line,
                                   JRExporterGridCell gridCell)
                            throws IOException
Throws:
IOException

exportRectangle

protected void exportRectangle(TableBuilder tableBuilder,
                               JRPrintRectangle rectangle,
                               JRExporterGridCell gridCell)
                        throws IOException
Throws:
IOException

exportEllipse

protected abstract void exportEllipse(TableBuilder tableBuilder,
                                      JRPrintEllipse ellipse,
                                      JRExporterGridCell gridCell)
                               throws IOException
Throws:
IOException

exportText

public void exportText(TableBuilder tableBuilder,
                       JRPrintText text,
                       JRExporterGridCell gridCell)
                throws IOException
Throws:
IOException

exportStyledText

protected void exportStyledText(JRStyledText styledText,
                                Locale locale,
                                boolean startedHyperlink)
                         throws IOException
Throws:
IOException

exportStyledTextRun

protected void exportStyledTextRun(Map<AttributedCharacterIterator.Attribute,Object> attributes,
                                   String text,
                                   Locale locale,
                                   boolean startedHyperlink)
                            throws IOException
Throws:
IOException

exportImage

protected abstract void exportImage(TableBuilder tableBuilder,
                                    JRPrintImage image,
                                    JRExporterGridCell gridCell)
                             throws JRException,
                                    IOException
Throws:
JRException
IOException

getImagePath

protected String getImagePath(Renderable renderer,
                              boolean isLazy,
                              JRExporterGridCell gridCell)

getElementIndex

protected JRPrintElementIndex getElementIndex(JRExporterGridCell gridCell)

getImageName

public static String getImageName(JRPrintElementIndex printElementIndex)
protected void writeImageMap(String imageMapName, JRPrintHyperlink mainHyperlink, List imageMapAreas) throws IOException { writer.write("\n"); for (Iterator it = imageMapAreas.iterator(); it.hasNext();) { JRPrintImageAreaHyperlink areaHyperlink = (JRPrintImageAreaHyperlink) it.next(); JRPrintImageArea area = areaHyperlink.getArea(); writer.write(" \n"); } if (mainHyperlink.getHyperlinkTypeValue() != NONE) { writer.write(" \n"); } writer.write("\n"); } protected void writeImageAreaCoordinates(JRPrintImageArea area) throws IOException { int[] coords = area.getCoordinates(); if (coords != null && coords.length > 0) { StringBuffer coordsEnum = new StringBuffer(coords.length * 4); coordsEnum.append(coords[0]); for (int i = 1; i < coords.length; i++) { coordsEnum.append(','); coordsEnum.append(coords[i]); } writer.write(" coords=\"" + coordsEnum + "\""); } } protected void writeImageAreaHyperlink(JRPrintHyperlink hyperlink) throws IOException { String href = getHyperlinkURL(hyperlink); if (href == null) { writer.write(" nohref=\"nohref\""); } else { writer.write(" href=\"" + href + "\""); String target = getHyperlinkTarget(hyperlink); if (target != null) { writer.write(" target=\""); writer.write(target); writer.write("\""); } } if (hyperlink.getHyperlinkTooltip() != null) { writer.write(" title=\""); writer.write(JRStringUtil.xmlEncode(hyperlink.getHyperlinkTooltip())); writer.write("\""); } } /**


getPrintElementIndex

public static JRPrintElementIndex getPrintElementIndex(String imageName)

exportFrame

protected void exportFrame(TableBuilder tableBuilder,
                           JRPrintFrame frame,
                           JRExporterGridCell gridCell)
                    throws IOException,
                           JRException
Throws:
IOException
JRException

exportGenericElement

protected abstract void exportGenericElement(TableBuilder tableBuilder,
                                             JRGenericPrintElement element,
                                             JRExporterGridCell gridCell)
                                      throws IOException,
                                             JRException
Throws:
IOException
JRException

setBackcolor

protected void setBackcolor(Color color)

restoreBackcolor

protected void restoreBackcolor()

getXAlignFactor

protected float getXAlignFactor(JRPrintImage image)

getYAlignFactor

protected float getYAlignFactor(JRPrintImage image)

startHyperlink

protected boolean startHyperlink(JRPrintHyperlink link,
                                 boolean isText)
                          throws IOException
Throws:
IOException

getHyperlinkTarget

protected String getHyperlinkTarget(JRPrintHyperlink link)

getHyperlinkURL

protected String getHyperlinkURL(JRPrintHyperlink link)

endHyperlink

protected void endHyperlink(boolean isText)
                     throws IOException
Throws:
IOException

insertPageAnchor

protected void insertPageAnchor()
                         throws IOException
Throws:
IOException

exportAnchor

protected abstract void exportAnchor(String anchorName)
                              throws IOException
Throws:
IOException

getExporterNature

protected abstract ExporterNature getExporterNature(ExporterFilter filter)

getExporterPropertiesPrefix

protected abstract String getExporterPropertiesPrefix()


Copyright © 2012. All Rights Reserved.