View Javadoc

1   package org.rcfaces.core.component;
2   
3   import org.rcfaces.core.internal.component.Properties;
4   import org.rcfaces.core.component.capability.IBackgroundImageCapability;
5   import org.apache.commons.logging.LogFactory;
6   import org.rcfaces.core.component.capability.IForCapability;
7   import org.rcfaces.core.component.AbstractBasicComponent;
8   import org.rcfaces.core.component.capability.IBorderCapability;
9   import org.rcfaces.core.component.capability.IMouseEventCapability;
10  import javax.el.ValueExpression;
11  import java.util.HashSet;
12  import org.apache.commons.logging.Log;
13  import java.util.Set;
14  import java.util.Arrays;
15  import org.rcfaces.core.component.capability.IInitEventCapability;
16  import org.rcfaces.core.component.capability.ISeverityStyleClassCapability;
17  
18  /**
19   * An englobing tag that changes the style class surronuding a component when a particular message is emitted for a component.
20   * ex :
21   * <v:styledMessage errorStyleClass="formErreur" for="ef1">
22   * <v:textEntry
23   * id="ef1"
24   * ... />
25   * </v:styledMessage>
26   */
27  public class StyledMessageComponent extends AbstractBasicComponent implements 
28  	IBackgroundImageCapability,
29  	IBorderCapability,
30  	IMouseEventCapability,
31  	IInitEventCapability,
32  	IForCapability,
33  	ISeverityStyleClassCapability {
34  
35  	private static final Log LOG = LogFactory.getLog(StyledMessageComponent.class);
36  
37  	public static final String COMPONENT_TYPE="org.rcfaces.core.styledMessage";
38  
39  	protected static final Set CAMELIA_ATTRIBUTES=new HashSet(AbstractBasicComponent.CAMELIA_ATTRIBUTES);
40  	static {
41  		CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"backgroundImageVerticalRepeat","fatalStyleClass","showIfMessage","for","styleClass","backgroundImageVerticalPosition","backgroundImageHorizontalRepeat","backgroundImageHorizontalPosition","setFocusIfMessage","initListener","warnStyleClass","errorStyleClass","infoStyleClass","mouseOverListener","backgroundImageURL","border","mouseOutListener"}));
42  	}
43  
44  	public StyledMessageComponent() {
45  		setRendererType(COMPONENT_TYPE);
46  	}
47  
48  	public StyledMessageComponent(String componentId) {
49  		this();
50  		setId(componentId);
51  	}
52  
53  	public java.lang.String getBackgroundImageHorizontalPosition() {
54  		return getBackgroundImageHorizontalPosition(null);
55  	}
56  
57  	/**
58  	 * See {@link #getBackgroundImageHorizontalPosition() getBackgroundImageHorizontalPosition()} for more details
59  	 */
60  	public java.lang.String getBackgroundImageHorizontalPosition(javax.faces.context.FacesContext facesContext) {
61  		return engine.getStringProperty(Properties.BACKGROUND_IMAGE_HORIZONTAL_POSITION, facesContext);
62  	}
63  
64  	/**
65  	 * Returns <code>true</code> if the attribute "backgroundImageHorizontalPosition" is set.
66  	 * @return <code>true</code> if the attribute is set.
67  	 */
68  	public final boolean isBackgroundImageHorizontalPositionSetted() {
69  		return engine.isPropertySetted(Properties.BACKGROUND_IMAGE_HORIZONTAL_POSITION);
70  	}
71  
72  	public void setBackgroundImageHorizontalPosition(java.lang.String backgroundImageHorizontalPosition) {
73  		engine.setProperty(Properties.BACKGROUND_IMAGE_HORIZONTAL_POSITION, backgroundImageHorizontalPosition);
74  	}
75  
76  	public boolean isBackgroundImageHorizontalRepeat() {
77  		return isBackgroundImageHorizontalRepeat(null);
78  	}
79  
80  	/**
81  	 * See {@link #isBackgroundImageHorizontalRepeat() isBackgroundImageHorizontalRepeat()} for more details
82  	 */
83  	public boolean isBackgroundImageHorizontalRepeat(javax.faces.context.FacesContext facesContext) {
84  		return engine.getBoolProperty(Properties.BACKGROUND_IMAGE_HORIZONTAL_REPEAT, false, facesContext);
85  	}
86  
87  	/**
88  	 * Returns <code>true</code> if the attribute "backgroundImageHorizontalRepeat" is set.
89  	 * @return <code>true</code> if the attribute is set.
90  	 */
91  	public final boolean isBackgroundImageHorizontalRepeatSetted() {
92  		return engine.isPropertySetted(Properties.BACKGROUND_IMAGE_HORIZONTAL_REPEAT);
93  	}
94  
95  	public void setBackgroundImageHorizontalRepeat(boolean backgroundImageHorizontalRepeat) {
96  		engine.setProperty(Properties.BACKGROUND_IMAGE_HORIZONTAL_REPEAT, backgroundImageHorizontalRepeat);
97  	}
98  
99  	public java.lang.String getBackgroundImageURL() {
100 		return getBackgroundImageURL(null);
101 	}
102 
103 	/**
104 	 * See {@link #getBackgroundImageURL() getBackgroundImageURL()} for more details
105 	 */
106 	public java.lang.String getBackgroundImageURL(javax.faces.context.FacesContext facesContext) {
107 		return engine.getStringProperty(Properties.BACKGROUND_IMAGE_URL, facesContext);
108 	}
109 
110 	/**
111 	 * Returns <code>true</code> if the attribute "backgroundImageURL" is set.
112 	 * @return <code>true</code> if the attribute is set.
113 	 */
114 	public final boolean isBackgroundImageURLSetted() {
115 		return engine.isPropertySetted(Properties.BACKGROUND_IMAGE_URL);
116 	}
117 
118 	public void setBackgroundImageURL(java.lang.String backgroundImageURL) {
119 		engine.setProperty(Properties.BACKGROUND_IMAGE_URL, backgroundImageURL);
120 	}
121 
122 	public java.lang.String getBackgroundImageVerticalPosition() {
123 		return getBackgroundImageVerticalPosition(null);
124 	}
125 
126 	/**
127 	 * See {@link #getBackgroundImageVerticalPosition() getBackgroundImageVerticalPosition()} for more details
128 	 */
129 	public java.lang.String getBackgroundImageVerticalPosition(javax.faces.context.FacesContext facesContext) {
130 		return engine.getStringProperty(Properties.BACKGROUND_IMAGE_VERTICAL_POSITION, facesContext);
131 	}
132 
133 	/**
134 	 * Returns <code>true</code> if the attribute "backgroundImageVerticalPosition" is set.
135 	 * @return <code>true</code> if the attribute is set.
136 	 */
137 	public final boolean isBackgroundImageVerticalPositionSetted() {
138 		return engine.isPropertySetted(Properties.BACKGROUND_IMAGE_VERTICAL_POSITION);
139 	}
140 
141 	public void setBackgroundImageVerticalPosition(java.lang.String backgroundImageVerticalPosition) {
142 		engine.setProperty(Properties.BACKGROUND_IMAGE_VERTICAL_POSITION, backgroundImageVerticalPosition);
143 	}
144 
145 	public boolean isBackgroundImageVerticalRepeat() {
146 		return isBackgroundImageVerticalRepeat(null);
147 	}
148 
149 	/**
150 	 * See {@link #isBackgroundImageVerticalRepeat() isBackgroundImageVerticalRepeat()} for more details
151 	 */
152 	public boolean isBackgroundImageVerticalRepeat(javax.faces.context.FacesContext facesContext) {
153 		return engine.getBoolProperty(Properties.BACKGROUND_IMAGE_VERTICAL_REPEAT, false, facesContext);
154 	}
155 
156 	/**
157 	 * Returns <code>true</code> if the attribute "backgroundImageVerticalRepeat" is set.
158 	 * @return <code>true</code> if the attribute is set.
159 	 */
160 	public final boolean isBackgroundImageVerticalRepeatSetted() {
161 		return engine.isPropertySetted(Properties.BACKGROUND_IMAGE_VERTICAL_REPEAT);
162 	}
163 
164 	public void setBackgroundImageVerticalRepeat(boolean backgroundImageVerticalRepeat) {
165 		engine.setProperty(Properties.BACKGROUND_IMAGE_VERTICAL_REPEAT, backgroundImageVerticalRepeat);
166 	}
167 
168 	public boolean isBorder() {
169 		return isBorder(null);
170 	}
171 
172 	/**
173 	 * See {@link #isBorder() isBorder()} for more details
174 	 */
175 	public boolean isBorder(javax.faces.context.FacesContext facesContext) {
176 		return engine.getBoolProperty(Properties.BORDER, true, facesContext);
177 	}
178 
179 	/**
180 	 * Returns <code>true</code> if the attribute "border" is set.
181 	 * @return <code>true</code> if the attribute is set.
182 	 */
183 	public final boolean isBorderSetted() {
184 		return engine.isPropertySetted(Properties.BORDER);
185 	}
186 
187 	public void setBorder(boolean border) {
188 		engine.setProperty(Properties.BORDER, border);
189 	}
190 
191 	public final void addMouseOutListener(org.rcfaces.core.event.IMouseOutListener listener) {
192 		addFacesListener(listener);
193 	}
194 
195 	public final void removeMouseOutListener(org.rcfaces.core.event.IMouseOutListener listener) {
196 		removeFacesListener(listener);
197 	}
198 
199 	public final javax.faces.event.FacesListener [] listMouseOutListeners() {
200 		return getFacesListeners(org.rcfaces.core.event.IMouseOutListener.class);
201 	}
202 
203 	public final void addMouseOverListener(org.rcfaces.core.event.IMouseOverListener listener) {
204 		addFacesListener(listener);
205 	}
206 
207 	public final void removeMouseOverListener(org.rcfaces.core.event.IMouseOverListener listener) {
208 		removeFacesListener(listener);
209 	}
210 
211 	public final javax.faces.event.FacesListener [] listMouseOverListeners() {
212 		return getFacesListeners(org.rcfaces.core.event.IMouseOverListener.class);
213 	}
214 
215 	public final void addInitListener(org.rcfaces.core.event.IInitListener listener) {
216 		addFacesListener(listener);
217 	}
218 
219 	public final void removeInitListener(org.rcfaces.core.event.IInitListener listener) {
220 		removeFacesListener(listener);
221 	}
222 
223 	public final javax.faces.event.FacesListener [] listInitListeners() {
224 		return getFacesListeners(org.rcfaces.core.event.IInitListener.class);
225 	}
226 
227 	public java.lang.String getFor() {
228 		return getFor(null);
229 	}
230 
231 	/**
232 	 * See {@link #getFor() getFor()} for more details
233 	 */
234 	public java.lang.String getFor(javax.faces.context.FacesContext facesContext) {
235 		return engine.getStringProperty(Properties.FOR, facesContext);
236 	}
237 
238 	/**
239 	 * Returns <code>true</code> if the attribute "for" is set.
240 	 * @return <code>true</code> if the attribute is set.
241 	 */
242 	public final boolean isForSetted() {
243 		return engine.isPropertySetted(Properties.FOR);
244 	}
245 
246 	public void setFor(java.lang.String forValue) {
247 		engine.setProperty(Properties.FOR, forValue);
248 	}
249 
250 	public java.lang.String getErrorStyleClass() {
251 		return getErrorStyleClass(null);
252 	}
253 
254 	/**
255 	 * See {@link #getErrorStyleClass() getErrorStyleClass()} for more details
256 	 */
257 	public java.lang.String getErrorStyleClass(javax.faces.context.FacesContext facesContext) {
258 		return engine.getStringProperty(Properties.ERROR_STYLE_CLASS, facesContext);
259 	}
260 
261 	/**
262 	 * Returns <code>true</code> if the attribute "errorStyleClass" is set.
263 	 * @return <code>true</code> if the attribute is set.
264 	 */
265 	public final boolean isErrorStyleClassSetted() {
266 		return engine.isPropertySetted(Properties.ERROR_STYLE_CLASS);
267 	}
268 
269 	public void setErrorStyleClass(java.lang.String errorStyleClass) {
270 		engine.setProperty(Properties.ERROR_STYLE_CLASS, errorStyleClass);
271 	}
272 
273 	public java.lang.String getFatalStyleClass() {
274 		return getFatalStyleClass(null);
275 	}
276 
277 	/**
278 	 * See {@link #getFatalStyleClass() getFatalStyleClass()} for more details
279 	 */
280 	public java.lang.String getFatalStyleClass(javax.faces.context.FacesContext facesContext) {
281 		return engine.getStringProperty(Properties.FATAL_STYLE_CLASS, facesContext);
282 	}
283 
284 	/**
285 	 * Returns <code>true</code> if the attribute "fatalStyleClass" is set.
286 	 * @return <code>true</code> if the attribute is set.
287 	 */
288 	public final boolean isFatalStyleClassSetted() {
289 		return engine.isPropertySetted(Properties.FATAL_STYLE_CLASS);
290 	}
291 
292 	public void setFatalStyleClass(java.lang.String fatalStyleClass) {
293 		engine.setProperty(Properties.FATAL_STYLE_CLASS, fatalStyleClass);
294 	}
295 
296 	public java.lang.String getInfoStyleClass() {
297 		return getInfoStyleClass(null);
298 	}
299 
300 	/**
301 	 * See {@link #getInfoStyleClass() getInfoStyleClass()} for more details
302 	 */
303 	public java.lang.String getInfoStyleClass(javax.faces.context.FacesContext facesContext) {
304 		return engine.getStringProperty(Properties.INFO_STYLE_CLASS, facesContext);
305 	}
306 
307 	/**
308 	 * Returns <code>true</code> if the attribute "infoStyleClass" is set.
309 	 * @return <code>true</code> if the attribute is set.
310 	 */
311 	public final boolean isInfoStyleClassSetted() {
312 		return engine.isPropertySetted(Properties.INFO_STYLE_CLASS);
313 	}
314 
315 	public void setInfoStyleClass(java.lang.String infoStyleClass) {
316 		engine.setProperty(Properties.INFO_STYLE_CLASS, infoStyleClass);
317 	}
318 
319 	public java.lang.String getWarnStyleClass() {
320 		return getWarnStyleClass(null);
321 	}
322 
323 	/**
324 	 * See {@link #getWarnStyleClass() getWarnStyleClass()} for more details
325 	 */
326 	public java.lang.String getWarnStyleClass(javax.faces.context.FacesContext facesContext) {
327 		return engine.getStringProperty(Properties.WARN_STYLE_CLASS, facesContext);
328 	}
329 
330 	/**
331 	 * Returns <code>true</code> if the attribute "warnStyleClass" is set.
332 	 * @return <code>true</code> if the attribute is set.
333 	 */
334 	public final boolean isWarnStyleClassSetted() {
335 		return engine.isPropertySetted(Properties.WARN_STYLE_CLASS);
336 	}
337 
338 	public void setWarnStyleClass(java.lang.String warnStyleClass) {
339 		engine.setProperty(Properties.WARN_STYLE_CLASS, warnStyleClass);
340 	}
341 
342 	public boolean isShowIfMessage() {
343 		return isShowIfMessage(null);
344 	}
345 
346 	public boolean isShowIfMessage(javax.faces.context.FacesContext facesContext) {
347 		return engine.getBoolProperty(Properties.SHOW_IF_MESSAGE, false, facesContext);
348 	}
349 
350 	public void setShowIfMessage(boolean showIfMessage) {
351 		engine.setProperty(Properties.SHOW_IF_MESSAGE, showIfMessage);
352 	}
353 
354 	/**
355 	 * Returns <code>true</code> if the attribute "showIfMessage" is set.
356 	 * @return <code>true</code> if the attribute is set.
357 	 */
358 	public boolean isShowIfMessageSetted() {
359 		return engine.isPropertySetted(Properties.SHOW_IF_MESSAGE);
360 	}
361 
362 	public boolean isSetFocusIfMessage() {
363 		return isSetFocusIfMessage(null);
364 	}
365 
366 	public boolean isSetFocusIfMessage(javax.faces.context.FacesContext facesContext) {
367 		return engine.getBoolProperty(Properties.SET_FOCUS_IF_MESSAGE, false, facesContext);
368 	}
369 
370 	public void setSetFocusIfMessage(boolean setFocusIfMessage) {
371 		engine.setProperty(Properties.SET_FOCUS_IF_MESSAGE, setFocusIfMessage);
372 	}
373 
374 	/**
375 	 * Returns <code>true</code> if the attribute "setFocusIfMessage" is set.
376 	 * @return <code>true</code> if the attribute is set.
377 	 */
378 	public boolean isSetFocusIfMessageSetted() {
379 		return engine.isPropertySetted(Properties.SET_FOCUS_IF_MESSAGE);
380 	}
381 
382 	protected Set getCameliaFields() {
383 		return CAMELIA_ATTRIBUTES;
384 	}
385 }