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