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 ErrorsComponent extends UIOutput { 31 32 33 35 36 39 public ErrorsComponent() { 40 41 super(); 42 setRendererType("org.apache.struts.faces.Errors"); 43 44 } 45 46 47 49 50 53 private String bundle = null; 54 55 56 59 private String property = null; 60 61 62 64 65 68 public String getBundle() { 69 70 ValueBinding vb = getValueBinding("bundle"); 71 if (vb != null) { 72 return (String ) vb.getValue(getFacesContext()); 73 } else { 74 return bundle; 75 } 76 77 } 78 79 80 85 public void setBundle(String bundle) { 86 87 this.bundle = bundle; 88 89 } 90 91 92 95 public String getFamily() { 96 97 return "org.apache.struts.faces.Errors"; 98 99 } 100 101 102 105 public String getProperty() { 106 107 ValueBinding vb = getValueBinding("property"); 108 if (vb != null) { 109 return (String ) vb.getValue(getFacesContext()); 110 } else { 111 return property; 112 } 113 114 } 115 116 117 122 public void setProperty(String property) { 123 124 this.property = property; 125 126 } 127 128 129 131 132 138 public void restoreState(FacesContext context, Object state) { 139 140 Object values[] = (Object []) state; 141 super.restoreState(context, values[0]); 142 bundle = (String ) values[1]; 143 property = (String ) values[2]; 144 145 } 146 147 148 153 public Object saveState(FacesContext context) { 154 155 Object values[] = new Object [3]; 156 values[0] = super.saveState(context); 157 values[1] = bundle; 158 values[2] = property; 159 return values; 160 161 } 162 163 164 } 165 | Popular Tags |