net.sf.jasperreports.engine
Class JRAbstractExporter

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

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

Version:
$Id: JRAbstractExporter.java 3188 2009-11-06 10:01:57Z 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.lang.ClassLoader classLoader
           
protected  boolean classLoaderSet
           
protected  java.util.Map dateFormatCache
           
protected  int endPageIndex
           
protected  FileResolver fileResolver
           
protected  boolean fileResolverSet
           
protected  ExporterFilter filter
           
protected  int globalOffsetX
           
protected  int globalOffsetY
           
protected  JRHyperlinkProducerFactory hyperlinkProducerFactory
           
protected  boolean isModeBatch
           
protected  JasperPrint jasperPrint
           
protected  java.util.List jasperPrintList
           
protected  java.util.Map numberFormatCache
           
protected  java.util.Map parameters
           
static java.lang.String PROPERTY_CELL_FORMULA
          Property that stores the formula which has to be applied to a given cell in an excel sheet.
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
           
protected  java.net.URLStreamHandlerFactory urlHandlerFactory
           
protected  boolean urlHandlerFactorySet
           
 
Constructor Summary
protected JRAbstractExporter()
           
 
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)
           
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 getParameters()
          Gets a map containing all export parameters.
 java.lang.Object getParameters(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 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 parameters)
          Sets export parameters from a specified map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_CELL_FORMULA

public static final java.lang.String PROPERTY_CELL_FORMULA
Property that stores the formula which has to be applied to a given cell in an excel sheet.

See Also:
Constant Field Values

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

parameters

protected java.util.Map parameters

jasperPrintList

protected java.util.List 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

classLoader

protected java.lang.ClassLoader classLoader

classLoaderSet

protected boolean classLoaderSet

urlHandlerFactory

protected java.net.URLStreamHandlerFactory urlHandlerFactory

urlHandlerFactorySet

protected boolean urlHandlerFactorySet

fileResolver

protected FileResolver fileResolver

fileResolverSet

protected boolean fileResolverSet

filter

protected ExporterFilter filter

dateFormatCache

protected java.util.Map dateFormatCache

numberFormatCache

protected java.util.Map numberFormatCache

hyperlinkProducerFactory

protected JRHyperlinkProducerFactory hyperlinkProducerFactory
Constructor Detail

JRAbstractExporter

protected JRAbstractExporter()
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 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 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)

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)

getParameters

public java.lang.Object getParameters(JRExporterParameter parameter,
                                      java.lang.String property)

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)

getBooleanCellValue

protected TextValue getBooleanCellValue(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)

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

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-2009 Jaspersoft Corporation www.jaspersoft.com