[jboss-cvs] jboss-seam/src/pdf/org/jboss/seam/pdf/ui ...
Norman Richards
norman.richards at jboss.com
Mon Feb 5 01:23:25 EST 2007
User: nrichards
Date: 07/02/05 01:23:25
Modified: src/pdf/org/jboss/seam/pdf/ui ITextComponent.java
UIImage.java
Log:
allow application-created images
Revision Changes Path
1.8 +1 -1 jboss-seam/src/pdf/org/jboss/seam/pdf/ui/ITextComponent.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ITextComponent.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/pdf/org/jboss/seam/pdf/ui/ITextComponent.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
1.11 +32 -8 jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UIImage.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UIImage.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UIImage.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- UIImage.java 25 Jan 2007 06:16:34 -0000 1.10
+++ UIImage.java 5 Feb 2007 06:23:25 -0000 1.11
@@ -35,6 +35,8 @@
Boolean wrap;
Boolean underlying;
+ java.awt.Image imageData;
+
public void setResource(String resource) {
this.resource = resource;
}
@@ -67,7 +69,6 @@
this.underlying = underlying;
}
-
public void setDpi(String dpi) {
this.dpi = dpi;
}
@@ -100,6 +101,11 @@
this.scalePercent = scalePercent;
}
+ public void setImageData(java.awt.Image imageData) {
+ this.imageData = imageData;
+ }
+
+
public Object getITextObject() {
return image;
}
@@ -108,24 +114,42 @@
image = null;
}
- public void createITextObject(FacesContext context) {
-
- resource = (String) valueBinding(context, "resource", resource);
+ private Image createFromResource(FacesContext context, String resource) {
URL url;
try {
url = context.getExternalContext().getResource(resource);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
+
if (url == null) {
throw new RuntimeException("cannot locate image resource " + resource);
}
try {
- image = Image.getInstance(url);
+ return Image.getInstance(url);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private Image createFromImage(java.awt.Image awtImage) {
+ try {
+ return Image.getInstance(awtImage, null);
} catch (Exception e) {
throw new RuntimeException(e);
}
+ }
+
+ public void createITextObject(FacesContext context) {
+ resource = (String) valueBinding(context,"resource", resource);
+
+ if (resource != null) {
+ image = createFromResource(context, resource);
+ } else {
+ imageData = (java.awt.Image) valueBinding(context, "imageData", imageData);
+ image = createFromImage(imageData);
+ }
rotation = (Float) valueBinding(context, "rotation", rotation);
if (rotation != 0) {
More information about the jboss-cvs-commits
mailing list