1 16 17 package org.apache.struts.faces.component; 18 19 20 import javax.faces.component.UIOutput; 21 import javax.faces.context.FacesContext; 22 import javax.faces.el.ValueBinding; 23 24 25 29 30 public class StylesheetComponent extends UIOutput { 31 32 33 35 36 39 public StylesheetComponent() { 40 41 super(); 42 setRendererType("org.apache.struts.faces.Stylesheet"); 43 44 } 45 46 47 49 50 53 private String path = null; 54 55 56 58 59 62 public String getFamily() { 63 64 return "org.apache.struts.faces.Stylesheet"; 65 66 } 67 68 69 72 public String getPath() { 73 74 ValueBinding vb = getValueBinding("path"); 75 if (vb != null) { 76 return (String ) vb.getValue(getFacesContext()); 77 } else { 78 return path; 79 } 80 81 } 82 83 84 89 public void setPath(String path) { 90 91 this.path = path; 92 93 } 94 95 96 98 99 105 public void restoreState(FacesContext context, Object state) { 106 107 Object values[] = (Object []) state; 108 super.restoreState(context, values[0]); 109 path = (String ) values[1]; 110 111 } 112 113 114 119 public Object saveState(FacesContext context) { 120 121 Object values[] = new Object [2]; 122 values[0] = super.saveState(context); 123 values[1] = path; 124 return values; 125 126 } 127 128 129 } 130 | Popular Tags |