net.sf.jasperreports.engine
Class JRAbstractExporter

java.lang.Object
  extended by net.sf.jasperreports.engine.JRAbstractExporter
All Implemented Interfaces:
JRExporter
Direct Known Subclasses:
JRAbstractCsvExporter, JRDocxExporter, JRGraphics2DExporter, JRHtmlExporter, JROpenDocumentExporter, JRPdfExporter, JRPptxExporter, JRPrintServiceExporter, JRRtfExporter, JRTextExporter, JRXhtmlExporter, JRXlsAbstractExporter, JRXmlExporter

public abstract class JRAbstractExporter
extends java.lang.Object
implements JRExporter

Version:
$Id: JRAbstractExporter.java 5180 2012-03-29 13:23:12Z teodord $
Author:
Teodor Danciu (teodord@users.sourceforge.net)

Nested Class Summary
 class JRAbstractExporter.BaseExporterContext
           
protected  class JRAbstractExporter.ParameterOverriddenResolver
           
protected  class JRAbstractExporter.ParameterOverrideResolver
           
protected static interface JRAbstractExporter.ParameterResolver
           
 
Field Summary
protected  java.util.Map<java.lang.String,java.text.DateFormat> dateFormatCache
           
protected  int endPageIndex
           
protected  ExporterFilter filter
           
protected  java.util.Map<java.lang.String,java.lang.String> fontMap
           
protected  int globalOffsetX
           
protected  int globalOffsetY
           
protected  JRHyperlinkProducerFactory hyperlinkProducerFactory
           
protected  boolean isModeBatch
           
protected  JasperPrint jasperPrint
           
protected  java.util.List<JasperPrint> jasperPrintList
           
protected  JasperReportsContext jasperReportsContext
           
protected  java.util.Map<java.lang.String,java.text.NumberFormat> numberFormatCache
           
protected  java.util.Map<JRExporterParameter,java.lang.Object> parameters
           
static java.lang.String PROPERTY_DEFAULT_FILTER_FACTORY
          A property that gives the generic default filter factory class name.
static java.lang.String PROPERTY_SUFFIX_DEFAULT_FILTER_FACTORY
          The suffix applied to properties that give the default filter factory for a specific exporter.
protected  int startPageIndex
           
 
Constructor Summary
protected JRAbstractExporter()
          Deprecated. Replaced by JRAbstractExporter(JasperReportsContext).
protected JRAbstractExporter(JasperReportsContext jasperReportsContext)
           
 
Method Summary
protected  ExporterFilter createFilter(java.lang.String exportPropertyPrefix)
           
protected  java.lang.Number defaultParseNumber(java.lang.String textStr, java.lang.Class<?> valueClass)
           
abstract  void exportReport()
          Actually starts the export process.
protected  TextValue getBooleanCellValue(JRPrintText text, java.lang.String textStr)
           
 boolean getBooleanParameter(JRExporterParameter parameter, java.lang.String property, boolean defaultValue)
           
 java.lang.Character getCharacterParameter(JRExporterParameter parameter, java.lang.String property)
           
protected  JRHyperlinkProducer getCustomHandler(JRPrintHyperlink link)
          Deprecated. Replaced by getHyperlinkProducer(JRPrintHyperlink).
protected  TextValue getDateCellValue(JRPrintText text, java.lang.String textStr)
           
protected  java.text.DateFormat getDateFormat(java.lang.String formatFactoryClass, java.lang.String pattern, java.util.Locale lc, java.util.TimeZone tz)
           
protected abstract  java.lang.String getExporterKey()
           
 float getFloatParameter(JRExporterParameter parameter, java.lang.String property, float defaultValue)
           
protected  JRHyperlinkProducer getHyperlinkProducer(JRPrintHyperlink link)
           
 int getIntegerParameter(JRExporterParameter parameter, java.lang.String property, int defaultValue)
           
 JasperReportsContext getJasperReportsContext()
           
protected  java.util.Locale getLocale()
           
protected  TextValue getNumberCellValue(JRPrintText text, java.lang.String textStr)
           
protected  java.text.NumberFormat getNumberFormat(java.lang.String formatFactoryClass, java.lang.String pattern, java.util.Locale lc)
           
protected  int getOffsetX()
          Returns the X axis offset used for element export.
protected  int getOffsetY()
          Returns the Y axis offset used for element export.
 java.lang.Object getParameter(JRExporterParameter parameter)
          Gets an export parameter.
protected  JRAbstractExporter.ParameterResolver getParameterResolver()
           
 java.util.Map<JRExporterParameter,java.lang.Object> getParameters()
          Gets a map containing all export parameters.
 JRPropertiesUtil getPropertiesUtil()
           
 ReportContext getReportContext()
           
 java.lang.String[] getStringArrayParameter(JRExporterParameter parameter, java.lang.String property)
           
 java.lang.String getStringParameter(JRExporterParameter parameter, java.lang.String property)
           
 java.lang.String getStringParameterOrDefault(JRExporterParameter parameter, java.lang.String property)
           
protected  JRStyledText getStyledText(JRPrintText textElement)
           
protected  JRStyledText getStyledText(JRPrintText textElement, boolean setBackcolor)
           
protected  java.lang.String getTextFormatFactoryClass(JRPrintText text)
           
protected  java.util.Locale getTextLocale(JRPrintText text)
           
protected  java.util.TimeZone getTextTimeZone(JRPrintText text)
           
protected  TextValue getTextValue(JRPrintText text, java.lang.String textStr)
           
protected  TextValue getTextValueString(JRPrintText text, java.lang.String textStr)
           
 void reset()
           
protected  void resetClassLoader()
          Deprecated. replaced by resetExportContext
protected  void resetExportContext()
           
protected  void restoreElementOffsets()
          Restores offsets after a call to setFrameElementsOffset.
protected  void setClassLoader()
          Deprecated. replaced by setExportContext
protected  void setExportContext()
           
protected  void setFontMap()
           
protected  void setFrameElementsOffset(JRPrintFrame frame, boolean relative)
          Sets the offsets for exporting elements from a frame.
protected  void setHyperlinkProducerFactory()
           
protected  void setInput()
           
protected  void setJasperPrint(JasperPrint jasperPrint)
           
protected  void setOffset()
           
protected  void setOffset(boolean setElementOffsets)
           
protected  void setOutput()
           
protected  void setPageRange()
           
 void setParameter(JRExporterParameter parameter, java.lang.Object value)
          Sets an export parameter for advanced customization of the export process.
 void setParameters(java.util.Map<JRExporterParameter,java.lang.Object> parameters)
          Sets export parameters from a specified map.
 void setReportContext(ReportContext reportContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_DEFAULT_FILTER_FACTORY

public static final java.lang.String PROPERTY_DEFAULT_FILTER_FACTORY
A property that gives the generic default filter factory class name.

See Also:
PROPERTY_SUFFIX_DEFAULT_FILTER_FACTORY, Constant Field Values

PROPERTY_SUFFIX_DEFAULT_FILTER_FACTORY

public static final java.lang.String PROPERTY_SUFFIX_DEFAULT_FILTER_FACTORY
The suffix applied to properties that give the default filter factory for a specific exporter. For instance, the default filter factory for XLS exporters is net.sf.jasperreports.export.xls.default.filter.factory. If this property is not defined for a specific exporter, the generic exporter factory given by PROPERTY_DEFAULT_FILTER_FACTORY is used.

See Also:
Constant Field Values

jasperReportsContext

protected JasperReportsContext jasperReportsContext

parameters

protected java.util.Map<JRExporterParameter,java.lang.Object> parameters

jasperPrintList

protected java.util.List<JasperPrint> jasperPrintList

jasperPrint

protected JasperPrint jasperPrint

isModeBatch

protected boolean isModeBatch

startPageIndex

protected int startPageIndex

endPageIndex

protected int endPageIndex

globalOffsetX

protected int globalOffsetX

globalOffsetY

protected int globalOffsetY

filter

protected ExporterFilter filter

fontMap

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

dateFormatCache

protected java.util.Map<java.lang.String,java.text.DateFormat> dateFormatCache

numberFormatCache

protected java.util.Map<java.lang.String,java.text.NumberFormat> numberFormatCache

hyperlinkProducerFactory

protected JRHyperlinkProducerFactory hyperlinkProducerFactory
Constructor Detail

JRAbstractExporter

protected JRAbstractExporter()
Deprecated. Replaced by JRAbstractExporter(JasperReportsContext).


JRAbstractExporter

protected JRAbstractExporter(JasperReportsContext jasperReportsContext)
Method Detail

reset

public void reset()

setParameter

public void setParameter(JRExporterParameter parameter,
                         java.lang.Object value)
Description copied from interface: JRExporter
Sets an export parameter for advanced customization of the export process. Parameters can be either common parameters or specialized ones, depending on the exporter type.

Specified by:
setParameter in interface JRExporter
Parameters:
parameter - the parameter, selected from the static parameters defined by JasperReports
value - the parameter value
See Also:
JRExporterParameter

getParameter

public java.lang.Object getParameter(JRExporterParameter parameter)
Description copied from interface: JRExporter
Gets an export parameter.

Specified by:
getParameter in interface JRExporter

setParameters

public void setParameters(java.util.Map<JRExporterParameter,java.lang.Object> parameters)
Description copied from interface: JRExporter
Sets export parameters from a specified map.

Specified by:
setParameters in interface JRExporter
See Also:
JRExporter.setParameter(JRExporterParameter, Object)

getParameters

public java.util.Map<JRExporterParameter,java.lang.Object> getParameters()
Description copied from interface: JRExporter
Gets a map containing all export parameters.

Specified by:
getParameters in interface JRExporter

getParameterResolver

protected JRAbstractExporter.ParameterResolver getParameterResolver()

getStringParameter

public java.lang.String getStringParameter(JRExporterParameter parameter,
                                           java.lang.String property)

getStringArrayParameter

public java.lang.String[] getStringArrayParameter(JRExporterParameter parameter,
                                                  java.lang.String property)

getStringParameterOrDefault

public java.lang.String getStringParameterOrDefault(JRExporterParameter parameter,
                                                    java.lang.String property)

getBooleanParameter

public boolean getBooleanParameter(JRExporterParameter parameter,
                                   java.lang.String property,
                                   boolean defaultValue)

getIntegerParameter

public int getIntegerParameter(JRExporterParameter parameter,
                               java.lang.String property,
                               int defaultValue)

getFloatParameter

public float getFloatParameter(JRExporterParameter parameter,
                               java.lang.String property,
                               float defaultValue)

getCharacterParameter

public java.lang.Character getCharacterParameter(JRExporterParameter parameter,
                                                 java.lang.String property)

getJasperReportsContext

public JasperReportsContext getJasperReportsContext()

setReportContext

public void setReportContext(ReportContext reportContext)
Specified by:
setReportContext in interface JRExporter

getReportContext

public ReportContext getReportContext()
Specified by:
getReportContext in interface JRExporter

getPropertiesUtil

public JRPropertiesUtil getPropertiesUtil()

exportReport

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

Specified by:
exportReport in interface JRExporter
Throws:
JRException

setOffset

protected void setOffset()

setOffset

protected void setOffset(boolean setElementOffsets)

setExportContext

protected void setExportContext()

resetExportContext

protected void resetExportContext()

setClassLoader

protected void setClassLoader()
Deprecated. replaced by setExportContext


resetClassLoader

protected void resetClassLoader()
Deprecated. replaced by resetExportContext


setJasperPrint

protected void setJasperPrint(JasperPrint jasperPrint)

setInput

protected void setInput()
                 throws JRException
Throws:
JRException

setPageRange

protected void setPageRange()
                     throws JRException
Throws:
JRException

getStyledText

protected JRStyledText getStyledText(JRPrintText textElement,
                                     boolean setBackcolor)

getStyledText

protected JRStyledText getStyledText(JRPrintText textElement)

setOutput

protected void setOutput()

getOffsetX

protected int getOffsetX()
Returns the X axis offset used for element export.

This method should be used istead of globalOffsetX when exporting elements.

Returns:
the X axis offset

getOffsetY

protected int getOffsetY()
Returns the Y axis offset used for element export.

This method should be used istead of globalOffsetY when exporting elements.

Returns:
the Y axis offset

setFrameElementsOffset

protected void setFrameElementsOffset(JRPrintFrame frame,
                                      boolean relative)
Sets the offsets for exporting elements from a frame.

After the frame elements are exported, a call to popElementOffsets is required so that the previous offsets are resored.

Parameters:
frame -
relative -
See Also:
getOffsetX(), getOffsetY(), restoreElementOffsets()

restoreElementOffsets

protected void restoreElementOffsets()
Restores offsets after a call to setFrameElementsOffset.


getTextFormatFactoryClass

protected java.lang.String getTextFormatFactoryClass(JRPrintText text)

getLocale

protected java.util.Locale getLocale()

getTextLocale

protected java.util.Locale getTextLocale(JRPrintText text)

getTextTimeZone

protected java.util.TimeZone getTextTimeZone(JRPrintText text)

getTextValue

protected TextValue getTextValue(JRPrintText text,
                                 java.lang.String textStr)

getTextValueString

protected TextValue getTextValueString(JRPrintText text,
                                       java.lang.String textStr)

getDateCellValue

protected TextValue getDateCellValue(JRPrintText text,
                                     java.lang.String textStr)
                              throws java.text.ParseException
Throws:
java.text.ParseException

getNumberCellValue

protected TextValue getNumberCellValue(JRPrintText text,
                                       java.lang.String textStr)
                                throws java.text.ParseException,
                                       java.lang.ClassNotFoundException
Throws:
java.text.ParseException
java.lang.ClassNotFoundException

defaultParseNumber

protected java.lang.Number defaultParseNumber(java.lang.String textStr,
                                              java.lang.Class<?> valueClass)

getBooleanCellValue

protected TextValue getBooleanCellValue(JRPrintText text,
                                        java.lang.String textStr)

getDateFormat

protected java.text.DateFormat getDateFormat(java.lang.String formatFactoryClass,
                                             java.lang.String pattern,
                                             java.util.Locale lc,
                                             java.util.TimeZone tz)

getNumberFormat

protected java.text.NumberFormat getNumberFormat(java.lang.String formatFactoryClass,
                                                 java.lang.String pattern,
                                                 java.util.Locale lc)

createFilter

protected ExporterFilter createFilter(java.lang.String exportPropertyPrefix)
                               throws JRException
Throws:
JRException

setFontMap

protected void setFontMap()

setHyperlinkProducerFactory

protected void setHyperlinkProducerFactory()

getHyperlinkProducer

protected JRHyperlinkProducer getHyperlinkProducer(JRPrintHyperlink link)

getCustomHandler

protected JRHyperlinkProducer getCustomHandler(JRPrintHyperlink link)
Deprecated. Replaced by getHyperlinkProducer(JRPrintHyperlink).


getExporterKey

protected abstract java.lang.String getExporterKey()
                                            throws JRException
Throws:
JRException


© 2001-2010 Jaspersoft Corporation www.jaspersoft.com