Package net.sf.jasperreports.engine
Class JRAbstractExporter<RC extends ReportExportConfiguration,C extends ExporterConfiguration,O extends ExporterOutput,E extends JRExporterContext>
- java.lang.Object
-
- net.sf.jasperreports.engine.JRAbstractExporter<RC,C,O,E>
-
- All Implemented Interfaces:
JRExporter<ExporterInput,RC,C,O>,Exporter<ExporterInput,RC,C,O>
- Direct Known Subclasses:
AbstractHtmlExporter,ExcelAbstractExporter,JRAbstractCsvExporter,JRDocxExporter,JRGraphics2DExporter,JROdtExporter,JRPdfExporter,JRPptxExporter,JRPrintServiceExporter,JRRtfExporter,JRTextExporter,JRXmlExporter,JsonExporter,JsonMetadataExporter
public abstract class JRAbstractExporter<RC extends ReportExportConfiguration,C extends ExporterConfiguration,O extends ExporterOutput,E extends JRExporterContext> extends java.lang.Object implements JRExporter<ExporterInput,RC,C,O>
- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classJRAbstractExporter.BaseExporterContextclassJRAbstractExporter.PageRange
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protectedJRAbstractExporter(JasperReportsContext jasperReportsContext)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidcheckInterrupted()protected ExporterFiltercreateFilter()protected java.lang.NumberdefaultParseNumber(java.lang.String textStr, java.lang.Class<?> valueClass)protected voidensureInput()protected voidensureJasperReportsContext()protected abstract voidensureOutput()abstract voidexportReport()Performs the export.protected TextValuegetBooleanCellValue(JRPrintText text, java.lang.String textStr)protected abstract java.lang.Class<C>getConfigurationInterface()protected CgetCurrentConfiguration()protected RCgetCurrentItemConfiguration()JasperPrintgetCurrentJasperPrint()protected TextValuegetDateCellValue(JRPrintText text, java.lang.String textStr)protected java.text.DateFormatgetDateFormat(java.lang.String formatFactoryClass, java.lang.String pattern, java.util.Locale lc, java.util.TimeZone tz)EgetExporterContext()protected ExporterInputgetExporterInput()abstract java.lang.StringgetExporterKey()OgetExporterOutput()abstract java.lang.StringgetExporterPropertiesPrefix()Returns the properties prefix for the current exporter.JRHyperlinkProducergetHyperlinkProducer(JRPrintHyperlink link)protected abstract java.lang.Class<RC>getItemConfigurationInterface()JasperReportsContextgetJasperReportsContext()java.util.LocalegetLocale()protected TextValuegetNumberCellValue(JRPrintText text, java.lang.String textStr)protected java.text.NumberFormatgetNumberFormat(java.lang.String formatFactoryClass, java.lang.String pattern, java.util.Locale lc)protected intgetOffsetX()Returns the X axis offset used for element export.protected intgetOffsetY()Returns the Y axis offset used for element export.protected JRAbstractExporter.PageRangegetPageRange()java.lang.ObjectgetParameter(JRExporterParameter parameter)java.util.Map<JRExporterParameter,java.lang.Object>getParameters()JRPropertiesUtilgetPropertiesUtil()RendererUtilgetRendererUtil()ReportContextgetReportContext()RepositoryUtilgetRepository()protected JRStyledTextgetStyledText(JRPrintText textElement)protected JRStyledTextgetStyledText(JRPrintText textElement, boolean setBackcolor)protected java.lang.StringgetTextFormatFactoryClass(JRPrintText text)protected java.util.LocalegetTextLocale(JRPrintText text)protected java.util.TimeZonegetTextTimeZone(JRPrintText text)protected TextValuegetTextValue(JRPrintText text, java.lang.String textStr)protected TextValuegetTextValueString(JRPrintText text, java.lang.String textStr)protected voidinitExport()protected voidinitReport()protected booleaninsideFrame()voidreset()protected voidresetClassLoader()Deprecated.replaced byresetExportContextprotected voidresetExportContext()protected voidrestoreElementOffsets()Restores offsets after a call tosetFrameElementsOffset.protected voidsetClassLoader()Deprecated.replaced bysetExportContextvoidsetConfiguration(C configuration)voidsetConfiguration(RC configuration)protected voidsetCurrentExporterInputItem(ExporterInputItem crtItem)voidsetExporterInput(ExporterInput exporterInput)Provides the input for this exporter.voidsetExporterOutput(O exporterOutput)Provides the output for this exporter.protected voidsetFrameElementsOffset(JRPrintFrame frame, boolean relative)Sets the offsets for exporting elements from aframe.protected voidsetJasperReportsContext(JasperReportsContext jasperReportsContext)protected voidsetOffset()protected voidsetOffset(boolean setElementOffsets)voidsetParameter(JRExporterParameter parameter, java.lang.Object value)voidsetParameters(java.util.Map<JRExporterParameter,java.lang.Object> parameters)voidsetReportContext(ReportContext reportContext)
-
-
-
Field Detail
-
EXCEPTION_MESSAGE_KEY_START_PAGE_INDEX_OUT_OF_RANGE
public static final java.lang.String EXCEPTION_MESSAGE_KEY_START_PAGE_INDEX_OUT_OF_RANGE
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_END_PAGE_INDEX_OUT_OF_RANGE
public static final java.lang.String EXCEPTION_MESSAGE_KEY_END_PAGE_INDEX_OUT_OF_RANGE
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_INVALID_IMAGE_NAME
public static final java.lang.String EXCEPTION_MESSAGE_KEY_INVALID_IMAGE_NAME
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_INVALID_ZOOM_RATIO
public static final java.lang.String EXCEPTION_MESSAGE_KEY_INVALID_ZOOM_RATIO
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_MIXED_CALLS_NOT_ALLOWED
public static final java.lang.String EXCEPTION_MESSAGE_KEY_MIXED_CALLS_NOT_ALLOWED
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_PAGE_INDEX_OUT_OF_RANGE
public static final java.lang.String EXCEPTION_MESSAGE_KEY_PAGE_INDEX_OUT_OF_RANGE
- See Also:
- Constant Field Values
-
EXCEPTION_MESSAGE_KEY_OUTPUT_WRITER_ERROR
public static final java.lang.String EXCEPTION_MESSAGE_KEY_OUTPUT_WRITER_ERROR
- See Also:
- 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 isnet.sf.jasperreports.export.xls.default.filter.factory. If this property is not defined for a specific exporter, the generic exporter factory given byPROPERTY_DEFAULT_FILTER_FACTORYis used.- 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.
-
jasperReportsContext
protected JasperReportsContext jasperReportsContext
-
propertiesUtil
protected JRPropertiesUtil propertiesUtil
-
rendererUtil
protected RendererUtil rendererUtil
-
allSelector
protected JRStyledTextAttributeSelector allSelector
-
noBackcolorSelector
protected JRStyledTextAttributeSelector noBackcolorSelector
-
noneSelector
protected JRStyledTextAttributeSelector noneSelector
-
styledTextUtil
protected JRStyledTextUtil styledTextUtil
-
fontUtil
protected FontUtil fontUtil
-
parameters
protected java.util.Map<JRExporterParameter,java.lang.Object> parameters
-
exporterInput
protected ExporterInput exporterInput
-
itemConfiguration
protected RC extends ReportExportConfiguration itemConfiguration
-
exporterConfiguration
protected C extends ExporterConfiguration exporterConfiguration
-
exporterOutput
protected O extends ExporterOutput exporterOutput
-
crtItem
protected ExporterInputItem crtItem
-
crtCompositeItemConfiguration
protected RC extends ReportExportConfiguration crtCompositeItemConfiguration
-
crtCompositeConfiguration
protected C extends ExporterConfiguration crtCompositeConfiguration
-
jasperPrint
protected JasperPrint jasperPrint
-
filter
protected ExporterFilter filter
-
dateFormatCache
protected java.util.Map<java.lang.String,java.text.DateFormat> dateFormatCache
-
numberFormatCache
protected java.util.Map<java.lang.String,java.text.NumberFormat> numberFormatCache
-
textValueClasses
protected java.util.Map<java.lang.String,java.lang.Class<?>> textValueClasses
-
exporterContext
protected E extends JRExporterContext exporterContext
-
hyperlinkProducerFactory
protected JRHyperlinkProducerFactory hyperlinkProducerFactory
-
-
Constructor Detail
-
JRAbstractExporter
protected JRAbstractExporter(JasperReportsContext jasperReportsContext)
-
-
Method Detail
-
reset
public void reset()
-
setParameter
public void setParameter(JRExporterParameter parameter, java.lang.Object value)
Deprecated.Description copied from interface:JRExporterSets 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:
setParameterin interfaceJRExporter<RC extends ReportExportConfiguration,C extends ExporterConfiguration,O extends ExporterOutput,E extends JRExporterContext>- Parameters:
parameter- the parameter, selected from the static parameters defined by JasperReportsvalue- the parameter value- See Also:
JRExporterParameter
-
getParameter
public java.lang.Object getParameter(JRExporterParameter parameter)
Deprecated.Description copied from interface:JRExporterGets an export parameter.- Specified by:
getParameterin interfaceJRExporter<RC extends ReportExportConfiguration,C extends ExporterConfiguration,O extends ExporterOutput,E extends JRExporterContext>
-
setParameters
public void setParameters(java.util.Map<JRExporterParameter,java.lang.Object> parameters)
Deprecated.Description copied from interface:JRExporterSets export parameters from a specified map.- Specified by:
setParametersin interfaceJRExporter<RC extends ReportExportConfiguration,C extends ExporterConfiguration,O extends ExporterOutput,E extends JRExporterContext>- See Also:
JRExporter.setParameter(JRExporterParameter, Object)
-
getParameters
public java.util.Map<JRExporterParameter,java.lang.Object> getParameters()
Deprecated.Description copied from interface:JRExporterGets a map containing all export parameters.- Specified by:
getParametersin interfaceJRExporter<RC extends ReportExportConfiguration,C extends ExporterConfiguration,O extends ExporterOutput,E extends JRExporterContext>
-
getExporterInput
protected ExporterInput getExporterInput()
-
setExporterInput
public void setExporterInput(ExporterInput exporterInput)
Description copied from interface:ExporterProvides the input for this exporter.- Specified by:
setExporterInputin interfaceExporter<RC extends ReportExportConfiguration,C extends ExporterConfiguration,O extends ExporterOutput,E extends JRExporterContext>
-
getExporterOutput
public O getExporterOutput()
-
setExporterOutput
public void setExporterOutput(O exporterOutput)
Description copied from interface:ExporterProvides the output for this exporter.- Specified by:
setExporterOutputin interfaceExporter<RC extends ReportExportConfiguration,C extends ExporterConfiguration,O extends ExporterOutput,E extends JRExporterContext>
-
setConfiguration
public void setConfiguration(RC configuration)
- Specified by:
setConfigurationin interfaceExporter<RC extends ReportExportConfiguration,C extends ExporterConfiguration,O extends ExporterOutput,E extends JRExporterContext>
-
setConfiguration
public void setConfiguration(C configuration)
- Specified by:
setConfigurationin interfaceExporter<RC extends ReportExportConfiguration,C extends ExporterConfiguration,O extends ExporterOutput,E extends JRExporterContext>
-
getJasperReportsContext
public JasperReportsContext getJasperReportsContext()
-
setJasperReportsContext
protected void setJasperReportsContext(JasperReportsContext jasperReportsContext)
-
setReportContext
public void setReportContext(ReportContext reportContext)
- Specified by:
setReportContextin interfaceExporter<RC extends ReportExportConfiguration,C extends ExporterConfiguration,O extends ExporterOutput,E extends JRExporterContext>
-
getReportContext
public ReportContext getReportContext()
- Specified by:
getReportContextin interfaceExporter<RC extends ReportExportConfiguration,C extends ExporterConfiguration,O extends ExporterOutput,E extends JRExporterContext>
-
getPropertiesUtil
public JRPropertiesUtil getPropertiesUtil()
-
getRendererUtil
public RendererUtil getRendererUtil()
-
getRepository
public RepositoryUtil getRepository()
-
exportReport
public abstract void exportReport() throws JRExceptionDescription copied from interface:ExporterPerforms the export.- Specified by:
exportReportin interfaceExporter<RC extends ReportExportConfiguration,C extends ExporterConfiguration,O extends ExporterOutput,E extends JRExporterContext>- Throws:
JRException
-
checkInterrupted
protected void checkInterrupted() throws ExportInterruptedException- Throws:
ExportInterruptedException
-
setOffset
protected void setOffset()
-
setOffset
protected void setOffset(boolean setElementOffsets)
-
ensureJasperReportsContext
protected void ensureJasperReportsContext()
-
resetExportContext
protected void resetExportContext()
-
setClassLoader
protected void setClassLoader()
Deprecated.replaced bysetExportContext
-
resetClassLoader
protected void resetClassLoader()
Deprecated.replaced byresetExportContext
-
setCurrentExporterInputItem
protected void setCurrentExporterInputItem(ExporterInputItem crtItem)
-
getCurrentItemConfiguration
protected RC getCurrentItemConfiguration()
-
getCurrentConfiguration
protected C getCurrentConfiguration()
-
getConfigurationInterface
protected abstract java.lang.Class<C> getConfigurationInterface()
-
getItemConfigurationInterface
protected abstract java.lang.Class<RC> getItemConfigurationInterface()
-
ensureInput
protected void ensureInput()
-
ensureOutput
protected abstract void ensureOutput()
-
initExport
protected void initExport()
-
initReport
protected void initReport()
-
getPageRange
protected JRAbstractExporter.PageRange getPageRange()
-
getStyledText
protected JRStyledText getStyledText(JRPrintText textElement, boolean setBackcolor)
-
getStyledText
protected JRStyledText getStyledText(JRPrintText textElement)
-
getOffsetX
protected int getOffsetX()
Returns the X axis offset used for element export.- Returns:
- the X axis offset
-
getOffsetY
protected int getOffsetY()
Returns the Y axis offset used for element export.- Returns:
- the Y axis offset
-
setFrameElementsOffset
protected void setFrameElementsOffset(JRPrintFrame frame, boolean relative)
Sets the offsets for exporting elements from aframe.After the frame elements are exported, a call to
popElementOffsetsis required so that the previous offsets are restored.- Parameters:
frame-relative-- See Also:
getOffsetX(),getOffsetY(),restoreElementOffsets()
-
restoreElementOffsets
protected void restoreElementOffsets()
Restores offsets after a call tosetFrameElementsOffset.
-
insideFrame
protected boolean insideFrame()
-
getTextFormatFactoryClass
protected java.lang.String getTextFormatFactoryClass(JRPrintText text)
-
getLocale
public 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.ParseExceptionjava.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()
-
getHyperlinkProducer
public JRHyperlinkProducer getHyperlinkProducer(JRPrintHyperlink link)
-
getExporterKey
public abstract java.lang.String getExporterKey()
-
getExporterPropertiesPrefix
public abstract java.lang.String getExporterPropertiesPrefix()
Returns the properties prefix for the current exporter.- Returns:
- the properties prefix for the current exporter
-
getExporterContext
public E getExporterContext()
-
getCurrentJasperPrint
public JasperPrint getCurrentJasperPrint()
-
-