org.displaytag.export
Class PdfView

java.lang.Object
  extended byorg.displaytag.export.PdfView
All Implemented Interfaces:
BinaryExportView, ExportView

public class PdfView
extends java.lang.Object
implements BinaryExportView

PDF exporter using IText. This class is provided more as an example than as a "production ready" class: users probably will need to write a custom export class with a specific layout.

Version:
$Revision: 1.7 $ ($Author: fgiust $)
Author:
Ivan Markov, Fabrizio Giustina

Constructor Summary
PdfView()
           
 
Method Summary
 void doExport(java.io.OutputStream out)
          Returns the exported content as a String.
protected  void generateHeaders()
          Generates the header cells, which persist on every page of the PDF document.
protected  void generatePDFTable()
          The overall PDF table generator.
protected  void generateRows()
          Generates all the row cells.
 java.lang.String getMimeType()
          MimeType to return.
protected  void initTable()
          Initialize the main info holder table.
 void setParameters(TableModel tableModel, boolean exportFullList, boolean includeHeader, boolean decorateValues)
          initialize the parameters needed for export.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PdfView

public PdfView()
Method Detail

setParameters

public void setParameters(TableModel tableModel,
                          boolean exportFullList,
                          boolean includeHeader,
                          boolean decorateValues)
Description copied from interface: ExportView
initialize the parameters needed for export. The method is guarantee be called before doExport() and getMimeType(). Classes implementing ExportView should reset any instance field previously set when this method is called, in order to support instance reusing.

Specified by:
setParameters in interface ExportView
Parameters:
tableModel - TableModel to render
exportFullList - boolean export full list?
includeHeader - should header be included in export?
decorateValues - should output be decorated?
See Also:
ExportView.setParameters(TableModel, boolean, boolean, boolean)

initTable

protected void initTable()
                  throws com.lowagie.text.BadElementException
Initialize the main info holder table.

Throws:
com.lowagie.text.BadElementException - for errors during table initialization

getMimeType

public java.lang.String getMimeType()
Description copied from interface: ExportView
MimeType to return.

Specified by:
getMimeType in interface ExportView
Returns:
"application/pdf"
See Also:
ExportView.getMimeType()

generatePDFTable

protected void generatePDFTable()
                         throws javax.servlet.jsp.JspException,
                                com.lowagie.text.BadElementException
The overall PDF table generator.

Throws:
javax.servlet.jsp.JspException - for errors during value retrieving from the table model
com.lowagie.text.BadElementException - IText exception

doExport

public void doExport(java.io.OutputStream out)
              throws javax.servlet.jsp.JspException
Description copied from interface: BinaryExportView
Returns the exported content as a String.

Specified by:
doExport in interface BinaryExportView
Parameters:
out - output writer
Throws:
javax.servlet.jsp.JspException - for other exceptions during export
See Also:
BinaryExportView.doExport(OutputStream)

generateHeaders

protected void generateHeaders()
                        throws com.lowagie.text.BadElementException
Generates the header cells, which persist on every page of the PDF document.

Throws:
com.lowagie.text.BadElementException - IText exception

generateRows

protected void generateRows()
                     throws javax.servlet.jsp.JspException,
                            com.lowagie.text.BadElementException
Generates all the row cells.

Throws:
javax.servlet.jsp.JspException - for errors during value retrieving from the table model
com.lowagie.text.BadElementException - errors while generating content


Copyright © 2002-2005 the Displaytag team. All Rights Reserved.