1 16 package javax.faces.component; 17 18 import javax.faces.context.FacesContext; 19 import javax.faces.convert.Converter; 20 import javax.faces.el.ValueBinding; 21 22 26 public class UIOutput 27 extends UIComponentBase 28 implements ValueHolder 29 { 30 public Object getLocalValue() 31 { 32 return _value; 33 } 34 35 37 public static final String COMPONENT_TYPE = "javax.faces.Output"; 38 public static final String COMPONENT_FAMILY = "javax.faces.Output"; 39 private static final String DEFAULT_RENDERER_TYPE = "javax.faces.Text"; 40 41 private Converter _converter = null; 42 private Object _value = null; 43 44 public UIOutput() 45 { 46 setRendererType(DEFAULT_RENDERER_TYPE); 47 } 48 49 public String getFamily() 50 { 51 return COMPONENT_FAMILY; 52 } 53 54 public void setConverter(Converter converter) 55 { 56 _converter = converter; 57 } 58 59 public Converter getConverter() 60 { 61 if (_converter != null) return _converter; 62 ValueBinding vb = getValueBinding("converter"); 63 return vb != null ? (Converter)vb.getValue(getFacesContext()) : null; 64 } 65 66 public void setValue(Object value) 67 { 68 _value = value; 69 } 70 71 public Object getValue() 72 { 73 if (_value != null) return _value; 74 ValueBinding vb = getValueBinding("value"); 75 return vb != null ? (Object )vb.getValue(getFacesContext()) : null; 76 } 77 78 79 public Object saveState(FacesContext context) 80 { 81 Object values[] = new Object [3]; 82 values[0] = super.saveState(context); 83 values[1] = saveAttachedState(context, _converter); 84 values[2] = _value; 85 return ((Object ) (values)); 86 } 87 88 public void restoreState(FacesContext context, Object state) 89 { 90 Object values[] = (Object [])state; 91 super.restoreState(context, values[0]); 92 _converter = (Converter)restoreAttachedState(context, values[1]); 93 _value = (Object )values[2]; 94 } 95 } 97 | Popular Tags |