net.sf.jasperreports.engine.export.oasis
Class JROdtExporter
java.lang.Object
net.sf.jasperreports.engine.JRAbstractExporter
net.sf.jasperreports.engine.export.oasis.JROdtExporter
- All Implemented Interfaces:
- JRExporter
public class JROdtExporter
- 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: JROdtExporter.java 2006 2007-12-05 14:28:33Z teodord $
- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
Fields inherited from class net.sf.jasperreports.engine.JRAbstractExporter |
classLoader, classLoaderSet, dateFormatCache, endPageIndex, filter, globalOffsetX, globalOffsetY, isModeBatch, jasperPrint, jasperPrintList, numberFormatCache, parameters, startPageIndex, urlHandlerFactory, urlHandlerFactorySet |
Method Summary |
protected void |
exportEllipse(TableBuilder tableBuilder,
JRPrintEllipse ellipse,
JRExporterGridCell gridCell)
|
protected void |
exportFrame(TableBuilder tableBuilder,
JRPrintFrame frame,
JRExporterGridCell gridCell)
|
protected void |
exportGrid(JRGridLayout gridLayout,
JRPrintElementIndex frameIndex)
|
protected void |
exportImage(TableBuilder tableBuilder,
JRPrintImage image,
JRExporterGridCell gridCell)
protected boolean startHyperlink(JRPrintHyperlink link) throws IOException
{
String href = getHyperlinkURL(link);
if (href != null)
{
writer.write("");
}
return href != null;
}
protected String getHyperlinkTarget(JRPrintHyperlink link)
{
String target = null;
switch(link.getHyperlinkTarget())
{
case JRHyperlink.HYPERLINK_TARGET_BLANK :
{
target = "_blank";
break;
}
case JRHyperlink.HYPERLINK_TARGET_SELF :
default :
{
break;
}
}
return target;
}
protected String getHyperlinkURL(JRPrintHyperlink link)
{
String href = null;
JRHyperlinkProducer customHandler = getCustomHandler(link);
if (customHandler == null)
{
switch(link.getHyperlinkType())
{
case JRHyperlink.HYPERLINK_TYPE_REFERENCE :
{
if (link.getHyperlinkReference() != null)
{
href = link.getHyperlinkReference();
}
break;
}
case JRHyperlink.HYPERLINK_TYPE_LOCAL_ANCHOR :
{
if (link.getHyperlinkAnchor() != null)
{
href = "#" + link.getHyperlinkAnchor();
}
break;
}
case JRHyperlink.HYPERLINK_TYPE_LOCAL_PAGE :
{
if (link.getHyperlinkPage() != null)
{
href = "#" + JR_PAGE_ANCHOR_PREFIX + reportIndex + "_" + link.getHyperlinkPage().toString();
}
break;
}
case JRHyperlink.HYPERLINK_TYPE_REMOTE_ANCHOR :
{
if (
link.getHyperlinkReference() != null &&
link.getHyperlinkAnchor() != null
)
{
href = link.getHyperlinkReference() + "#" + link.getHyperlinkAnchor();
}
break;
}
case JRHyperlink.HYPERLINK_TYPE_REMOTE_PAGE :
{
if (
link.getHyperlinkReference() != null &&
link.getHyperlinkPage() != null
)
{
href = link.getHyperlinkReference() + "#" + JR_PAGE_ANCHOR_PREFIX + "0_" + link.getHyperlinkPage().toString();
}
break;
}
case JRHyperlink.HYPERLINK_TYPE_NONE :
default :
{
break;
}
}
}
else
{
href = customHandler.getHyperlink(link);
}
return href;
}
protected JRHyperlinkProducer getCustomHandler(JRPrintHyperlink link)
{
return hyperlinkProducerFactory == null ? null : hyperlinkProducerFactory.getHandler(link.getLinkType());
}
protected void endHyperlink() throws IOException
{
writer.write("");
}
/** |
protected 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(java.io.OutputStream os)
|
protected void |
exportStyledText(JRStyledText styledText)
|
protected void |
exportStyledTextRun(java.util.Map attributes,
java.lang.String text)
|
protected void |
exportText(TableBuilder tableBuilder,
JRPrintText text,
JRExporterGridCell gridCell)
|
protected JRPrintElementIndex |
getElementIndex(JRExporterGridCell gridCell)
|
static JRPrintImage |
getImage(java.util.List jasperPrintList,
JRPrintElementIndex imageIndex)
|
static JRPrintImage |
getImage(java.util.List jasperPrintList,
java.lang.String imageName)
|
static java.lang.String |
getImageName(JRPrintElementIndex printElementIndex)
protected void writeImageMap(String imageMapName, JRPrintHyperlink mainHyperlink, List imageMapAreas) throws IOException
{
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("\"");
}
}
/** |
protected java.lang.String |
getImagePath(JRRenderable renderer,
boolean isLazy,
JRExporterGridCell gridCell)
|
static JRPrintElementIndex |
getPrintElementIndex(java.lang.String imageName)
|
protected void |
restoreBackcolor()
|
protected void |
setBackcolor(java.awt.Color color)
|
protected void |
setHyperlinkProducerFactory()
|
Methods inherited from class net.sf.jasperreports.engine.JRAbstractExporter |
defaultParseNumber, getBooleanCellValue, getBooleanParameter, getDateCellValue, getDateFormat, getIntegerParameter, getNumberCellValue, getNumberFormat, getOffsetX, getOffsetY, getParameter, getParameterResolver, getParameters, getStringParameter, getStringParameterOrDefault, getStyledText, getStyledText, getTextFormatFactoryClass, getTextLocale, getTextTimeZone, getTextValue, getTextValueString, reset, resetClassLoader, resetExportContext, restoreElementOffsets, setClassLoader, setExportContext, setFrameElementsOffset, setInput, setOffset, setOffset, setOutput, setPageRange, setParameter, setParameters |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JR_PAGE_ANCHOR_PREFIX
protected static final java.lang.String JR_PAGE_ANCHOR_PREFIX
- See Also:
- Constant Field Values
HORIZONTAL_ALIGN_LEFT
protected static final java.lang.String HORIZONTAL_ALIGN_LEFT
- See Also:
- Constant Field Values
HORIZONTAL_ALIGN_RIGHT
protected static final java.lang.String HORIZONTAL_ALIGN_RIGHT
- See Also:
- Constant Field Values
HORIZONTAL_ALIGN_CENTER
protected static final java.lang.String HORIZONTAL_ALIGN_CENTER
- See Also:
- Constant Field Values
HORIZONTAL_ALIGN_JUSTIFY
protected static final java.lang.String HORIZONTAL_ALIGN_JUSTIFY
- See Also:
- Constant Field Values
VERTICAL_ALIGN_TOP
protected static final java.lang.String VERTICAL_ALIGN_TOP
- See Also:
- Constant Field Values
VERTICAL_ALIGN_MIDDLE
protected static final java.lang.String VERTICAL_ALIGN_MIDDLE
- See Also:
- Constant Field Values
VERTICAL_ALIGN_BOTTOM
protected static final java.lang.String 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
tempBodyWriter
protected java.io.Writer tempBodyWriter
tempStyleWriter
protected java.io.Writer tempStyleWriter
progressMonitor
protected JRExportProgressMonitor progressMonitor
rendererToImagePathMap
protected java.util.Map rendererToImagePathMap
imageMaps
protected java.util.Map imageMaps
imagesToProcess
protected java.util.List imagesToProcess
reportIndex
protected int reportIndex
pageIndex
protected int pageIndex
tableIndex
protected int tableIndex
encoding
protected java.lang.String encoding
isWrapBreakWord
protected boolean isWrapBreakWord
fontMap
protected java.util.Map fontMap
hyperlinkProducerFactory
protected JRHyperlinkProducerFactory hyperlinkProducerFactory
nature
protected ExporterNature nature
JROdtExporter
public JROdtExporter()
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
setHyperlinkProducerFactory
protected void setHyperlinkProducerFactory()
getImage
public static JRPrintImage getImage(java.util.List jasperPrintList,
java.lang.String imageName)
getImage
public static JRPrintImage getImage(java.util.List jasperPrintList,
JRPrintElementIndex imageIndex)
exportReportToOasisZip
protected void exportReportToOasisZip(java.io.OutputStream os)
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
exportGrid
protected void exportGrid(JRGridLayout gridLayout,
JRPrintElementIndex frameIndex)
throws java.io.IOException,
JRException
- Throws:
java.io.IOException
JRException
exportLine
protected void exportLine(TableBuilder tableBuilder,
JRPrintLine line,
JRExporterGridCell gridCell)
throws java.io.IOException
- Throws:
java.io.IOException
exportRectangle
protected void exportRectangle(TableBuilder tableBuilder,
JRPrintRectangle rectangle,
JRExporterGridCell gridCell)
throws java.io.IOException
- Throws:
java.io.IOException
exportEllipse
protected void exportEllipse(TableBuilder tableBuilder,
JRPrintEllipse ellipse,
JRExporterGridCell gridCell)
throws java.io.IOException
- Throws:
java.io.IOException
exportText
protected void exportText(TableBuilder tableBuilder,
JRPrintText text,
JRExporterGridCell gridCell)
throws java.io.IOException
- Throws:
java.io.IOException
exportStyledText
protected void exportStyledText(JRStyledText styledText)
throws java.io.IOException
- Throws:
java.io.IOException
exportStyledTextRun
protected void exportStyledTextRun(java.util.Map attributes,
java.lang.String text)
throws java.io.IOException
- Throws:
java.io.IOException
exportImage
protected void exportImage(TableBuilder tableBuilder,
JRPrintImage image,
JRExporterGridCell gridCell)
throws JRException,
java.io.IOException
- protected boolean startHyperlink(JRPrintHyperlink link) throws IOException
{
String href = getHyperlinkURL(link);
if (href != null)
{
writer.write("");
}
return href != null;
}
protected String getHyperlinkTarget(JRPrintHyperlink link)
{
String target = null;
switch(link.getHyperlinkTarget())
{
case JRHyperlink.HYPERLINK_TARGET_BLANK :
{
target = "_blank";
break;
}
case JRHyperlink.HYPERLINK_TARGET_SELF :
default :
{
break;
}
}
return target;
}
protected String getHyperlinkURL(JRPrintHyperlink link)
{
String href = null;
JRHyperlinkProducer customHandler = getCustomHandler(link);
if (customHandler == null)
{
switch(link.getHyperlinkType())
{
case JRHyperlink.HYPERLINK_TYPE_REFERENCE :
{
if (link.getHyperlinkReference() != null)
{
href = link.getHyperlinkReference();
}
break;
}
case JRHyperlink.HYPERLINK_TYPE_LOCAL_ANCHOR :
{
if (link.getHyperlinkAnchor() != null)
{
href = "#" + link.getHyperlinkAnchor();
}
break;
}
case JRHyperlink.HYPERLINK_TYPE_LOCAL_PAGE :
{
if (link.getHyperlinkPage() != null)
{
href = "#" + JR_PAGE_ANCHOR_PREFIX + reportIndex + "_" + link.getHyperlinkPage().toString();
}
break;
}
case JRHyperlink.HYPERLINK_TYPE_REMOTE_ANCHOR :
{
if (
link.getHyperlinkReference() != null &&
link.getHyperlinkAnchor() != null
)
{
href = link.getHyperlinkReference() + "#" + link.getHyperlinkAnchor();
}
break;
}
case JRHyperlink.HYPERLINK_TYPE_REMOTE_PAGE :
{
if (
link.getHyperlinkReference() != null &&
link.getHyperlinkPage() != null
)
{
href = link.getHyperlinkReference() + "#" + JR_PAGE_ANCHOR_PREFIX + "0_" + link.getHyperlinkPage().toString();
}
break;
}
case JRHyperlink.HYPERLINK_TYPE_NONE :
default :
{
break;
}
}
}
else
{
href = customHandler.getHyperlink(link);
}
return href;
}
protected JRHyperlinkProducer getCustomHandler(JRPrintHyperlink link)
{
return hyperlinkProducerFactory == null ? null : hyperlinkProducerFactory.getHandler(link.getLinkType());
}
protected void endHyperlink() throws IOException
{
writer.write("");
}
/**
- Throws:
JRException
java.io.IOException
getImagePath
protected java.lang.String getImagePath(JRRenderable renderer,
boolean isLazy,
JRExporterGridCell gridCell)
throws java.io.IOException
- Throws:
java.io.IOException
getElementIndex
protected JRPrintElementIndex getElementIndex(JRExporterGridCell gridCell)
getImageName
public static java.lang.String getImageName(JRPrintElementIndex printElementIndex)
- protected void writeImageMap(String imageMapName, JRPrintHyperlink mainHyperlink, List imageMapAreas) throws IOException
{
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(java.lang.String imageName)
exportFrame
protected void exportFrame(TableBuilder tableBuilder,
JRPrintFrame frame,
JRExporterGridCell gridCell)
throws java.io.IOException,
JRException
- Throws:
java.io.IOException
JRException
setBackcolor
protected void setBackcolor(java.awt.Color color)
restoreBackcolor
protected void restoreBackcolor()
© 2001-2006 JasperSoft Corporation www.jaspersoft.com