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