[jboss-cvs] jboss-seam/src/pdf/org/jboss/seam/pdf/ui ...
Norman Richards
norman.richards at jboss.com
Wed Nov 7 18:02:56 EST 2007
User: nrichards
Date: 07/11/07 18:02:56
Modified: src/pdf/org/jboss/seam/pdf/ui UIOutputText.java
Log:
JBSEAM-2027
Revision Changes Path
1.5 +29 -13 jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UIOutputText.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UIOutputText.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UIOutputText.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- UIOutputText.java 25 Jan 2007 06:17:07 -0000 1.4
+++ UIOutputText.java 7 Nov 2007 23:02:56 -0000 1.5
@@ -2,6 +2,7 @@
import java.io.IOException;
+import javax.faces.FacesException;
import javax.faces.component.ValueHolder;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
@@ -25,21 +26,36 @@
public void encodeEnd(FacesContext context)
throws IOException
{
- String stringValue = "";
+ chunk.append(convert(context, getValue()));
- Object myValue = getValue();
+ super.encodeEnd(context);
+ }
- if (converter != null) {
- stringValue = converter.getAsString(context, this, myValue);
+ protected String convert(FacesContext context, Object value) {
+ Converter myConverter = converterForValue(context, value);
+ if (myConverter != null) {
+ return myConverter.getAsString(context, this, value);
+ } else if (value != null) {
+ return value.toString();
} else {
- if (myValue != null) {
- stringValue = myValue.toString();
+ return "";
}
}
- chunk.append(stringValue);
+ protected Converter converterForValue(FacesContext ctx, Object value) {
+ if (converter != null) {
+ return converter;
+ }
+
+ if (value != null) {
+ try {
+ return ctx.getApplication().createConverter(value.getClass());
+ } catch (FacesException e) {
+ // no converter defined - no problem
+ }
+ }
- super.encodeEnd(context);
+ return null;
}
@Override
More information about the jboss-cvs-commits
mailing list