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