View Javadoc

1   // WARNING: This file was automatically generated. Do not edit it directly,
2   //          or you will lose your changes.
3   
4   /*
5    * Licensed to the Apache Software Foundation (ASF) under one
6    * or more contributor license agreements.  See the NOTICE file
7    * distributed with this work for additional information
8    * regarding copyright ownership.  The ASF licenses this file
9    * to you under the Apache License, Version 2.0 (the
10   * "License"); you may not use this file except in compliance
11   * with the License.  You may obtain a copy of the License at
12   *
13   *   http://www.apache.org/licenses/LICENSE-2.0
14   *
15   * Unless required by applicable law or agreed to in writing,
16   * software distributed under the License is distributed on an
17   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18   * KIND, either express or implied.  See the License for the
19   * specific language governing permissions and limitations
20   * under the License.
21  */
22  package org.apache.myfaces.trinidad.component.core.output;
23  
24  import java.util.Arrays;
25  import java.util.Collection;
26  import java.util.Collections;
27  import java.util.List;
28  import java.util.Map;
29  import javax.faces.component.behavior.ClientBehavior;
30  import javax.faces.component.behavior.ClientBehaviorHolder;
31  import org.apache.myfaces.trinidad.bean.FacesBean;
32  import org.apache.myfaces.trinidad.bean.PropertyKey;
33  import org.apache.myfaces.trinidad.component.UIXMessages;
34  import org.apache.myfaces.trinidad.util.ComponentUtils;
35  
36  /**
37   *
38   * The messages bean is used at the top of an application page to
39   * give the user important messaging information. It will
40   * automatically show any messages added to the FacesContext.
41   *
42   * <h4>Events:</h4>
43   * <table border="1" width="100%" cellpadding="3" summary="">
44   * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
45   * <th align="left">Type</th>
46   * <th align="left">Phases</th>
47   * <th align="left">Description</th>
48   * </tr>
49   * <tr class="TableRowColor">
50   * <td valign="top"><code>org.apache.myfaces.trinidad.event.AttributeChangeEvent</code></td>
51   * <td valign="top" nowrap>Invoke<br>Application<br>Apply<br>Request<br>Values</td>
52   * <td valign="top">Event delivered to describe an attribute change.  Attribute change events are not delivered for any programmatic change to a property.  They are only delivered when a renderer changes a property without the application's specific request.  An example of an attribute change event might include the width of a column that supported client-side resizing.</td>
53   * </tr>
54   * </table>
55   */
56  public class CoreMessages extends UIXMessages
57                            implements ClientBehaviorHolder
58  {
59    static public final FacesBean.Type TYPE = new FacesBean.Type(
60      UIXMessages.TYPE);
61    static public final PropertyKey INLINE_STYLE_KEY =
62      TYPE.registerKey("inlineStyle", String.class);
63    static public final PropertyKey STYLE_CLASS_KEY =
64      TYPE.registerKey("styleClass", String.class);
65    static public final PropertyKey SHORT_DESC_KEY =
66      TYPE.registerKey("shortDesc", String.class);
67    static public final PropertyKey PARTIAL_TRIGGERS_KEY =
68      TYPE.registerKey("partialTriggers", String[].class, null, 0, PropertyKey.Mutable.RARELY);
69    static public final PropertyKey ONCLICK_KEY =
70      TYPE.registerKey("onclick", String.class);
71    static public final PropertyKey ONDBLCLICK_KEY =
72      TYPE.registerKey("ondblclick", String.class);
73    static public final PropertyKey ONMOUSEDOWN_KEY =
74      TYPE.registerKey("onmousedown", String.class);
75    static public final PropertyKey ONMOUSEUP_KEY =
76      TYPE.registerKey("onmouseup", String.class);
77    static public final PropertyKey ONMOUSEOVER_KEY =
78      TYPE.registerKey("onmouseover", String.class);
79    static public final PropertyKey ONMOUSEMOVE_KEY =
80      TYPE.registerKey("onmousemove", String.class);
81    static public final PropertyKey ONMOUSEOUT_KEY =
82      TYPE.registerKey("onmouseout", String.class);
83    static public final PropertyKey ONKEYPRESS_KEY =
84      TYPE.registerKey("onkeypress", String.class);
85    static public final PropertyKey ONKEYDOWN_KEY =
86      TYPE.registerKey("onkeydown", String.class);
87    static public final PropertyKey ONKEYUP_KEY =
88      TYPE.registerKey("onkeyup", String.class);
89    static public final PropertyKey MESSAGE_KEY =
90      TYPE.registerKey("message", String.class);
91    static public final PropertyKey TEXT_KEY =
92      TYPE.registerKey("text", String.class);
93    static public final PropertyKey GLOBAL_ONLY_KEY =
94      TYPE.registerKey("globalOnly", Boolean.class, Boolean.FALSE);
95  
96    static public final String COMPONENT_FAMILY =
97      "org.apache.myfaces.trinidad.Messages";
98    static public final String COMPONENT_TYPE =
99      "org.apache.myfaces.trinidad.CoreMessages";
100   // Supported client events for client behaviors:
101   private final static Collection<String> _EVENT_NAMES = Collections.unmodifiableCollection(
102     Arrays.asList(
103       "click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove",
104       "mouseout", "keypress", "keydown", "keyup"
105     ));
106 
107   /**
108    * Construct an instance of the CoreMessages.
109    */
110   public CoreMessages()
111   {
112     super("org.apache.myfaces.trinidad.Messages");
113   }
114 
115   /**
116    * Gets the CSS styles to use for this component.
117    *
118    * @return  the new inlineStyle value
119    */
120   final public String getInlineStyle()
121   {
122     return ComponentUtils.resolveString(getProperty(INLINE_STYLE_KEY));
123   }
124 
125   /**
126    * Sets the CSS styles to use for this component.
127    * 
128    * @param inlineStyle  the new inlineStyle value
129    */
130   final public void setInlineStyle(String inlineStyle)
131   {
132     setProperty(INLINE_STYLE_KEY, (inlineStyle));
133   }
134 
135   /**
136    * Gets a CSS style class to use for this component.
137    *
138    * @return  the new styleClass value
139    */
140   final public String getStyleClass()
141   {
142     return ComponentUtils.resolveString(getProperty(STYLE_CLASS_KEY));
143   }
144 
145   /**
146    * Sets a CSS style class to use for this component.
147    * 
148    * @param styleClass  the new styleClass value
149    */
150   final public void setStyleClass(String styleClass)
151   {
152     setProperty(STYLE_CLASS_KEY, (styleClass));
153   }
154 
155   /**
156    * Gets The short description of the component. This text is commonly used by user agents to display tooltip help text.
157    *
158    * @return  the new shortDesc value
159    */
160   final public String getShortDesc()
161   {
162     return ComponentUtils.resolveString(getProperty(SHORT_DESC_KEY));
163   }
164 
165   /**
166    * Sets The short description of the component. This text is commonly used by user agents to display tooltip help text.
167    * 
168    * @param shortDesc  the new shortDesc value
169    */
170   final public void setShortDesc(String shortDesc)
171   {
172     setProperty(SHORT_DESC_KEY, (shortDesc));
173   }
174 
175   /**
176    * Gets the IDs of the components that should trigger a partial update.
177    *         <p>
178    *         This component will listen on the trigger components. If one of the
179    *         trigger components receives an event that will cause it to update
180    *         in some way, this component will request to be updated too.</p>
181    *         <p>
182    *         Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"
183    *         </p>
184    *         <p>
185    *         Identifiers must account for NamingContainers.  You can use a single colon to start the search from the root,
186    *         or use multiple colons to move up through the NamingContainer. For example,
187    *         "::" will pop out of this component's naming container (it pops out of itself if it is a naming container), 
188    *         ":::" will pop out of two naming containers, etc. The search for
189    *         the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the 
190    *         component with id = commandButton1 after popping out of two naming containers relative to this component.
191    *         To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".</p>
192    *
193    * @return  the new partialTriggers value
194    */
195   final public String[] getPartialTriggers()
196   {
197     return (String[])getProperty(PARTIAL_TRIGGERS_KEY);
198   }
199 
200   /**
201    * Sets the IDs of the components that should trigger a partial update.
202    *         <p>
203    *         This component will listen on the trigger components. If one of the
204    *         trigger components receives an event that will cause it to update
205    *         in some way, this component will request to be updated too.</p>
206    *         <p>
207    *         Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"
208    *         </p>
209    *         <p>
210    *         Identifiers must account for NamingContainers.  You can use a single colon to start the search from the root,
211    *         or use multiple colons to move up through the NamingContainer. For example,
212    *         "::" will pop out of this component's naming container (it pops out of itself if it is a naming container), 
213    *         ":::" will pop out of two naming containers, etc. The search for
214    *         the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the 
215    *         component with id = commandButton1 after popping out of two naming containers relative to this component.
216    *         To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".</p>
217    * 
218    * @param partialTriggers  the new partialTriggers value
219    */
220   final public void setPartialTriggers(String[] partialTriggers)
221   {
222     setProperty(PARTIAL_TRIGGERS_KEY, (partialTriggers));
223   }
224 
225   /**
226    * Gets an onclick Javascript handler.
227    *
228    * @return  the new onclick value
229    */
230   final public String getOnclick()
231   {
232     return ComponentUtils.resolveString(getProperty(ONCLICK_KEY));
233   }
234 
235   /**
236    * Sets an onclick Javascript handler.
237    * 
238    * @param onclick  the new onclick value
239    */
240   final public void setOnclick(String onclick)
241   {
242     setProperty(ONCLICK_KEY, (onclick));
243   }
244 
245   /**
246    * Gets an ondblclick Javascript handler.
247    *
248    * @return  the new ondblclick value
249    */
250   final public String getOndblclick()
251   {
252     return ComponentUtils.resolveString(getProperty(ONDBLCLICK_KEY));
253   }
254 
255   /**
256    * Sets an ondblclick Javascript handler.
257    * 
258    * @param ondblclick  the new ondblclick value
259    */
260   final public void setOndblclick(String ondblclick)
261   {
262     setProperty(ONDBLCLICK_KEY, (ondblclick));
263   }
264 
265   /**
266    * Gets an onmousedown Javascript handler.
267    *
268    * @return  the new onmousedown value
269    */
270   final public String getOnmousedown()
271   {
272     return ComponentUtils.resolveString(getProperty(ONMOUSEDOWN_KEY));
273   }
274 
275   /**
276    * Sets an onmousedown Javascript handler.
277    * 
278    * @param onmousedown  the new onmousedown value
279    */
280   final public void setOnmousedown(String onmousedown)
281   {
282     setProperty(ONMOUSEDOWN_KEY, (onmousedown));
283   }
284 
285   /**
286    * Gets an onmouseup Javascript handler.
287    *
288    * @return  the new onmouseup value
289    */
290   final public String getOnmouseup()
291   {
292     return ComponentUtils.resolveString(getProperty(ONMOUSEUP_KEY));
293   }
294 
295   /**
296    * Sets an onmouseup Javascript handler.
297    * 
298    * @param onmouseup  the new onmouseup value
299    */
300   final public void setOnmouseup(String onmouseup)
301   {
302     setProperty(ONMOUSEUP_KEY, (onmouseup));
303   }
304 
305   /**
306    * Gets an onmouseover Javascript handler.
307    *
308    * @return  the new onmouseover value
309    */
310   final public String getOnmouseover()
311   {
312     return ComponentUtils.resolveString(getProperty(ONMOUSEOVER_KEY));
313   }
314 
315   /**
316    * Sets an onmouseover Javascript handler.
317    * 
318    * @param onmouseover  the new onmouseover value
319    */
320   final public void setOnmouseover(String onmouseover)
321   {
322     setProperty(ONMOUSEOVER_KEY, (onmouseover));
323   }
324 
325   /**
326    * Gets an onmousemove Javascript handler.
327    *
328    * @return  the new onmousemove value
329    */
330   final public String getOnmousemove()
331   {
332     return ComponentUtils.resolveString(getProperty(ONMOUSEMOVE_KEY));
333   }
334 
335   /**
336    * Sets an onmousemove Javascript handler.
337    * 
338    * @param onmousemove  the new onmousemove value
339    */
340   final public void setOnmousemove(String onmousemove)
341   {
342     setProperty(ONMOUSEMOVE_KEY, (onmousemove));
343   }
344 
345   /**
346    * Gets an onmouseout Javascript handler.
347    *
348    * @return  the new onmouseout value
349    */
350   final public String getOnmouseout()
351   {
352     return ComponentUtils.resolveString(getProperty(ONMOUSEOUT_KEY));
353   }
354 
355   /**
356    * Sets an onmouseout Javascript handler.
357    * 
358    * @param onmouseout  the new onmouseout value
359    */
360   final public void setOnmouseout(String onmouseout)
361   {
362     setProperty(ONMOUSEOUT_KEY, (onmouseout));
363   }
364 
365   /**
366    * Gets an onkeypress Javascript handler.
367    *
368    * @return  the new onkeypress value
369    */
370   final public String getOnkeypress()
371   {
372     return ComponentUtils.resolveString(getProperty(ONKEYPRESS_KEY));
373   }
374 
375   /**
376    * Sets an onkeypress Javascript handler.
377    * 
378    * @param onkeypress  the new onkeypress value
379    */
380   final public void setOnkeypress(String onkeypress)
381   {
382     setProperty(ONKEYPRESS_KEY, (onkeypress));
383   }
384 
385   /**
386    * Gets an onkeydown Javascript handler.
387    *
388    * @return  the new onkeydown value
389    */
390   final public String getOnkeydown()
391   {
392     return ComponentUtils.resolveString(getProperty(ONKEYDOWN_KEY));
393   }
394 
395   /**
396    * Sets an onkeydown Javascript handler.
397    * 
398    * @param onkeydown  the new onkeydown value
399    */
400   final public void setOnkeydown(String onkeydown)
401   {
402     setProperty(ONKEYDOWN_KEY, (onkeydown));
403   }
404 
405   /**
406    * Gets an onkeyup Javascript handler.
407    *
408    * @return  the new onkeyup value
409    */
410   final public String getOnkeyup()
411   {
412     return ComponentUtils.resolveString(getProperty(ONKEYUP_KEY));
413   }
414 
415   /**
416    * Sets an onkeyup Javascript handler.
417    * 
418    * @param onkeyup  the new onkeyup value
419    */
420   final public void setOnkeyup(String onkeyup)
421   {
422     setProperty(ONKEYUP_KEY, (onkeyup));
423   }
424 
425   /**
426    * Gets the main text message for the box.
427    *
428    * @return  the new message value
429    */
430   final public String getMessage()
431   {
432     return ComponentUtils.resolveString(getProperty(MESSAGE_KEY));
433   }
434 
435   /**
436    * Sets the main text message for the box.
437    * 
438    * @param message  the new message value
439    */
440   final public void setMessage(String message)
441   {
442     setProperty(MESSAGE_KEY, (message));
443   }
444 
445   /**
446    * Gets the overridden title text.
447    *
448    * @return  the new text value
449    */
450   final public String getText()
451   {
452     return ComponentUtils.resolveString(getProperty(TEXT_KEY));
453   }
454 
455   /**
456    * Sets the overridden title text.
457    * 
458    * @param text  the new text value
459    */
460   final public void setText(String text)
461   {
462     setProperty(TEXT_KEY, (text));
463   }
464 
465   /**
466    * Gets whether to render all messages or just global messages. Normally
467    * global messages are rendered followed by messages for individual
468    * components. If this attribute is set to true, only the global
469    * messages will be rendered.
470    *
471    * @return  the new globalOnly value
472    */
473   final public boolean isGlobalOnly()
474   {
475     return ComponentUtils.resolveBoolean(getProperty(GLOBAL_ONLY_KEY), false);
476   }
477 
478   /**
479    * Sets whether to render all messages or just global messages. Normally
480    * global messages are rendered followed by messages for individual
481    * components. If this attribute is set to true, only the global
482    * messages will be rendered.
483    * 
484    * @param globalOnly  the new globalOnly value
485    */
486   final public void setGlobalOnly(boolean globalOnly)
487   {
488     setProperty(GLOBAL_ONLY_KEY, globalOnly ? Boolean.TRUE : Boolean.FALSE);
489   }
490 
491   @Override
492   public String getDefaultEventName()
493   {
494     return "click";
495   }
496 
497   @Override
498   public Collection<String> getEventNames()
499   {
500     return _EVENT_NAMES;
501   }
502 
503   @Override
504   public Map<String, List<ClientBehavior>> getClientBehaviors()
505   {
506     return super.getClientBehaviors();
507   }
508 
509   @Override
510   public void addClientBehavior(
511     String         eventName,
512     ClientBehavior behavior)
513   {
514     super.addClientBehavior(eventName, behavior);
515   }
516 
517   @Override
518   public String getFamily()
519   {
520     return COMPONENT_FAMILY;
521   }
522 
523   @Override
524   protected FacesBean.Type getBeanType()
525   {
526     return TYPE;
527   }
528 
529   /**
530    * Construct an instance of the CoreMessages.
531    */
532   protected CoreMessages(
533     String rendererType
534     )
535   {
536     super(rendererType);
537   }
538 
539   static
540   {
541     TYPE.lockAndRegister("org.apache.myfaces.trinidad.Messages","org.apache.myfaces.trinidad.Messages");
542   }
543 }