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.UIComponent;
30  import javax.faces.component.behavior.ClientBehavior;
31  import javax.faces.component.behavior.ClientBehaviorHolder;
32  import org.apache.myfaces.trinidad.bean.FacesBean;
33  import org.apache.myfaces.trinidad.bean.PropertyKey;
34  import org.apache.myfaces.trinidad.component.UIXMessage;
35  import org.apache.myfaces.trinidad.util.ComponentUtils;
36  
37  /**
38   *
39   * <html:p>
40   *  Component that displays a message on behalf of a component.
41   *  Trinidad input components typically support automatically showing
42   *  their own messages, including a tip and the error message.
43   *  Developers should use this when they set &quot;simple&quot;
44   *  to &quot;true&quot; on an Trinidad input component, or when using
45   *  a non-Trinidad input component.
46   * </html:p>
47   *
48   * <h4>Events:</h4>
49   * <table border="1" width="100%" cellpadding="3" summary="">
50   * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
51   * <th align="left">Type</th>
52   * <th align="left">Phases</th>
53   * <th align="left">Description</th>
54   * </tr>
55   * <tr class="TableRowColor">
56   * <td valign="top"><code>org.apache.myfaces.trinidad.event.AttributeChangeEvent</code></td>
57   * <td valign="top" nowrap>Invoke<br>Application<br>Apply<br>Request<br>Values</td>
58   * <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>
59   * </tr>
60   * </table>
61   */
62  public class CoreMessage extends UIXMessage
63                           implements ClientBehaviorHolder
64  {
65    static public final String MESSAGE_TYPE_INFO = "info";
66    static public final String MESSAGE_TYPE_WARNING = "warning";
67    static public final String MESSAGE_TYPE_NONE = "none";
68    static public final String MESSAGE_TYPE_ERROR = "error";
69    static public final FacesBean.Type TYPE = new FacesBean.Type(
70      UIXMessage.TYPE);
71    static public final PropertyKey INLINE_STYLE_KEY =
72      TYPE.registerKey("inlineStyle", String.class);
73    static public final PropertyKey STYLE_CLASS_KEY =
74      TYPE.registerKey("styleClass", String.class);
75    static public final PropertyKey SHORT_DESC_KEY =
76      TYPE.registerKey("shortDesc", String.class);
77    static public final PropertyKey PARTIAL_TRIGGERS_KEY =
78      TYPE.registerKey("partialTriggers", String[].class, null, 0, PropertyKey.Mutable.RARELY);
79    static public final PropertyKey ONCLICK_KEY =
80      TYPE.registerKey("onclick", String.class);
81    static public final PropertyKey ONDBLCLICK_KEY =
82      TYPE.registerKey("ondblclick", String.class);
83    static public final PropertyKey ONMOUSEDOWN_KEY =
84      TYPE.registerKey("onmousedown", String.class);
85    static public final PropertyKey ONMOUSEUP_KEY =
86      TYPE.registerKey("onmouseup", String.class);
87    static public final PropertyKey ONMOUSEOVER_KEY =
88      TYPE.registerKey("onmouseover", String.class);
89    static public final PropertyKey ONMOUSEMOVE_KEY =
90      TYPE.registerKey("onmousemove", String.class);
91    static public final PropertyKey ONMOUSEOUT_KEY =
92      TYPE.registerKey("onmouseout", String.class);
93    static public final PropertyKey ONKEYPRESS_KEY =
94      TYPE.registerKey("onkeypress", String.class);
95    static public final PropertyKey ONKEYDOWN_KEY =
96      TYPE.registerKey("onkeydown", String.class);
97    static public final PropertyKey ONKEYUP_KEY =
98      TYPE.registerKey("onkeyup", String.class);
99    static public final PropertyKey MESSAGE_KEY =
100     TYPE.registerKey("message", String.class);
101   static public final PropertyKey MESSAGE_TYPE_KEY =
102     TYPE.registerKey("messageType", String.class, "none");
103   static public final String HELP_FACET = "help";
104 
105   static public final String COMPONENT_FAMILY =
106     "org.apache.myfaces.trinidad.Message";
107   static public final String COMPONENT_TYPE =
108     "org.apache.myfaces.trinidad.CoreMessage";
109   // Supported client events for client behaviors:
110   private final static Collection<String> _EVENT_NAMES = Collections.unmodifiableCollection(
111     Arrays.asList(
112       "click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove",
113       "mouseout", "keypress", "keydown", "keyup"
114     ));
115 
116   /**
117    * Construct an instance of the CoreMessage.
118    */
119   public CoreMessage()
120   {
121     super("org.apache.myfaces.trinidad.Message");
122   }
123 
124   /**
125    * This facet should contain field level help.
126    */
127   final public UIComponent getHelp()
128   {
129     return getFacet(HELP_FACET);
130   }
131 
132   /**
133    * This facet should contain field level help.
134    */
135   @SuppressWarnings("unchecked")
136   final public void setHelp(UIComponent helpFacet)
137   {
138     getFacets().put(HELP_FACET, helpFacet);
139   }
140 
141   /**
142    * Gets the CSS styles to use for this component.
143    *
144    * @return  the new inlineStyle value
145    */
146   final public String getInlineStyle()
147   {
148     return ComponentUtils.resolveString(getProperty(INLINE_STYLE_KEY));
149   }
150 
151   /**
152    * Sets the CSS styles to use for this component.
153    * 
154    * @param inlineStyle  the new inlineStyle value
155    */
156   final public void setInlineStyle(String inlineStyle)
157   {
158     setProperty(INLINE_STYLE_KEY, (inlineStyle));
159   }
160 
161   /**
162    * Gets a CSS style class to use for this component.
163    *
164    * @return  the new styleClass value
165    */
166   final public String getStyleClass()
167   {
168     return ComponentUtils.resolveString(getProperty(STYLE_CLASS_KEY));
169   }
170 
171   /**
172    * Sets a CSS style class to use for this component.
173    * 
174    * @param styleClass  the new styleClass value
175    */
176   final public void setStyleClass(String styleClass)
177   {
178     setProperty(STYLE_CLASS_KEY, (styleClass));
179   }
180 
181   /**
182    * Gets The short description of the component. This text is commonly used by user agents to display tooltip help text.
183    *
184    * @return  the new shortDesc value
185    */
186   final public String getShortDesc()
187   {
188     return ComponentUtils.resolveString(getProperty(SHORT_DESC_KEY));
189   }
190 
191   /**
192    * Sets The short description of the component. This text is commonly used by user agents to display tooltip help text.
193    * 
194    * @param shortDesc  the new shortDesc value
195    */
196   final public void setShortDesc(String shortDesc)
197   {
198     setProperty(SHORT_DESC_KEY, (shortDesc));
199   }
200 
201   /**
202    * Gets the IDs of the components that should trigger a partial update.
203    *         <p>
204    *         This component will listen on the trigger components. If one of the
205    *         trigger components receives an event that will cause it to update
206    *         in some way, this component will request to be updated too.</p>
207    *         <p>
208    *         Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"
209    *         </p>
210    *         <p>
211    *         Identifiers must account for NamingContainers.  You can use a single colon to start the search from the root,
212    *         or use multiple colons to move up through the NamingContainer. For example,
213    *         "::" will pop out of this component's naming container (it pops out of itself if it is a naming container), 
214    *         ":::" will pop out of two naming containers, etc. The search for
215    *         the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the 
216    *         component with id = commandButton1 after popping out of two naming containers relative to this component.
217    *         To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".</p>
218    *
219    * @return  the new partialTriggers value
220    */
221   final public String[] getPartialTriggers()
222   {
223     return (String[])getProperty(PARTIAL_TRIGGERS_KEY);
224   }
225 
226   /**
227    * Sets the IDs of the components that should trigger a partial update.
228    *         <p>
229    *         This component will listen on the trigger components. If one of the
230    *         trigger components receives an event that will cause it to update
231    *         in some way, this component will request to be updated too.</p>
232    *         <p>
233    *         Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"
234    *         </p>
235    *         <p>
236    *         Identifiers must account for NamingContainers.  You can use a single colon to start the search from the root,
237    *         or use multiple colons to move up through the NamingContainer. For example,
238    *         "::" will pop out of this component's naming container (it pops out of itself if it is a naming container), 
239    *         ":::" will pop out of two naming containers, etc. The search for
240    *         the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the 
241    *         component with id = commandButton1 after popping out of two naming containers relative to this component.
242    *         To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".</p>
243    * 
244    * @param partialTriggers  the new partialTriggers value
245    */
246   final public void setPartialTriggers(String[] partialTriggers)
247   {
248     setProperty(PARTIAL_TRIGGERS_KEY, (partialTriggers));
249   }
250 
251   /**
252    * Gets an onclick Javascript handler.
253    *
254    * @return  the new onclick value
255    */
256   final public String getOnclick()
257   {
258     return ComponentUtils.resolveString(getProperty(ONCLICK_KEY));
259   }
260 
261   /**
262    * Sets an onclick Javascript handler.
263    * 
264    * @param onclick  the new onclick value
265    */
266   final public void setOnclick(String onclick)
267   {
268     setProperty(ONCLICK_KEY, (onclick));
269   }
270 
271   /**
272    * Gets an ondblclick Javascript handler.
273    *
274    * @return  the new ondblclick value
275    */
276   final public String getOndblclick()
277   {
278     return ComponentUtils.resolveString(getProperty(ONDBLCLICK_KEY));
279   }
280 
281   /**
282    * Sets an ondblclick Javascript handler.
283    * 
284    * @param ondblclick  the new ondblclick value
285    */
286   final public void setOndblclick(String ondblclick)
287   {
288     setProperty(ONDBLCLICK_KEY, (ondblclick));
289   }
290 
291   /**
292    * Gets an onmousedown Javascript handler.
293    *
294    * @return  the new onmousedown value
295    */
296   final public String getOnmousedown()
297   {
298     return ComponentUtils.resolveString(getProperty(ONMOUSEDOWN_KEY));
299   }
300 
301   /**
302    * Sets an onmousedown Javascript handler.
303    * 
304    * @param onmousedown  the new onmousedown value
305    */
306   final public void setOnmousedown(String onmousedown)
307   {
308     setProperty(ONMOUSEDOWN_KEY, (onmousedown));
309   }
310 
311   /**
312    * Gets an onmouseup Javascript handler.
313    *
314    * @return  the new onmouseup value
315    */
316   final public String getOnmouseup()
317   {
318     return ComponentUtils.resolveString(getProperty(ONMOUSEUP_KEY));
319   }
320 
321   /**
322    * Sets an onmouseup Javascript handler.
323    * 
324    * @param onmouseup  the new onmouseup value
325    */
326   final public void setOnmouseup(String onmouseup)
327   {
328     setProperty(ONMOUSEUP_KEY, (onmouseup));
329   }
330 
331   /**
332    * Gets an onmouseover Javascript handler.
333    *
334    * @return  the new onmouseover value
335    */
336   final public String getOnmouseover()
337   {
338     return ComponentUtils.resolveString(getProperty(ONMOUSEOVER_KEY));
339   }
340 
341   /**
342    * Sets an onmouseover Javascript handler.
343    * 
344    * @param onmouseover  the new onmouseover value
345    */
346   final public void setOnmouseover(String onmouseover)
347   {
348     setProperty(ONMOUSEOVER_KEY, (onmouseover));
349   }
350 
351   /**
352    * Gets an onmousemove Javascript handler.
353    *
354    * @return  the new onmousemove value
355    */
356   final public String getOnmousemove()
357   {
358     return ComponentUtils.resolveString(getProperty(ONMOUSEMOVE_KEY));
359   }
360 
361   /**
362    * Sets an onmousemove Javascript handler.
363    * 
364    * @param onmousemove  the new onmousemove value
365    */
366   final public void setOnmousemove(String onmousemove)
367   {
368     setProperty(ONMOUSEMOVE_KEY, (onmousemove));
369   }
370 
371   /**
372    * Gets an onmouseout Javascript handler.
373    *
374    * @return  the new onmouseout value
375    */
376   final public String getOnmouseout()
377   {
378     return ComponentUtils.resolveString(getProperty(ONMOUSEOUT_KEY));
379   }
380 
381   /**
382    * Sets an onmouseout Javascript handler.
383    * 
384    * @param onmouseout  the new onmouseout value
385    */
386   final public void setOnmouseout(String onmouseout)
387   {
388     setProperty(ONMOUSEOUT_KEY, (onmouseout));
389   }
390 
391   /**
392    * Gets an onkeypress Javascript handler.
393    *
394    * @return  the new onkeypress value
395    */
396   final public String getOnkeypress()
397   {
398     return ComponentUtils.resolveString(getProperty(ONKEYPRESS_KEY));
399   }
400 
401   /**
402    * Sets an onkeypress Javascript handler.
403    * 
404    * @param onkeypress  the new onkeypress value
405    */
406   final public void setOnkeypress(String onkeypress)
407   {
408     setProperty(ONKEYPRESS_KEY, (onkeypress));
409   }
410 
411   /**
412    * Gets an onkeydown Javascript handler.
413    *
414    * @return  the new onkeydown value
415    */
416   final public String getOnkeydown()
417   {
418     return ComponentUtils.resolveString(getProperty(ONKEYDOWN_KEY));
419   }
420 
421   /**
422    * Sets an onkeydown Javascript handler.
423    * 
424    * @param onkeydown  the new onkeydown value
425    */
426   final public void setOnkeydown(String onkeydown)
427   {
428     setProperty(ONKEYDOWN_KEY, (onkeydown));
429   }
430 
431   /**
432    * Gets an onkeyup Javascript handler.
433    *
434    * @return  the new onkeyup value
435    */
436   final public String getOnkeyup()
437   {
438     return ComponentUtils.resolveString(getProperty(ONKEYUP_KEY));
439   }
440 
441   /**
442    * Sets an onkeyup Javascript handler.
443    * 
444    * @param onkeyup  the new onkeyup value
445    */
446   final public void setOnkeyup(String onkeyup)
447   {
448     setProperty(ONKEYUP_KEY, (onkeyup));
449   }
450 
451   /**
452    * Gets the error, warning, or informational text.
453    *
454    * @return  the new message value
455    */
456   final public String getMessage()
457   {
458     return ComponentUtils.resolveString(getProperty(MESSAGE_KEY));
459   }
460 
461   /**
462    * Sets the error, warning, or informational text.
463    * 
464    * @param message  the new message value
465    */
466   final public void setMessage(String message)
467   {
468     setProperty(MESSAGE_KEY, (message));
469   }
470 
471   /**
472    * Gets the type of the message; acceptable values
473    *           are "error", "warning", "info", and "none".  Defaults to "none".
474    *
475    * @return  the new messageType value
476    */
477   final public String getMessageType()
478   {
479     return ComponentUtils.resolveString(getProperty(MESSAGE_TYPE_KEY), "none");
480   }
481 
482   /**
483    * Sets the type of the message; acceptable values
484    *           are "error", "warning", "info", and "none".  Defaults to "none".
485    * 
486    * @param messageType  the new messageType value
487    */
488   final public void setMessageType(String messageType)
489   {
490     setProperty(MESSAGE_TYPE_KEY, (messageType));
491   }
492 
493   @Override
494   public String getDefaultEventName()
495   {
496     return "click";
497   }
498 
499   @Override
500   public Collection<String> getEventNames()
501   {
502     return _EVENT_NAMES;
503   }
504 
505   @Override
506   public Map<String, List<ClientBehavior>> getClientBehaviors()
507   {
508     return super.getClientBehaviors();
509   }
510 
511   @Override
512   public void addClientBehavior(
513     String         eventName,
514     ClientBehavior behavior)
515   {
516     super.addClientBehavior(eventName, behavior);
517   }
518 
519   @Override
520   public String getFamily()
521   {
522     return COMPONENT_FAMILY;
523   }
524 
525   @Override
526   protected FacesBean.Type getBeanType()
527   {
528     return TYPE;
529   }
530 
531   /**
532    * Construct an instance of the CoreMessage.
533    */
534   protected CoreMessage(
535     String rendererType
536     )
537   {
538     super(rendererType);
539   }
540 
541   static
542   {
543     TYPE.lockAndRegister("org.apache.myfaces.trinidad.Message","org.apache.myfaces.trinidad.Message");
544   }
545 }