1 16 package org.apache.cocoon.faces.taglib.html; 17 18 import org.apache.cocoon.faces.FacesUtils; 19 import org.apache.cocoon.faces.taglib.UIComponentTag; 20 21 import javax.faces.FacesException; 22 import javax.faces.component.UIComponent; 23 import javax.faces.component.UIOutput; 24 25 28 public class OutputTextTag extends UIComponentTag { 29 30 private String converter; 31 private String value; 32 private String escape; 33 private String style; 34 private String styleClass; 35 private String title; 36 37 38 public void setConverter(String converter) { 39 this.converter = converter; 40 } 41 42 public void setValue(String value) { 43 this.value = value; 44 } 45 46 public void setEscape(String escape) { 47 this.escape = escape; 48 } 49 50 public void setStyle(String style) { 51 this.style = style; 52 } 53 54 public void setStyleClass(String styleClass) { 55 this.styleClass = styleClass; 56 } 57 58 public void setTitle(String title) { 59 this.title = title; 60 } 61 62 public String getRendererType() { 63 return "javax.faces.Text"; 64 } 65 66 public String getComponentType() { 67 return "javax.faces.HtmlOutputText"; 68 } 69 70 protected void setProperties(UIComponent component) { 71 super.setProperties(component); 72 73 UIOutput output; 74 try { 75 output = (UIOutput) component; 76 } catch (ClassCastException cce) { 77 throw new FacesException("Tag <" + getClass().getName() + "> expected UIOutput. " + 78 "Got <" + component.getClass().getName() + ">"); 79 } 80 81 if (converter != null) { 82 if (FacesUtils.isExpression(converter)) { 83 output.setValueBinding("converter", createValueBinding(converter)); 84 } else { 85 output.setConverter(getApplication().createConverter(converter)); 86 } 87 } 88 89 if (value != null) { 90 if (FacesUtils.isExpression(value)) { 91 output.setValueBinding("value", createValueBinding(value)); 92 } else { 93 output.setValue(value); 94 } 95 } 96 97 setBooleanProperty(component, "escape", escape); 98 99 setProperty(component, "style", style); 100 setProperty(component, "styleClass", styleClass); 101 setProperty(component, "title", title); 102 } 103 104 public void recycle() { 105 super.recycle(); 106 converter = null; 107 value = null; 108 escape = null; 109 style = null; 110 styleClass = null; 111 title = null; 112 } 113 } 114 | Popular Tags |