net.sf.jasperreports.engine.export
Class JRXhtmlExporter

java.lang.Object
  extended by net.sf.jasperreports.engine.JRAbstractExporter
      extended by net.sf.jasperreports.engine.export.JRXhtmlExporter
All Implemented Interfaces:
JRExporter

public class JRXhtmlExporter
extends JRAbstractExporter

Exports a JasperReports document to XHTML format.

Version:
$Id: JRXhtmlExporter.java 5166 2012-03-28 13:11:05Z teodord $
Author:
Teodor Danciu (teodord@users.sourceforge.net)

Nested Class Summary
protected  class JRXhtmlExporter.ExporterContext
           
 
Nested classes/interfaces inherited from class net.sf.jasperreports.engine.JRAbstractExporter
JRAbstractExporter.BaseExporterContext, JRAbstractExporter.ParameterOverriddenResolver, JRAbstractExporter.ParameterOverrideResolver, JRAbstractExporter.ParameterResolver
 
Field Summary
protected  java.lang.String betweenPagesHtml
           
protected  int bottomLimit
           
protected static java.lang.String CSS_TEXT_ALIGN_CENTER
           
protected static java.lang.String CSS_TEXT_ALIGN_JUSTIFY
           
protected static java.lang.String CSS_TEXT_ALIGN_LEFT
           
protected static java.lang.String CSS_TEXT_ALIGN_RIGHT
           
protected static float DEFAULT_ZOOM
           
protected  int elementIndex
           
protected  java.lang.String encoding
           
protected  JRHtmlExporterContext exporterContext
           
protected  java.util.List<net.sf.jasperreports.engine.export.JRXhtmlExporter.FrameInfo> frameInfoStack
           
protected static java.lang.String HTML_VERTICAL_ALIGN_BOTTOM
           
protected static java.lang.String HTML_VERTICAL_ALIGN_MIDDLE
           
protected static java.lang.String HTML_VERTICAL_ALIGN_TOP
           
protected  java.lang.String htmlFooter
           
protected  java.lang.String htmlHeader
           
protected  boolean hyperlinkStarted
           
static java.lang.String IMAGE_NAME_PREFIX
           
protected static int IMAGE_NAME_PREFIX_LEGTH
           
protected  java.util.Map<Pair<java.lang.String,java.awt.Rectangle>,java.lang.String> imageMaps
           
protected  java.util.Map<java.lang.String,byte[]> imageNameToImageDataMap
           
protected  java.io.File imagesDir
           
protected  java.util.List<JRPrintElementIndex> imagesToProcess
           
protected  java.lang.String imagesURI
           
protected  boolean isIgnorePageMargins
           
protected  boolean isOutputImagesToDir
           
protected  boolean isWhitePageBackground
           
protected  boolean isWrapBreakWord
           
protected static java.lang.String JR_PAGE_ANCHOR_PREFIX
           
protected  int leftLimit
           
protected  int pageIndex
           
protected  JRExportProgressMonitor progressMonitor
           
protected  java.util.Map<java.lang.String,java.lang.String> rendererToImagePathMap
           
protected  int reportIndex
           
protected  int rightLimit
           
protected  java.lang.String sizeUnit
           
protected  JRHyperlinkTargetProducerFactory targetProducerFactory
           
protected  int topLimit
           
protected  java.io.Writer writer
           
static java.lang.String XHTML_EXPORTER_KEY
          The exporter key, as used in GenericElementHandlerEnviroment.getHandler(net.sf.jasperreports.engine.JRGenericElementType, String).
protected  float zoom
           
 
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
JRXhtmlExporter()
           
JRXhtmlExporter(JasperReportsContext jasperReportsContext)
           
 
Method Summary
protected  void appendBackcolorStyle(JRPrintElement element, java.lang.StringBuffer styleBuffer)
           
protected  boolean appendBorderStyle(JRLineBox box, java.lang.StringBuffer styleBuffer)
           
protected  void appendPositionStyle(int x, int y, java.lang.StringBuffer styleBuffer)
           
protected  void appendPositionStyle(JRPrintElement element, JRBoxContainer boxContainer, java.lang.StringBuffer styleBuffer)
           
protected  void appendPositionStyle(JRPrintElement element, JRPen pen, java.lang.StringBuffer styleBuffer)
           
protected  void appendSizeStyle(int width, int height, java.lang.StringBuffer styleBuffer)
           
protected  void appendSizeStyle(JRPrintElement element, JRBoxContainer boxContainer, java.lang.StringBuffer styleBuffer)
           
protected  void appendSizeStyle(JRPrintElement element, JRPen pen, java.lang.StringBuffer styleBuffer)
           
protected  void endHyperlink()
           
protected  void exportElements(java.util.List<JRPrintElement> elements)
           
protected  void exportFrame(JRPrintFrame frame)
           
protected  void exportGenericElement(JRGenericPrintElement element)
           
protected  void exportImage(JRPrintImage image)
           
protected  void exportLine(JRPrintLine line)
           
protected  void exportPage(JRPrintPage page)
           
protected  void exportRectangle(JRPrintGraphicElement element)
           
 void exportReport()
          Actually starts the export process.
protected  void exportReportToWriter()
           
protected  void exportStyledText(JRStyledText styledText, java.util.Locale locale)
           
protected  void exportStyledText(JRStyledText styledText, java.lang.String tooltip, java.util.Locale locale)
           
protected  void exportStyledTextRun(java.util.Map<java.text.AttributedCharacterIterator.Attribute,java.lang.Object> attributes, java.lang.String text, java.util.Locale locale)
           
protected  void exportStyledTextRun(java.util.Map<java.text.AttributedCharacterIterator.Attribute,java.lang.Object> attributes, java.lang.String text, java.lang.String tooltip, java.util.Locale locale)
           
protected  void exportText(JRPrintText text)
           
protected  JRPrintElementIndex getElementIndex()
           
 JasperPrint getExportedReport()
           
protected  java.lang.String getExporterKey()
           
 java.util.Map<JRExporterParameter,java.lang.Object> getExportParameters()
           
 java.lang.String getExportPropertiesPrefix()
           
protected  java.lang.String getHyperlinkTarget(JRPrintHyperlink link)
           
protected  java.lang.String getHyperlinkURL(JRPrintHyperlink link)
           
static JRPrintImage getImage(java.util.List<JasperPrint> jasperPrintList, JRPrintElementIndex imageIndex)
           
static JRPrintImage getImage(java.util.List<JasperPrint> jasperPrintList, java.lang.String imageName)
           
static java.lang.String getImageName(JRPrintElementIndex printElementIndex)
           
protected  int getInsideBorderOffset(float borderWidth, boolean small)
           
static JRPrintElementIndex getPrintElementIndex(java.lang.String imageName)
           
protected  JRStyledText getStyledText(JRPrintText textElement, boolean setBackcolor)
           
protected  boolean startHyperlink(JRPrintHyperlink link)
           
 java.lang.String toSizeUnit(int size)
           
 int toZoom(int size)
           
protected  void writeImageAreaCoordinates(int[] coords)
           
protected  void writeImageAreaHyperlink(JRPrintHyperlink hyperlink)
           
protected  void writeImageMap(java.lang.String imageMapName, JRPrintImage image, java.util.List<JRPrintImageAreaHyperlink> imageMapAreas)
           
 
Methods inherited from class net.sf.jasperreports.engine.JRAbstractExporter
createFilter, defaultParseNumber, getBooleanCellValue, getBooleanParameter, getCharacterParameter, getCustomHandler, getDateCellValue, getDateFormat, getFloatParameter, getHyperlinkProducer, getIntegerParameter, getJasperReportsContext, getLocale, getNumberCellValue, getNumberFormat, getOffsetX, getOffsetY, getParameter, getParameterResolver, getParameters, getPropertiesUtil, getReportContext, getStringArrayParameter, getStringParameter, getStringParameterOrDefault, 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

XHTML_EXPORTER_KEY

public static final java.lang.String XHTML_EXPORTER_KEY
The exporter key, as used in GenericElementHandlerEnviroment.getHandler(net.sf.jasperreports.engine.JRGenericElementType, String).

See Also:
Constant Field Values

JR_PAGE_ANCHOR_PREFIX

protected static final java.lang.String JR_PAGE_ANCHOR_PREFIX
See Also:
Constant Field Values

DEFAULT_ZOOM

protected static final float DEFAULT_ZOOM
See Also:
Constant Field Values

CSS_TEXT_ALIGN_LEFT

protected static final java.lang.String CSS_TEXT_ALIGN_LEFT
See Also:
Constant Field Values

CSS_TEXT_ALIGN_RIGHT

protected static final java.lang.String CSS_TEXT_ALIGN_RIGHT
See Also:
Constant Field Values

CSS_TEXT_ALIGN_CENTER

protected static final java.lang.String CSS_TEXT_ALIGN_CENTER
See Also:
Constant Field Values

CSS_TEXT_ALIGN_JUSTIFY

protected static final java.lang.String CSS_TEXT_ALIGN_JUSTIFY
See Also:
Constant Field Values

HTML_VERTICAL_ALIGN_TOP

protected static final java.lang.String HTML_VERTICAL_ALIGN_TOP
See Also:
Constant Field Values

HTML_VERTICAL_ALIGN_MIDDLE

protected static final java.lang.String HTML_VERTICAL_ALIGN_MIDDLE
See Also:
Constant Field Values

HTML_VERTICAL_ALIGN_BOTTOM

protected static final java.lang.String HTML_VERTICAL_ALIGN_BOTTOM
See Also:
Constant Field Values

IMAGE_NAME_PREFIX

public static final java.lang.String IMAGE_NAME_PREFIX
See Also:
Constant Field Values

IMAGE_NAME_PREFIX_LEGTH

protected static final int IMAGE_NAME_PREFIX_LEGTH

writer

protected java.io.Writer writer

progressMonitor

protected JRExportProgressMonitor progressMonitor

rendererToImagePathMap

protected java.util.Map<java.lang.String,java.lang.String> rendererToImagePathMap

imageMaps

protected java.util.Map<Pair<java.lang.String,java.awt.Rectangle>,java.lang.String> imageMaps

imageNameToImageDataMap

protected java.util.Map<java.lang.String,byte[]> imageNameToImageDataMap

imagesToProcess

protected java.util.List<JRPrintElementIndex> imagesToProcess

reportIndex

protected int reportIndex

pageIndex

protected int pageIndex

frameInfoStack

protected java.util.List<net.sf.jasperreports.engine.export.JRXhtmlExporter.FrameInfo> frameInfoStack

elementIndex

protected int elementIndex

topLimit

protected int topLimit

leftLimit

protected int leftLimit

rightLimit

protected int rightLimit

bottomLimit

protected int bottomLimit

imagesDir

protected java.io.File imagesDir

imagesURI

protected java.lang.String imagesURI

isOutputImagesToDir

protected boolean isOutputImagesToDir

isWhitePageBackground

protected boolean isWhitePageBackground

encoding

protected java.lang.String encoding

sizeUnit

protected java.lang.String sizeUnit

zoom

protected float zoom

isWrapBreakWord

protected boolean isWrapBreakWord

isIgnorePageMargins

protected boolean isIgnorePageMargins

htmlHeader

protected java.lang.String htmlHeader

betweenPagesHtml

protected java.lang.String betweenPagesHtml

htmlFooter

protected java.lang.String htmlFooter

targetProducerFactory

protected JRHyperlinkTargetProducerFactory targetProducerFactory

hyperlinkStarted

protected boolean hyperlinkStarted

exporterContext

protected JRHtmlExporterContext exporterContext
Constructor Detail

JRXhtmlExporter

public JRXhtmlExporter()
See Also:
JRXhtmlExporter(JasperReportsContext)

JRXhtmlExporter

public JRXhtmlExporter(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(java.util.List<JasperPrint> jasperPrintList,
                                    java.lang.String imageName)

getImage

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

exportReportToWriter

protected void exportReportToWriter()
                             throws JRException,
                                    java.io.IOException
Throws:
JRException
java.io.IOException

exportPage

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

exportElements

protected void exportElements(java.util.List<JRPrintElement> elements)
                       throws java.io.IOException,
                              JRException
Throws:
java.io.IOException
JRException

exportLine

protected void exportLine(JRPrintLine line)
                   throws java.io.IOException
Throws:
java.io.IOException

exportRectangle

protected void exportRectangle(JRPrintGraphicElement element)
                        throws java.io.IOException
Throws:
java.io.IOException

exportStyledText

protected void exportStyledText(JRStyledText styledText,
                                java.util.Locale locale)
                         throws java.io.IOException
Throws:
java.io.IOException

exportStyledText

protected void exportStyledText(JRStyledText styledText,
                                java.lang.String tooltip,
                                java.util.Locale locale)
                         throws java.io.IOException
Throws:
java.io.IOException

exportStyledTextRun

protected void exportStyledTextRun(java.util.Map<java.text.AttributedCharacterIterator.Attribute,java.lang.Object> attributes,
                                   java.lang.String text,
                                   java.util.Locale locale)
                            throws java.io.IOException
Throws:
java.io.IOException

exportStyledTextRun

protected void exportStyledTextRun(java.util.Map<java.text.AttributedCharacterIterator.Attribute,java.lang.Object> attributes,
                                   java.lang.String text,
                                   java.lang.String tooltip,
                                   java.util.Locale locale)
                            throws java.io.IOException
Throws:
java.io.IOException

exportText

protected void exportText(JRPrintText text)
                   throws java.io.IOException
Throws:
java.io.IOException

startHyperlink

protected boolean startHyperlink(JRPrintHyperlink link)
                          throws java.io.IOException
Throws:
java.io.IOException

getHyperlinkTarget

protected java.lang.String getHyperlinkTarget(JRPrintHyperlink link)

getHyperlinkURL

protected java.lang.String getHyperlinkURL(JRPrintHyperlink link)

endHyperlink

protected void endHyperlink()
                     throws java.io.IOException
Throws:
java.io.IOException

appendBorderStyle

protected boolean appendBorderStyle(JRLineBox box,
                                    java.lang.StringBuffer styleBuffer)

getInsideBorderOffset

protected int getInsideBorderOffset(float borderWidth,
                                    boolean small)

appendSizeStyle

protected void appendSizeStyle(JRPrintElement element,
                               JRBoxContainer boxContainer,
                               java.lang.StringBuffer styleBuffer)

appendSizeStyle

protected void appendSizeStyle(JRPrintElement element,
                               JRPen pen,
                               java.lang.StringBuffer styleBuffer)

appendSizeStyle

protected void appendSizeStyle(int width,
                               int height,
                               java.lang.StringBuffer styleBuffer)

appendPositionStyle

protected void appendPositionStyle(JRPrintElement element,
                                   JRBoxContainer boxContainer,
                                   java.lang.StringBuffer styleBuffer)

appendPositionStyle

protected void appendPositionStyle(JRPrintElement element,
                                   JRPen pen,
                                   java.lang.StringBuffer styleBuffer)

appendPositionStyle

protected void appendPositionStyle(int x,
                                   int y,
                                   java.lang.StringBuffer styleBuffer)

appendBackcolorStyle

protected void appendBackcolorStyle(JRPrintElement element,
                                    java.lang.StringBuffer styleBuffer)

exportImage

protected void exportImage(JRPrintImage image)
                    throws JRException,
                           java.io.IOException
Throws:
JRException
java.io.IOException

getElementIndex

protected JRPrintElementIndex getElementIndex()

writeImageMap

protected void writeImageMap(java.lang.String imageMapName,
                             JRPrintImage image,
                             java.util.List<JRPrintImageAreaHyperlink> imageMapAreas)
                      throws java.io.IOException
Throws:
java.io.IOException

writeImageAreaCoordinates

protected void writeImageAreaCoordinates(int[] coords)
                                  throws java.io.IOException
Throws:
java.io.IOException

writeImageAreaHyperlink

protected void writeImageAreaHyperlink(JRPrintHyperlink hyperlink)
                                throws java.io.IOException
Throws:
java.io.IOException

getImageName

public static java.lang.String getImageName(JRPrintElementIndex printElementIndex)

getPrintElementIndex

public static JRPrintElementIndex getPrintElementIndex(java.lang.String imageName)

exportFrame

protected void exportFrame(JRPrintFrame frame)
                    throws java.io.IOException,
                           JRException
Throws:
java.io.IOException
JRException

exportGenericElement

protected void exportGenericElement(JRGenericPrintElement element)
                             throws java.io.IOException
Throws:
java.io.IOException

getExportParameters

public java.util.Map<JRExporterParameter,java.lang.Object> getExportParameters()

getExportPropertiesPrefix

public java.lang.String getExportPropertiesPrefix()

getExportedReport

public JasperPrint getExportedReport()

toSizeUnit

public java.lang.String toSizeUnit(int size)

toZoom

public int toZoom(int size)

getStyledText

protected JRStyledText getStyledText(JRPrintText textElement,
                                     boolean setBackcolor)
Overrides:
getStyledText in class JRAbstractExporter

getExporterKey

protected java.lang.String getExporterKey()
Specified by:
getExporterKey in class JRAbstractExporter


© 2001-2010 Jaspersoft Corporation www.jaspersoft.com