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