[jboss-cvs] jboss-seam/src/pdf/org/jboss/seam/pdf ...
Norman Richards
norman.richards at jboss.com
Wed Mar 7 21:55:49 EST 2007
User: nrichards
Date: 07/03/07 21:55:49
Modified: src/pdf/org/jboss/seam/pdf ITextUtils.java
Log:
use itext2 convenience functions
Revision Changes Path
1.9 +2 -43 jboss-seam/src/pdf/org/jboss/seam/pdf/ITextUtils.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ITextUtils.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/pdf/org/jboss/seam/pdf/ITextUtils.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- ITextUtils.java 20 Jan 2007 20:04:30 -0000 1.8
+++ ITextUtils.java 8 Mar 2007 02:55:49 -0000 1.9
@@ -34,52 +34,11 @@
* so we'll copy that logic here.
*/
public static int alignmentValue(String alignment) {
- if (ElementTags.ALIGN_CENTER.equalsIgnoreCase(alignment)) {
- return Element.ALIGN_CENTER;
- }
- if (ElementTags.ALIGN_LEFT.equalsIgnoreCase(alignment)) {
- return Element.ALIGN_LEFT;
- }
- if (ElementTags.ALIGN_RIGHT.equalsIgnoreCase(alignment)) {
- return Element.ALIGN_RIGHT;
- }
- if (ElementTags.ALIGN_JUSTIFIED.equalsIgnoreCase(alignment)) {
- return Element.ALIGN_JUSTIFIED;
- }
- if (ElementTags.ALIGN_JUSTIFIED_ALL.equalsIgnoreCase(alignment)) {
- return Element.ALIGN_JUSTIFIED_ALL;
- }
- if (ElementTags.ALIGN_TOP.equalsIgnoreCase(alignment)) {
- return Element.ALIGN_TOP;
- }
- if (ElementTags.ALIGN_MIDDLE.equalsIgnoreCase(alignment)) {
- return Element.ALIGN_MIDDLE;
- }
- if (ElementTags.ALIGN_BOTTOM.equalsIgnoreCase(alignment)) {
- return Element.ALIGN_BOTTOM;
- }
- if (ElementTags.ALIGN_BASELINE.equalsIgnoreCase(alignment)) {
- return Element.ALIGN_BASELINE;
- }
-
- return Element.ALIGN_UNDEFINED;
+ return ElementTags.alignmentValue(alignment);
}
public static Rectangle pageSizeValue(String name) {
- if (name.indexOf(' ') != -1) {
- int[] sizes = stringToIntArray(name);
- if (sizes.length != 2) {
- throw new RuntimeException("page size should contain two integer numbers");
- }
- return new Rectangle(sizes[0],sizes[1]);
- }
-
- try {
- Field field = PageSize.class.getDeclaredField(name.toUpperCase());
- return (Rectangle) field.get(null);
- } catch (Exception e) {
- throw new RuntimeException("Can't find page size " + name);
- }
+ return PageSize.getRectangle(name);
}
More information about the jboss-cvs-commits
mailing list