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