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