The following issue has been updated:

    Updater: fabrizio giustina (mailto:[EMAIL PROTECTED])
       Date: Fri, 1 Oct 2004 6:58 AM
    Changes:
             Component changed to Export
             Component changed from Tag Library
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://jira.codehaus.org/browse/DISPL-13?page=history

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/browse/DISPL-13

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: DISPL-13
    Summary: PDF Export
       Type: Improvement

     Status: In Progress
   Priority: Major

 Original Estimate: Unknown
 Time Spent: 1 day
  Remaining: Unknown

    Project: DisplayTag
 Components: 
             Export
   Fix Fors:
             1.0 RC2
   Versions:
             1.0 RC2

   Assignee: fabrizio giustina
   Reporter: fabrizio giustina

    Created: Thu, 23 Sep 2004 5:31 PM
    Updated: Fri, 1 Oct 2004 6:58 AM

Description:
====
imported from sf tracker
id 1026408 
submitted by Ivan Markov - ivan_markov
http://sourceforge.net/tracker/index.php?func=detail&group_id=73068&atid=536613&aid=1026408
 
====



PDF Export
----------

Our main goal while developing this patch was to do as little changes as possible in 
the existing display tag code.
You know - the smaller the patch, the easier to be accepted. :)

We had to change a little the code of BaseExportView, ExportViewFactory & 
MediaTypeEnum.
The changes in these classes revolve around our idea to make the export stuff in 
display tag *extensible*.

The current set of exported formats supported by DT (CSV, Tab-delimited Excel, HTML, 
XML) all do their stuff relying on core J2SE features only.
PDF, however, is complex enough so as we needed to drag a dependency on IText 
(http://www.lowagie.com/iText/). Since we didn't want to make display tag itself 
dependent on IText, we instead provided means for the user to register in DT a new 
exporter.

With our patch, user needing custom export has to:
a.1) Write the exporter, by extending BaseExportView. That's what we did for PDF: our 
PDFView extends BaseExportView.
a.2) The exporter should have a constructor with the same parameters as the one in 
BaseExportView, because our patch uses reflection to instantiate the appropriate 
exporter.
b) Somewhere in the webapp, probably in the init() method of the main servlet, the 
user needs to issue:
MediaTypeEnum.registerView("<new-exporter-name>", <new-exporter-class>);

For our PDF export, we'll do:
MediaTypeEnum.registerView("pdf", PdfView.class);

We'll consider providing means for specifying this in the table.properties file too.

Note that only the changes to BaseExportView/ExportViewFactory/MediaTypeEnum are 
important.
Our PDFView does not and SHOULD NOT rely on any other DT API.

I would imagine, you guys wouldn't like dependency on IText, so PDFView can find its 
way in an optional package.
In future, I suppose XLS export may emerge, based on JExcelAPI (jexcelapi.sf.net), 
which provides richer formatting means than the regular CSV/Tab-delimited Excel export.


Compiling The Code
------------------

You can try to apply the attached paging_and_pdf.diff file (diff to latest CVS as of 
Sep 11 2004). Note that it will introduce dependency on IText, because of PDFView, 
which is included for demoing.

You can also just unzip the attached archive which contains the latest CVS DT patched. 
Also, Eclipse project files are provided within.

!NOTE: You need to move all 3rd party jar dependencies in WEB-INF/lib (for demoing) 
INCLUDING itext-1.02b-custom.jar (from http://www.lowagie.com/iText/download.html)
so that you can just point the servlet engine to ... /displaytag2/src/webapp .




---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
displaytag-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel

Reply via email to