1 16 package javax.faces.component.html; 17 18 import javax.faces.component.UIOutput; 19 import javax.faces.context.FacesContext; 20 import javax.faces.el.ValueBinding; 21 22 26 public class HtmlOutputFormat extends UIOutput 27 { 28 30 public static final String COMPONENT_TYPE = "javax.faces.HtmlOutputFormat"; 31 private static final String DEFAULT_RENDERER_TYPE = "javax.faces.Format"; 32 private static final boolean DEFAULT_ESCAPE = true; 33 34 private Boolean _escape = null; 35 private String _style = null; 36 private String _styleClass = null; 37 private String _title = null; 38 39 public HtmlOutputFormat() 40 { 41 setRendererType(DEFAULT_RENDERER_TYPE); 42 } 43 44 45 public void setEscape(boolean escape) 46 { 47 _escape = Boolean.valueOf(escape); 48 } 49 50 public boolean isEscape() 51 { 52 if (_escape != null) return _escape.booleanValue(); 53 ValueBinding vb = getValueBinding("escape"); 54 Boolean v = vb != null ? (Boolean )vb.getValue(getFacesContext()) : null; 55 return v != null ? v.booleanValue() : DEFAULT_ESCAPE; 56 } 57 58 public void setStyle(String style) 59 { 60 _style = style; 61 } 62 63 public String getStyle() 64 { 65 if (_style != null) return _style; 66 ValueBinding vb = getValueBinding("style"); 67 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 68 } 69 70 public void setStyleClass(String styleClass) 71 { 72 _styleClass = styleClass; 73 } 74 75 public String getStyleClass() 76 { 77 if (_styleClass != null) return _styleClass; 78 ValueBinding vb = getValueBinding("styleClass"); 79 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 80 } 81 82 public void setTitle(String title) 83 { 84 _title = title; 85 } 86 87 public String getTitle() 88 { 89 if (_title != null) return _title; 90 ValueBinding vb = getValueBinding("title"); 91 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 92 } 93 94 95 public Object saveState(FacesContext context) 96 { 97 Object values[] = new Object [5]; 98 values[0] = super.saveState(context); 99 values[1] = _escape; 100 values[2] = _style; 101 values[3] = _styleClass; 102 values[4] = _title; 103 return ((Object ) (values)); 104 } 105 106 public void restoreState(FacesContext context, Object state) 107 { 108 Object values[] = (Object [])state; 109 super.restoreState(context, values[0]); 110 _escape = (Boolean )values[1]; 111 _style = (String )values[2]; 112 _styleClass = (String )values[3]; 113 _title = (String )values[4]; 114 } 115 } 117 | Popular Tags |