[seam-commits] Seam SVN: r8070 - trunk/src/pdf/org/jboss/seam/pdf/ui.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Mon Apr 28 18:21:13 EDT 2008
Author: norman.richards at jboss.com
Date: 2008-04-28 18:21:13 -0400 (Mon, 28 Apr 2008)
New Revision: 8070
Modified:
trunk/src/pdf/org/jboss/seam/pdf/ui/UICell.java
trunk/src/pdf/org/jboss/seam/pdf/ui/UIHtmlText.java
Log:
JBSEAM-2500
Modified: trunk/src/pdf/org/jboss/seam/pdf/ui/UICell.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UICell.java 2008-04-28 21:34:35 UTC (rev 8069)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UICell.java 2008-04-28 22:21:13 UTC (rev 8070)
@@ -38,6 +38,7 @@
Float grayFill;
Integer rotation;
+ boolean hasContent = false;
public void setGrayFill(Float grayFill) {
this.grayFill = grayFill;
@@ -278,18 +279,21 @@
}
@Override
- public void handleAdd(Object o) {
- if (o instanceof Phrase) {
- cell.setPhrase((Phrase) o);
- } else if (o instanceof Image) {
- cell.setImage((Image) o);
- } else if (o instanceof Element) {
- // calling addElement negates setPhrase, etc...
+ public void handleAdd(Object o) {
+ if (!hasContent && o instanceof Image) {
+ // added by user request, but it mages the logic here rather ugly.
+ cell.setImage((Image) o);
+
+ } else if (o instanceof Element) {
+ if (cell.getImage() != null) {
+ cell.addElement(cell.getImage());
+ }
cell.addElement((Element) o);
} else {
throw new RuntimeException("Can't add " + o.getClass().getName() +
" to cell");
}
+ hasContent = true;
}
}
Modified: trunk/src/pdf/org/jboss/seam/pdf/ui/UIHtmlText.java
===================================================================
--- trunk/src/pdf/org/jboss/seam/pdf/ui/UIHtmlText.java 2008-04-28 21:34:35 UTC (rev 8069)
+++ trunk/src/pdf/org/jboss/seam/pdf/ui/UIHtmlText.java 2008-04-28 22:21:13 UTC (rev 8070)
@@ -12,7 +12,6 @@
import org.jboss.seam.ui.util.JSF;
-import com.lowagie.text.Paragraph;
import com.lowagie.text.html.simpleparser.HTMLWorker;
import com.lowagie.text.html.simpleparser.StyleSheet;
@@ -23,7 +22,6 @@
private Converter converter;
private Object localValue;
- private Paragraph paragraph;
@Override
public boolean getRendersChildren() {
@@ -42,7 +40,6 @@
JSF.renderChildren(context, this);
context.setResponseWriter(writer);
-
String output = stringWriter.getBuffer().toString();
addFromHtml(output);
}
@@ -55,7 +52,7 @@
if (value!=null) {
addFromHtml(convert(context,value));
}
-
+
super.encodeEnd(context);
}
@@ -63,7 +60,11 @@
private void addFromHtml(String html)
throws IOException
{
- paragraph.addAll(HTMLWorker.parseToList(new StringReader(html), getStyle()));
+ for (Object o: HTMLWorker.parseToList(new StringReader(html), getStyle())) {
+ addToITextParent(o);
+ }
+
+ //paragraph.addAll(HTMLWorker.parseToList(new StringReader(html), getStyle()));
}
/**
@@ -105,23 +106,16 @@
@Override
public void createITextObject(FacesContext context) {
- com.lowagie.text.Font font = getFont();
- if (font == null) {
- paragraph = new Paragraph("");
- } else {
- paragraph = new Paragraph("", getFont());
- }
}
@Override
public Object getITextObject() {
- return paragraph;
+ return null;
}
@Override
public void removeITextObject() {
- paragraph = null;
}
@Override
More information about the seam-commits
mailing list