1 16 package org.apache.myfaces.wap.renderkit.wml; 17 18 import javax.faces.component.UIComponent; 19 import javax.faces.context.FacesContext; 20 import javax.faces.context.ResponseWriter; 21 22 import org.apache.commons.logging.Log; 23 import org.apache.commons.logging.LogFactory; 24 import org.apache.myfaces.wap.component.OutputText; 25 import org.apache.myfaces.wap.renderkit.Attributes; 26 import org.apache.myfaces.wap.renderkit.RendererUtils; 27 import org.apache.myfaces.wap.renderkit.WmlRenderer; 28 29 37 public class OutputTextRenderer extends WmlRenderer { 38 private static Log log = LogFactory.getLog(OutputTextRenderer.class); 39 40 41 public OutputTextRenderer() { 42 super(); 43 log.debug("created object " + this.getClass().getName()); 44 } 45 46 public void encodeBegin(FacesContext context, UIComponent component) throws java.io.IOException { 47 log.debug("encodeBegin(" + component.getId() + ")"); 48 if (context == null || component == null) { 49 throw new NullPointerException (); 50 } 51 } 52 53 public void encodeChildren(FacesContext context, UIComponent component) throws java.io.IOException { 54 log.debug("encodeChildren(" + component.getId() + ")"); 55 if (context == null || component == null) { 56 throw new NullPointerException (); 57 } 58 } 59 60 public void encodeEnd(FacesContext context, UIComponent component) throws java.io.IOException { 61 log.debug("encodeEnd(" + component.getId() + ")"); 62 if (context == null || component == null) { 63 throw new NullPointerException (); 64 } 65 66 if (!component.isRendered()) return; 67 68 OutputText comp = (OutputText)component; 69 70 ResponseWriter writer = context.getResponseWriter(); 71 72 if (comp.getValue() != null) { 73 String textValue = RendererUtils.convertToString(context, component); 74 log.debug("OutputText value:" + textValue); 75 76 if (comp.isEscape()) 77 writer.writeText(textValue, Attributes.VALUE); 78 else 79 writer.write(textValue); 80 81 } 82 } 83 84 public void decode(FacesContext context, UIComponent component) { 85 if (component == null ) throw new NullPointerException (); 86 } 87 88 89 public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws javax.faces.convert.ConverterException { 90 return(RendererUtils.convertToObject(context, component)); 91 } 92 } 93 94 | Popular Tags |