1 16 package org.apache.myfaces.custom.stylesheet; 17 18 import javax.faces.component.UIOutput; 19 import javax.faces.context.FacesContext; 20 import javax.faces.el.ValueBinding; 21 22 import org.apache.commons.logging.Log; 23 import org.apache.commons.logging.LogFactory; 24 25 26 40 41 public class Stylesheet extends UIOutput { 42 43 public static final String COMPONENT_TYPE = "org.apache.myfaces.Stylesheet"; 44 public static final String COMPONENT_FAMILY = "javax.faces.Output"; 45 private static final String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Stylesheet"; 46 private static final Log log = LogFactory.getLog(Stylesheet.class); 47 48 private String _path = null; 49 50 51 public Stylesheet() { 53 54 setRendererType(DEFAULT_RENDERER_TYPE); 55 56 } 57 58 59 public String getFamily() { 60 61 return COMPONENT_FAMILY; 62 63 } 64 65 66 public String getPath() { 67 68 if (_path != null) return _path; 69 ValueBinding vb = getValueBinding("path"); 70 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 71 } 72 73 public void setPath(String path) { 74 this._path = path; 75 } 76 77 public void restoreState(FacesContext context, Object state) { 78 79 Object values[] = (Object []) state; 80 super.restoreState(context, values[0]); 81 _path = (String ) values[1]; 82 83 } 84 85 public Object saveState(FacesContext context) { 86 87 Object values[] = new Object [2]; 88 values[0] = super.saveState(context); 89 values[1] = _path; 90 return values; 91 92 } 93 } | Popular Tags |