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