1 16 package javax.faces.component.html; 17 18 import javax.faces.component.UIMessages; 19 import javax.faces.context.FacesContext; 20 import javax.faces.el.ValueBinding; 21 22 26 public class HtmlMessages extends UIMessages 27 { 28 30 public static final String COMPONENT_TYPE = "javax.faces.HtmlMessages"; 31 private static final String DEFAULT_RENDERER_TYPE = "javax.faces.Messages"; 32 private static final String DEFAULT_LAYOUT = "list"; 33 private static final boolean DEFAULT_TOOLTIP = false; 34 35 private String _errorClass = null; 36 private String _errorStyle = null; 37 private String _fatalClass = null; 38 private String _fatalStyle = null; 39 private String _infoClass = null; 40 private String _infoStyle = null; 41 private String _layout = null; 42 private String _style = null; 43 private String _styleClass = null; 44 private String _title = null; 45 private Boolean _tooltip = null; 46 private String _warnClass = null; 47 private String _warnStyle = null; 48 49 public HtmlMessages() 50 { 51 setRendererType(DEFAULT_RENDERER_TYPE); 52 } 53 54 55 public void setErrorClass(String errorClass) 56 { 57 _errorClass = errorClass; 58 } 59 60 public String getErrorClass() 61 { 62 if (_errorClass != null) return _errorClass; 63 ValueBinding vb = getValueBinding("errorClass"); 64 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 65 } 66 67 public void setErrorStyle(String errorStyle) 68 { 69 _errorStyle = errorStyle; 70 } 71 72 public String getErrorStyle() 73 { 74 if (_errorStyle != null) return _errorStyle; 75 ValueBinding vb = getValueBinding("errorStyle"); 76 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 77 } 78 79 public void setFatalClass(String fatalClass) 80 { 81 _fatalClass = fatalClass; 82 } 83 84 public String getFatalClass() 85 { 86 if (_fatalClass != null) return _fatalClass; 87 ValueBinding vb = getValueBinding("fatalClass"); 88 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 89 } 90 91 public void setFatalStyle(String fatalStyle) 92 { 93 _fatalStyle = fatalStyle; 94 } 95 96 public String getFatalStyle() 97 { 98 if (_fatalStyle != null) return _fatalStyle; 99 ValueBinding vb = getValueBinding("fatalStyle"); 100 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 101 } 102 103 public void setInfoClass(String infoClass) 104 { 105 _infoClass = infoClass; 106 } 107 108 public String getInfoClass() 109 { 110 if (_infoClass != null) return _infoClass; 111 ValueBinding vb = getValueBinding("infoClass"); 112 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 113 } 114 115 public void setInfoStyle(String infoStyle) 116 { 117 _infoStyle = infoStyle; 118 } 119 120 public String getInfoStyle() 121 { 122 if (_infoStyle != null) return _infoStyle; 123 ValueBinding vb = getValueBinding("infoStyle"); 124 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 125 } 126 127 public void setLayout(String layout) 128 { 129 _layout = layout; 130 } 131 132 public String getLayout() 133 { 134 if (_layout != null) return _layout; 135 ValueBinding vb = getValueBinding("layout"); 136 return vb != null ? (String )vb.getValue(getFacesContext()) : DEFAULT_LAYOUT; 137 } 138 139 public void setStyle(String style) 140 { 141 _style = style; 142 } 143 144 public String getStyle() 145 { 146 if (_style != null) return _style; 147 ValueBinding vb = getValueBinding("style"); 148 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 149 } 150 151 public void setStyleClass(String styleClass) 152 { 153 _styleClass = styleClass; 154 } 155 156 public String getStyleClass() 157 { 158 if (_styleClass != null) return _styleClass; 159 ValueBinding vb = getValueBinding("styleClass"); 160 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 161 } 162 163 public void setTitle(String title) 164 { 165 _title = title; 166 } 167 168 public String getTitle() 169 { 170 if (_title != null) return _title; 171 ValueBinding vb = getValueBinding("title"); 172 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 173 } 174 175 public void setTooltip(boolean tooltip) 176 { 177 _tooltip = Boolean.valueOf(tooltip); 178 } 179 180 public boolean isTooltip() 181 { 182 if (_tooltip != null) return _tooltip.booleanValue(); 183 ValueBinding vb = getValueBinding("tooltip"); 184 Boolean v = vb != null ? (Boolean )vb.getValue(getFacesContext()) : null; 185 return v != null ? v.booleanValue() : DEFAULT_TOOLTIP; 186 } 187 188 public void setWarnClass(String warnClass) 189 { 190 _warnClass = warnClass; 191 } 192 193 public String getWarnClass() 194 { 195 if (_warnClass != null) return _warnClass; 196 ValueBinding vb = getValueBinding("warnClass"); 197 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 198 } 199 200 public void setWarnStyle(String warnStyle) 201 { 202 _warnStyle = warnStyle; 203 } 204 205 public String getWarnStyle() 206 { 207 if (_warnStyle != null) return _warnStyle; 208 ValueBinding vb = getValueBinding("warnStyle"); 209 return vb != null ? (String )vb.getValue(getFacesContext()) : null; 210 } 211 212 213 public Object saveState(FacesContext context) 214 { 215 Object values[] = new Object [14]; 216 values[0] = super.saveState(context); 217 values[1] = _errorClass; 218 values[2] = _errorStyle; 219 values[3] = _fatalClass; 220 values[4] = _fatalStyle; 221 values[5] = _infoClass; 222 values[6] = _infoStyle; 223 values[7] = _layout; 224 values[8] = _style; 225 values[9] = _styleClass; 226 values[10] = _title; 227 values[11] = _tooltip; 228 values[12] = _warnClass; 229 values[13] = _warnStyle; 230 return ((Object ) (values)); 231 } 232 233 public void restoreState(FacesContext context, Object state) 234 { 235 Object values[] = (Object [])state; 236 super.restoreState(context, values[0]); 237 _errorClass = (String )values[1]; 238 _errorStyle = (String )values[2]; 239 _fatalClass = (String )values[3]; 240 _fatalStyle = (String )values[4]; 241 _infoClass = (String )values[5]; 242 _infoStyle = (String )values[6]; 243 _layout = (String )values[7]; 244 _style = (String )values[8]; 245 _styleClass = (String )values[9]; 246 _title = (String )values[10]; 247 _tooltip = (Boolean )values[11]; 248 _warnClass = (String )values[12]; 249 _warnStyle = (String )values[13]; 250 } 251 } 253 | Popular Tags |