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.nav;
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.UIXGo;
34  import org.apache.myfaces.trinidad.util.ComponentUtils;
35  
36  /**
37   *
38   * The goButton creates a push button that navigates directly
39   * to another location instead of delivering an action.  It can
40   * be used in place of commandButton where a server-side action
41   * is not needed.
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 CoreGoButton extends UIXGo
58                            implements ClientBehaviorHolder
59  {
60    static public final FacesBean.Type TYPE = new FacesBean.Type(
61      UIXGo.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 TARGET_FRAME_KEY =
69      TYPE.registerKey("targetFrame", String.class);
70    static public final PropertyKey ICON_KEY =
71      TYPE.registerKey("icon", String.class);
72    static public final PropertyKey INLINE_STYLE_KEY =
73      TYPE.registerKey("inlineStyle", String.class);
74    static public final PropertyKey STYLE_CLASS_KEY =
75      TYPE.registerKey("styleClass", String.class);
76    static public final PropertyKey SHORT_DESC_KEY =
77      TYPE.registerKey("shortDesc", String.class);
78    static public final PropertyKey PARTIAL_TRIGGERS_KEY =
79      TYPE.registerKey("partialTriggers", String[].class, null, 0, PropertyKey.Mutable.RARELY);
80    static public final PropertyKey ONCLICK_KEY =
81      TYPE.registerKey("onclick", String.class);
82    static public final PropertyKey ONDBLCLICK_KEY =
83      TYPE.registerKey("ondblclick", String.class);
84    static public final PropertyKey ONMOUSEDOWN_KEY =
85      TYPE.registerKey("onmousedown", String.class);
86    static public final PropertyKey ONMOUSEUP_KEY =
87      TYPE.registerKey("onmouseup", String.class);
88    static public final PropertyKey ONMOUSEOVER_KEY =
89      TYPE.registerKey("onmouseover", String.class);
90    static public final PropertyKey ONMOUSEMOVE_KEY =
91      TYPE.registerKey("onmousemove", String.class);
92    static public final PropertyKey ONMOUSEOUT_KEY =
93      TYPE.registerKey("onmouseout", String.class);
94    static public final PropertyKey ONKEYPRESS_KEY =
95      TYPE.registerKey("onkeypress", String.class);
96    static public final PropertyKey ONKEYDOWN_KEY =
97      TYPE.registerKey("onkeydown", String.class);
98    static public final PropertyKey ONKEYUP_KEY =
99      TYPE.registerKey("onkeyup", String.class);
100   static public final PropertyKey ONBLUR_KEY =
101     TYPE.registerKey("onblur", String.class);
102   static public final PropertyKey ONFOCUS_KEY =
103     TYPE.registerKey("onfocus", String.class);
104 
105   static public final String COMPONENT_FAMILY =
106     "org.apache.myfaces.trinidad.Go";
107   static public final String COMPONENT_TYPE =
108     "org.apache.myfaces.trinidad.CoreGoButton";
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", "focus", "blur"
114     ));
115 
116   /**
117    * Construct an instance of the CoreGoButton.
118    */
119   public CoreGoButton()
120   {
121     super("org.apache.myfaces.trinidad.Button");
122   }
123 
124   /**
125    * Gets the textual label of the go component.   Go components will
126    *              also render children elements (including text nodes), though not
127    *              all subclasses of the go component will necessarily support
128    *              children.
129    *
130    * @return  the new text value
131    */
132   final public String getText()
133   {
134     return ComponentUtils.resolveString(getProperty(TEXT_KEY));
135   }
136 
137   /**
138    * Sets the textual label of the go component.   Go components will
139    *              also render children elements (including text nodes), though not
140    *              all subclasses of the go component will necessarily support
141    *              children.
142    * 
143    * @param text  the new text value
144    */
145   final public void setText(String text)
146   {
147     setProperty(TEXT_KEY, (text));
148   }
149 
150   /**
151    * Gets whether the go component should be considered disabled.
152    *               This attribute only has meaning when go components are used in certain
153    *               container types, such as global headers and tab bars.
154    *
155    * @return  the new disabled value
156    */
157   final public boolean isDisabled()
158   {
159     return ComponentUtils.resolveBoolean(getProperty(DISABLED_KEY), false);
160   }
161 
162   /**
163    * Sets whether the go component should be considered disabled.
164    *               This attribute only has meaning when go components are used in certain
165    *               container types, such as global headers and tab bars.
166    * 
167    * @param disabled  the new disabled value
168    */
169   final public void setDisabled(boolean disabled)
170   {
171     setProperty(DISABLED_KEY, disabled ? Boolean.TRUE : Boolean.FALSE);
172   }
173 
174   /**
175    * Gets <html>
176    *  Character used to gain quick access to this component.
177    *               For accessibility reasons, this functionality is not supported
178    *               in screen reader mode.
179    *               <p>
180    *               If the same access key appears in multiple input fields in the
181    *               same page of output, the rendering user agent will cycle among
182    *               the elements accessed by the similar keys. Note that user agents
183    *               are inconsistent about dealing with two links having same access
184    *               key, and so the cycling behavior is dependent on what the user agent
185    *               provides.
186    *               </p><p>
187    *                 This attribute is sometimes referred to as the "mnemonic".
188    *               </p><p>
189    *                 The character specified by this attribute
190    *                 <strong>must</strong> exist in the
191    *                 <code>Text</code> attribute of this go component instance.
192    *                 If it does not, the user will receive no visual indication of
193    *                 the existence of the accessKey.
194    *                 </p></html>
195    *
196    * @return  the new accessKey value
197    */
198   final public char getAccessKey()
199   {
200     return ComponentUtils.resolveCharacter((Character)getProperty(ACCESS_KEY_KEY));
201   }
202 
203   /**
204    * Sets <html>
205    *  Character used to gain quick access to this component.
206    *               For accessibility reasons, this functionality is not supported
207    *               in screen reader mode.
208    *               <p>
209    *               If the same access key appears in multiple input fields in the
210    *               same page of output, the rendering user agent will cycle among
211    *               the elements accessed by the similar keys. Note that user agents
212    *               are inconsistent about dealing with two links having same access
213    *               key, and so the cycling behavior is dependent on what the user agent
214    *               provides.
215    *               </p><p>
216    *                 This attribute is sometimes referred to as the "mnemonic".
217    *               </p><p>
218    *                 The character specified by this attribute
219    *                 <strong>must</strong> exist in the
220    *                 <code>Text</code> attribute of this go component instance.
221    *                 If it does not, the user will receive no visual indication of
222    *                 the existence of the accessKey.
223    *                 </p></html>
224    * 
225    * @param accessKey  the new accessKey value
226    */
227   final public void setAccessKey(char accessKey)
228   {
229     setProperty(ACCESS_KEY_KEY, Character.valueOf(accessKey));
230   }
231 
232   /**
233    * Gets the target frame for the go component.
234    *
235    * @return  the new targetFrame value
236    */
237   final public String getTargetFrame()
238   {
239     return ComponentUtils.resolveString(getProperty(TARGET_FRAME_KEY));
240   }
241 
242   /**
243    * Sets the target frame for the go component.
244    * 
245    * @param targetFrame  the new targetFrame value
246    */
247   final public void setTargetFrame(String targetFrame)
248   {
249     setProperty(TARGET_FRAME_KEY, (targetFrame));
250   }
251 
252   /**
253    * Gets An URL to an image to use for an icon displayed in the button.
254    *
255    * @return  the new icon value
256    */
257   final public String getIcon()
258   {
259     return ComponentUtils.resolveString(getProperty(ICON_KEY));
260   }
261 
262   /**
263    * Sets An URL to an image to use for an icon displayed in the button.
264    * 
265    * @param icon  the new icon value
266    */
267   final public void setIcon(String icon)
268   {
269     setProperty(ICON_KEY, (icon));
270   }
271 
272   /**
273    * Gets the CSS styles to use for this component.
274    *
275    * @return  the new inlineStyle value
276    */
277   final public String getInlineStyle()
278   {
279     return ComponentUtils.resolveString(getProperty(INLINE_STYLE_KEY));
280   }
281 
282   /**
283    * Sets the CSS styles to use for this component.
284    * 
285    * @param inlineStyle  the new inlineStyle value
286    */
287   final public void setInlineStyle(String inlineStyle)
288   {
289     setProperty(INLINE_STYLE_KEY, (inlineStyle));
290   }
291 
292   /**
293    * Gets a CSS style class to use for this component.
294    *
295    * @return  the new styleClass value
296    */
297   final public String getStyleClass()
298   {
299     return ComponentUtils.resolveString(getProperty(STYLE_CLASS_KEY));
300   }
301 
302   /**
303    * Sets a CSS style class to use for this component.
304    * 
305    * @param styleClass  the new styleClass value
306    */
307   final public void setStyleClass(String styleClass)
308   {
309     setProperty(STYLE_CLASS_KEY, (styleClass));
310   }
311 
312   /**
313    * Gets The short description of the component. This text is commonly used by user agents to display tooltip help text.
314    *
315    * @return  the new shortDesc value
316    */
317   final public String getShortDesc()
318   {
319     return ComponentUtils.resolveString(getProperty(SHORT_DESC_KEY));
320   }
321 
322   /**
323    * Sets The short description of the component. This text is commonly used by user agents to display tooltip help text.
324    * 
325    * @param shortDesc  the new shortDesc value
326    */
327   final public void setShortDesc(String shortDesc)
328   {
329     setProperty(SHORT_DESC_KEY, (shortDesc));
330   }
331 
332   /**
333    * Gets the IDs of the components that should trigger a partial update.
334    *         <p>
335    *         This component will listen on the trigger components. If one of the
336    *         trigger components receives an event that will cause it to update
337    *         in some way, this component will request to be updated too.</p>
338    *         <p>
339    *         Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"
340    *         </p>
341    *         <p>
342    *         Identifiers must account for NamingContainers.  You can use a single colon to start the search from the root,
343    *         or use multiple colons to move up through the NamingContainer. For example,
344    *         "::" will pop out of this component's naming container (it pops out of itself if it is a naming container), 
345    *         ":::" will pop out of two naming containers, etc. The search for
346    *         the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the 
347    *         component with id = commandButton1 after popping out of two naming containers relative to this component.
348    *         To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".</p>
349    *
350    * @return  the new partialTriggers value
351    */
352   final public String[] getPartialTriggers()
353   {
354     return (String[])getProperty(PARTIAL_TRIGGERS_KEY);
355   }
356 
357   /**
358    * Sets the IDs of the components that should trigger a partial update.
359    *         <p>
360    *         This component will listen on the trigger components. If one of the
361    *         trigger components receives an event that will cause it to update
362    *         in some way, this component will request to be updated too.</p>
363    *         <p>
364    *         Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"
365    *         </p>
366    *         <p>
367    *         Identifiers must account for NamingContainers.  You can use a single colon to start the search from the root,
368    *         or use multiple colons to move up through the NamingContainer. For example,
369    *         "::" will pop out of this component's naming container (it pops out of itself if it is a naming container), 
370    *         ":::" will pop out of two naming containers, etc. The search for
371    *         the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the 
372    *         component with id = commandButton1 after popping out of two naming containers relative to this component.
373    *         To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".</p>
374    * 
375    * @param partialTriggers  the new partialTriggers value
376    */
377   final public void setPartialTriggers(String[] partialTriggers)
378   {
379     setProperty(PARTIAL_TRIGGERS_KEY, (partialTriggers));
380   }
381 
382   /**
383    * Gets an onclick Javascript handler.
384    *
385    * @return  the new onclick value
386    */
387   final public String getOnclick()
388   {
389     return ComponentUtils.resolveString(getProperty(ONCLICK_KEY));
390   }
391 
392   /**
393    * Sets an onclick Javascript handler.
394    * 
395    * @param onclick  the new onclick value
396    */
397   final public void setOnclick(String onclick)
398   {
399     setProperty(ONCLICK_KEY, (onclick));
400   }
401 
402   /**
403    * Gets an ondblclick Javascript handler.
404    *
405    * @return  the new ondblclick value
406    */
407   final public String getOndblclick()
408   {
409     return ComponentUtils.resolveString(getProperty(ONDBLCLICK_KEY));
410   }
411 
412   /**
413    * Sets an ondblclick Javascript handler.
414    * 
415    * @param ondblclick  the new ondblclick value
416    */
417   final public void setOndblclick(String ondblclick)
418   {
419     setProperty(ONDBLCLICK_KEY, (ondblclick));
420   }
421 
422   /**
423    * Gets an onmousedown Javascript handler.
424    *
425    * @return  the new onmousedown value
426    */
427   final public String getOnmousedown()
428   {
429     return ComponentUtils.resolveString(getProperty(ONMOUSEDOWN_KEY));
430   }
431 
432   /**
433    * Sets an onmousedown Javascript handler.
434    * 
435    * @param onmousedown  the new onmousedown value
436    */
437   final public void setOnmousedown(String onmousedown)
438   {
439     setProperty(ONMOUSEDOWN_KEY, (onmousedown));
440   }
441 
442   /**
443    * Gets an onmouseup Javascript handler.
444    *
445    * @return  the new onmouseup value
446    */
447   final public String getOnmouseup()
448   {
449     return ComponentUtils.resolveString(getProperty(ONMOUSEUP_KEY));
450   }
451 
452   /**
453    * Sets an onmouseup Javascript handler.
454    * 
455    * @param onmouseup  the new onmouseup value
456    */
457   final public void setOnmouseup(String onmouseup)
458   {
459     setProperty(ONMOUSEUP_KEY, (onmouseup));
460   }
461 
462   /**
463    * Gets an onmouseover Javascript handler.
464    *
465    * @return  the new onmouseover value
466    */
467   final public String getOnmouseover()
468   {
469     return ComponentUtils.resolveString(getProperty(ONMOUSEOVER_KEY));
470   }
471 
472   /**
473    * Sets an onmouseover Javascript handler.
474    * 
475    * @param onmouseover  the new onmouseover value
476    */
477   final public void setOnmouseover(String onmouseover)
478   {
479     setProperty(ONMOUSEOVER_KEY, (onmouseover));
480   }
481 
482   /**
483    * Gets an onmousemove Javascript handler.
484    *
485    * @return  the new onmousemove value
486    */
487   final public String getOnmousemove()
488   {
489     return ComponentUtils.resolveString(getProperty(ONMOUSEMOVE_KEY));
490   }
491 
492   /**
493    * Sets an onmousemove Javascript handler.
494    * 
495    * @param onmousemove  the new onmousemove value
496    */
497   final public void setOnmousemove(String onmousemove)
498   {
499     setProperty(ONMOUSEMOVE_KEY, (onmousemove));
500   }
501 
502   /**
503    * Gets an onmouseout Javascript handler.
504    *
505    * @return  the new onmouseout value
506    */
507   final public String getOnmouseout()
508   {
509     return ComponentUtils.resolveString(getProperty(ONMOUSEOUT_KEY));
510   }
511 
512   /**
513    * Sets an onmouseout Javascript handler.
514    * 
515    * @param onmouseout  the new onmouseout value
516    */
517   final public void setOnmouseout(String onmouseout)
518   {
519     setProperty(ONMOUSEOUT_KEY, (onmouseout));
520   }
521 
522   /**
523    * Gets an onkeypress Javascript handler.
524    *
525    * @return  the new onkeypress value
526    */
527   final public String getOnkeypress()
528   {
529     return ComponentUtils.resolveString(getProperty(ONKEYPRESS_KEY));
530   }
531 
532   /**
533    * Sets an onkeypress Javascript handler.
534    * 
535    * @param onkeypress  the new onkeypress value
536    */
537   final public void setOnkeypress(String onkeypress)
538   {
539     setProperty(ONKEYPRESS_KEY, (onkeypress));
540   }
541 
542   /**
543    * Gets an onkeydown Javascript handler.
544    *
545    * @return  the new onkeydown value
546    */
547   final public String getOnkeydown()
548   {
549     return ComponentUtils.resolveString(getProperty(ONKEYDOWN_KEY));
550   }
551 
552   /**
553    * Sets an onkeydown Javascript handler.
554    * 
555    * @param onkeydown  the new onkeydown value
556    */
557   final public void setOnkeydown(String onkeydown)
558   {
559     setProperty(ONKEYDOWN_KEY, (onkeydown));
560   }
561 
562   /**
563    * Gets an onkeyup Javascript handler.
564    *
565    * @return  the new onkeyup value
566    */
567   final public String getOnkeyup()
568   {
569     return ComponentUtils.resolveString(getProperty(ONKEYUP_KEY));
570   }
571 
572   /**
573    * Sets an onkeyup Javascript handler.
574    * 
575    * @param onkeyup  the new onkeyup value
576    */
577   final public void setOnkeyup(String onkeyup)
578   {
579     setProperty(ONKEYUP_KEY, (onkeyup));
580   }
581 
582   /**
583    * Gets the event handler for the component losing the focus.
584    *
585    * @return  the new onblur value
586    */
587   final public String getOnblur()
588   {
589     return ComponentUtils.resolveString(getProperty(ONBLUR_KEY));
590   }
591 
592   /**
593    * Sets the event handler for the component losing the focus.
594    * 
595    * @param onblur  the new onblur value
596    */
597   final public void setOnblur(String onblur)
598   {
599     setProperty(ONBLUR_KEY, (onblur));
600   }
601 
602   /**
603    * Gets the event handler for the component gaining the focus.
604    *
605    * @return  the new onfocus value
606    */
607   final public String getOnfocus()
608   {
609     return ComponentUtils.resolveString(getProperty(ONFOCUS_KEY));
610   }
611 
612   /**
613    * Sets the event handler for the component gaining the focus.
614    * 
615    * @param onfocus  the new onfocus value
616    */
617   final public void setOnfocus(String onfocus)
618   {
619     setProperty(ONFOCUS_KEY, (onfocus));
620   }
621 
622   @Override
623   public String getDefaultEventName()
624   {
625     return "click";
626   }
627 
628   @Override
629   public Collection<String> getEventNames()
630   {
631     return _EVENT_NAMES;
632   }
633 
634   @Override
635   public Map<String, List<ClientBehavior>> getClientBehaviors()
636   {
637     return super.getClientBehaviors();
638   }
639 
640   @Override
641   public void addClientBehavior(
642     String         eventName,
643     ClientBehavior behavior)
644   {
645     super.addClientBehavior(eventName, behavior);
646   }
647 
648   @Override
649   public String getFamily()
650   {
651     return COMPONENT_FAMILY;
652   }
653 
654   @Override
655   protected FacesBean.Type getBeanType()
656   {
657     return TYPE;
658   }
659 
660   /**
661    * Construct an instance of the CoreGoButton.
662    */
663   protected CoreGoButton(
664     String rendererType
665     )
666   {
667     super(rendererType);
668   }
669 
670   static
671   {
672     TYPE.lockAndRegister("org.apache.myfaces.trinidad.Go","org.apache.myfaces.trinidad.Button");
673   }
674 }