[jira] Created: (DISPL-650) Export to PDF uses deprecated iText method

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (DISPL-650) Export to PDF uses deprecated iText method

JIRA jira@codehaus.org
Export to PDF uses deprecated iText method
------------------------------------------

                 Key: DISPL-650
                 URL: http://jira.codehaus.org/browse/DISPL-650
             Project: DisplayTag
          Issue Type: Bug
          Components: Export
    Affects Versions: 1.2
            Reporter: Thomas Rolf


Export to PDF throws
java.lang.NoSuchMethodError: com.lowagie.text.Table.setDefaultVerticalAlignment(I)V

This is a deprecated method (since iText 2.1 I think), and (Captain Obvious) it does not work with iText 5.0.1 that I'm using. The solution to use an older version of iText feels some what unprogressive... :)


--
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
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
displaytag-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel
Reply | Threaded
Open this post in threaded view
|

[jira] (DISPL-650) Export to PDF uses deprecated iText method

JIRA jira@codehaus.org
we can read in the api :

setDefaultVerticalAlignment

public void setDefaultVerticalAlignment(int value)
Deprecated. As of iText 2.0.3, use getDefaultCell() and Cell.setVerticalAlignment(int), scheduled for removal at 2.1.0
Changes the verticalAlignment in the default layout of the Cells added with method addCell(String content).
Parameters:
value - the new alignment value
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
displaytag-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel
Reply | Threaded
Open this post in threaded view
|

[jira] (DISPL-650) Export to PDF uses deprecated iText method

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org
here's my patch :


Index: pom.xml
===================================================================
--- pom.xml (revision 1173)
+++ pom.xml (working copy)
@@ -356,9 +356,14 @@
       <dependency>
         <groupId>com.lowagie</groupId>
         <artifactId>itext</artifactId>
- <version>1.3</version>
+ <version>2.1.7</version>
       </dependency>
       <dependency>
+ <groupId>com.lowagie</groupId>
+ <artifactId>itext-rtf</artifactId>
+ <version>2.1.7</version>
+ </dependency>
+ <dependency>
         <groupId>taglibs</groupId>
         <artifactId>standard</artifactId>
         <version>1.0.6</version>
Index: displaytag/pom.xml
===================================================================
--- displaytag/pom.xml (revision 1173)
+++ displaytag/pom.xml (working copy)
@@ -77,6 +77,10 @@
     </dependency>
     <dependency>
       <groupId>com.lowagie</groupId>
+ <artifactId>itext-rtf</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.lowagie</groupId>
       <artifactId>itext</artifactId>
     </dependency>
       <dependency>
Index: displaytag-examples/src/main/java/org/displaytag/sample/decorators/ItextTotalWrapper.java
===================================================================
--- displaytag-examples/src/main/java/org/displaytag/sample/decorators/ItextTotalWrapper.java (revision 1173)
+++ displaytag-examples/src/main/java/org/displaytag/sample/decorators/ItextTotalWrapper.java (working copy)
@@ -68,7 +68,7 @@
      */
     public String startRow()
     {
- this.table.setDefaultCellBorder(Rectangle.BOTTOM);
+ this.table.getDefaultCell().setBorder(Rectangle.BOTTOM);
         return null;
     }
 
@@ -102,8 +102,8 @@
         {
             try
             {
- this.font = FontFactory.getFont(this.font.getFamilyname(), this.font.size(), Font.BOLD, this.font
- .color());
+ this.font = FontFactory.getFont(this.font.getFamilyname(), this.font.getSize(), Font.BOLD, this.font
+ .getColor());
                 table.addCell(this.getCell(""));
                 table.addCell(this.getCell(""));
                 table.addCell(this.getCell("-------------"));
Index: displaytag/src/main/java/org/displaytag/export/DefaultPdfExportView.java
===================================================================
--- displaytag/src/main/java/org/displaytag/export/DefaultPdfExportView.java (revision 1173)
+++ displaytag/src/main/java/org/displaytag/export/DefaultPdfExportView.java (working copy)
@@ -87,7 +87,7 @@
             cb.saveState();
             // write the headertable
             table.setTotalWidth(document.right() - document.left());
- table.writeSelectedRows(0, -1, document.left(), document.getPageSize().height() - 50, cb);
+ table.writeSelectedRows(0, -1, document.left(), document.getPageSize().getHeight() - 50, cb);
             // compose the footer
             String text = "Page " + writer.getPageNumber();
             float textSize = helv.getWidthPoint(text, 12);
Index: displaytag/src/main/java/org/displaytag/export/PdfView.java
===================================================================
--- displaytag/src/main/java/org/displaytag/export/PdfView.java (revision 1173)
+++ displaytag/src/main/java/org/displaytag/export/PdfView.java (working copy)
@@ -105,7 +105,7 @@
     protected void initTable() throws BadElementException
     {
         tablePDF = new Table(this.model.getNumberOfColumns());
- tablePDF.setDefaultVerticalAlignment(Element.ALIGN_TOP);
+ tablePDF.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
         tablePDF.setCellsFitPage(true);
         tablePDF.setWidth(100);
 
Index: displaytag/src/main/java/org/displaytag/render/ItextTableWriter.java
===================================================================
--- displaytag/src/main/java/org/displaytag/render/ItextTableWriter.java (revision 1173)
+++ displaytag/src/main/java/org/displaytag/render/ItextTableWriter.java (working copy)
@@ -78,7 +78,7 @@
      */
     protected void writeTableOpener(TableModel model)
     {
- this.table.setDefaultVerticalAlignment(Element.ALIGN_TOP);
+ this.table.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
         this.table.setCellsFitPage(true);
         this.table.setWidth(100);
         this.table.setPadding(2);
@@ -372,8 +372,8 @@
      */
     private void setBoldStyle(Chunk chunk, Color color)
     {
- Font font = chunk.font();
- chunk.setFont(FontFactory.getFont(font.getFamilyname(), font.size(), Font.BOLD, color));
+ Font font = chunk.getFont();
+ chunk.setFont(FontFactory.getFont(font.getFamilyname(), font.getSize(), Font.BOLD, color));
     }
 
     /**
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
displaytag-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel
Reply | Threaded
Open this post in threaded view
|

[jira] (DISPL-650) Export to PDF uses deprecated iText method

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org
Miguel Almeida commented on Bug DISPL-650
Thanks for the patch, Benoit.
On a side note, I think we should consider forking the project - if for nothing else, just to keep it maintainable. I will try to contact the maintainer on the mailing list to see what the best approach would be to prevent displaytag from becoming oblivious.
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
displaytag-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel
Reply | Threaded
Open this post in threaded view
|

[jira] (DISPL-650) Export to PDF uses deprecated iText method

JIRA jira@codehaus.org
In reply to this post by JIRA jira@codehaus.org
Miguel Almeida commented on Bug DISPL-650
Benoit's patch was missing a change in a test. The fork I made in https://github.com/mmalmeida/displaytag/ has the issue fixed. Please let me know if more users are interested in using this fork to improve displaytag or fix issues.
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
displaytag-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/displaytag-devel