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