Skip to content

Commit

Permalink
update and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fgiust committed Aug 11, 2014
1 parent 1d73cbe commit b5768fc
Show file tree
Hide file tree
Showing 88 changed files with 1,166 additions and 1,234 deletions.
4 changes: 2 additions & 2 deletions displaytag-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@

package org.displaytag.sample.decorators;

import com.lowagie.text.BadElementException;
import com.lowagie.text.Cell;
import com.lowagie.text.Chunk;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
import com.lowagie.text.FontFactory;
import com.lowagie.text.Rectangle;
import com.lowagie.text.Table;
import com.itextpdf.text.Chunk;
import com.itextpdf.text.Element;
import com.itextpdf.text.Font;
import com.itextpdf.text.FontFactory;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfPTable;


/**
Expand All @@ -36,7 +36,7 @@ public class ItextTotalWrapper extends TotalWrapperTemplate
/**
* The iText table in which the totals are rendered.
*/
private Table table;
private PdfPTable table;

/**
* The iText font used to render the totals.
Expand All @@ -49,7 +49,7 @@ public class ItextTotalWrapper extends TotalWrapperTemplate
* @see org.displaytag.decorator.itext.DecoratesItext#setTable(com.lowagie.text.Table)
*/
@Override
public void setTable(Table table)
public void setTable(PdfPTable table)
{
this.table = table;
}
Expand Down Expand Up @@ -105,39 +105,32 @@ private void writeTotal(String value, double total)
{
if (assertRequiredState())
{
try
{
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("-------------"));
table.addCell(this.getCell(""));
// new row
table.addCell(this.getCell(""));
table.addCell(this.getCell(value + " Total:"));
table.addCell(this.getCell(total + ""));
table.addCell(this.getCell(""));
}
catch (BadElementException e)
{
}
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("-------------"));
table.addCell(this.getCell(""));
// new row
table.addCell(this.getCell(""));
table.addCell(this.getCell(value + " Total:"));
table.addCell(this.getCell(total + ""));
table.addCell(this.getCell(""));
}
}

/**
* Obtain a cell with the given value.
* @param value Value to display in the cell.
* @return A cell with the given value.
* @throws BadElementException if an error occurs while generating the cell.
*/
private Cell getCell(String value) throws BadElementException
private PdfPCell getCell(String value)
{
Cell cell = new Cell(new Chunk(value, this.font));
cell.setLeading(8);
PdfPCell cell = new PdfPCell(new Phrase(new Chunk(value, this.font)));
cell.setLeading(8, 0);
cell.setHorizontalAlignment(Element.ALIGN_LEFT);
return cell;
}
Expand Down
3 changes: 0 additions & 3 deletions displaytag-examples/src/main/webapp/WEB-INF/.cvsignore

This file was deleted.

68 changes: 24 additions & 44 deletions displaytag-examples/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -1,44 +1,24 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"
>


<web-app>
<description>Documentatio and examples for the Display Tag Library.</description>

<servlet>
<servlet-name>DisplaySource</servlet-name>
<display-name>DisplaySource</display-name>
<description>display source of sample jsp pages</description>
<servlet-class>org.displaytag.sample.DisplaySourceServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>DisplaySource</servlet-name>
<url-pattern>*.source</url-pattern>
</servlet-mapping>

<mime-mapping>
<extension>css</extension>
<mime-type>text/css</mime-type>
</mime-mapping>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

<error-page>
<error-code>404</error-code>
<location>/404.jsp</location>
</error-page>

<taglib>
<taglib-uri>http://displaytag.sourceforge.net/</taglib-uri>
<taglib-location>/WEB-INF/displaytag-11.tld</taglib-location>
</taglib>


</web-app>
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<description>Documentatio and examples for the Display Tag Library.</description>
<servlet>
<servlet-name>DisplaySource</servlet-name>
<servlet-class>org.displaytag.sample.DisplaySourceServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DisplaySource</servlet-name>
<url-pattern>*.source</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>css</extension>
<mime-type>text/css</mime-type>
</mime-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<error-page>
<error-code>404</error-code>
<location>/404.jsp</location>
</error-page>
</web-app>
33 changes: 19 additions & 14 deletions displaytag/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@
<version>2.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>tomcat</groupId>
<artifactId>jasper-compiler-jdt</artifactId>
<groupId>org.apache.tomcat</groupId>
<artifactId>jasper</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>jasper-el</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -60,11 +65,6 @@
<artifactId>xwork</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>tomcat</groupId>
<artifactId>jasper-runtime</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand All @@ -75,8 +75,8 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
</dependency>
<dependency>
<groupId>xmlunit</groupId>
Expand All @@ -88,11 +88,6 @@
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</dependency>
<dependency>
<groupId>tomcat</groupId>
<artifactId>jasper-compiler</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
Expand Down Expand Up @@ -154,6 +149,16 @@
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop</artifactId>
</dependency>
<dependency>
<groupId>avalon-framework</groupId>
<artifactId>avalon-framework-impl</artifactId>
<!-- required by FOP -->
</dependency>
<dependency>
<groupId>avalon-framework</groupId>
<artifactId>avalon-framework-api</artifactId>
<!-- required by FOP -->
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import org.apache.commons.beanutils.MappedPropertyDescriptor;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.displaytag.model.TableModel;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import javax.servlet.jsp.PageContext;

import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import org.displaytag.model.TableModel;
import org.displaytag.render.ItextTableWriter;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.PageSize;
import com.lowagie.text.Table;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.pdf.PdfPTable;


/**
Expand Down Expand Up @@ -71,7 +71,7 @@ public void doExport(OutputStream out) throws JspException
Document document = new Document(PageSize.A4.rotate(), 60, 60, 40, 40);
this.initItextWriter(document, out);
document.open();
Table table = new Table(this.model.getNumberOfColumns());
PdfPTable table = new PdfPTable(this.model.getNumberOfColumns());
ItextTableWriter writer = new ItextTableWriter(table, document);
writer.writeTable(this.model, "-1");
document.add(table);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
import java.io.IOException;
import java.io.OutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfPageEventHelper;
import com.lowagie.text.pdf.PdfTemplate;
import com.lowagie.text.pdf.PdfWriter;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfPageEventHelper;
import com.itextpdf.text.pdf.PdfTemplate;
import com.itextpdf.text.pdf.PdfWriter;


/**
Expand Down Expand Up @@ -87,7 +87,7 @@ public void onEndPage(PdfWriter writer, Document document)
{
}
PdfContentByte cb = writer.getDirectContent();
cb.saveState();
// cb.saveState();
// write the headertable
table.setTotalWidth(document.right() - document.left());
table.writeSelectedRows(0, -1, document.left(), document.getPageSize().getHeight() - 50, cb);
Expand All @@ -102,7 +102,7 @@ public void onEndPage(PdfWriter writer, Document document)
cb.showText(text);
cb.endText();
cb.addTemplate(tpl, document.right() - adjust, textBase);
cb.saveState();
// cb.saveState();
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.fo.ValidationException;
import org.displaytag.model.TableModel;

Expand Down
Loading

0 comments on commit b5768fc

Please sign in to comment.