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;
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.UIXDocument;
35  import org.apache.myfaces.trinidad.util.ComponentUtils;
36  
37  /**
38   *
39   * The CoreDocument creates each of the standard root elements of an HTML page:  <html>, <body>, and <head>, but by abstracting away from those components, can be used in non-HTML pages as well.
40   *
41   * <h4>Events:</h4>
42   * <table border="1" width="100%" cellpadding="3" summary="">
43   * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
44   * <th align="left">Type</th>
45   * <th align="left">Phases</th>
46   * <th align="left">Description</th>
47   * </tr>
48   * <tr class="TableRowColor">
49   * <td valign="top"><code>org.apache.myfaces.trinidad.event.AttributeChangeEvent</code></td>
50   * <td valign="top" nowrap>Invoke<br>Application<br>Apply<br>Request<br>Values</td>
51   * <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>
52   * </tr>
53   * </table>
54   */
55  public class CoreDocument extends UIXDocument
56                            implements ClientBehaviorHolder
57  {
58    static public final String STATE_SAVING_DEFAULT = "default";
59    static public final String STATE_SAVING_CLIENT = "client";
60    static public final String STATE_SAVING_SERVER = "server";
61    static public final String MODE_DEFAULT = "default";
62    static public final String MODE_STRICT = "strict";
63    static public final String MODE_QUIRKS = "quirks";
64    static public final FacesBean.Type TYPE = new FacesBean.Type(
65      UIXDocument.TYPE);
66    static public final PropertyKey TITLE_KEY =
67      TYPE.registerKey("title", String.class);
68    static public final PropertyKey STATE_SAVING_KEY =
69      TYPE.registerKey("stateSaving", String.class, "default");
70    static public final PropertyKey MODE_KEY =
71      TYPE.registerKey("mode", String.class, "default");
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 ONLOAD_KEY =
101     TYPE.registerKey("onload", String.class);
102   static public final PropertyKey ONUNLOAD_KEY =
103     TYPE.registerKey("onunload", String.class);
104   static public final PropertyKey INITIAL_FOCUS_ID_KEY =
105     TYPE.registerKey("initialFocusId", String.class);
106   static public final String META_CONTAINER_FACET = "metaContainer";
107 
108   static public final String COMPONENT_FAMILY =
109     "org.apache.myfaces.trinidad.Document";
110   static public final String COMPONENT_TYPE =
111     "org.apache.myfaces.trinidad.CoreDocument";
112   // Supported client events for client behaviors:
113   private final static Collection<String> _EVENT_NAMES = Collections.unmodifiableCollection(
114     Arrays.asList(
115       "click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove",
116       "mouseout", "keypress", "keydown", "keyup", "load", "unload"
117     ));
118 
119   /**
120    * Construct an instance of the CoreDocument.
121    */
122   public CoreDocument()
123   {
124     super("org.apache.myfaces.trinidad.Document");
125   }
126 
127   /**
128    * Content to be rendered as meta data inside the "head" section.
129    */
130   final public UIComponent getMetaContainer()
131   {
132     return getFacet(META_CONTAINER_FACET);
133   }
134 
135   /**
136    * Content to be rendered as meta data inside the "head" section.
137    */
138   @SuppressWarnings("unchecked")
139   final public void setMetaContainer(UIComponent metaContainerFacet)
140   {
141     getFacets().put(META_CONTAINER_FACET, metaContainerFacet);
142   }
143 
144   /**
145    * Gets The title of the document.  (This title doesn't have to match the
146    *             title on any contained panelPage.)
147    *
148    * @return  the new title value
149    */
150   final public String getTitle()
151   {
152     return ComponentUtils.resolveString(getProperty(TITLE_KEY));
153   }
154 
155   /**
156    * Sets The title of the document.  (This title doesn't have to match the
157    *             title on any contained panelPage.)
158    * 
159    * @param title  the new title value
160    */
161   final public void setTitle(String title)
162   {
163     setProperty(TITLE_KEY, (title));
164   }
165 
166   /**
167    * Gets Specify the state saving behavior for this page. client=force to be (full) client;
168    *              server=force to be server-side; default=follows the settings of the web.xml
169    *
170    * @return  the new stateSaving value
171    */
172   final public String getStateSaving()
173   {
174     return ComponentUtils.resolveString(getProperty(STATE_SAVING_KEY), "default");
175   }
176 
177   /**
178    * Sets Specify the state saving behavior for this page. client=force to be (full) client;
179    *              server=force to be server-side; default=follows the settings of the web.xml
180    * 
181    * @param stateSaving  the new stateSaving value
182    */
183   final public void setStateSaving(String stateSaving)
184   {
185     setProperty(STATE_SAVING_KEY, (stateSaving));
186   }
187 
188   /**
189    * Gets Set if the page should render in default standards mode, quirks mode, or strict mode.  Behavior of the modes are:<ul>
190    * <li>"default": renders as transitional doctypes for both XHTML and HTML,
191    * with <a href="http://developer.mozilla.org/en/docs/Gecko's_%22Almost_Standards%22_Mode">"almost standards"</a> rendering mode</li>
192    * <li>"strict": renders as a strict doctype for both XHTML and HTML, also
193    * in standards rendering mode</li>
194    * <li>"quirks": renders HTML pages in quirks mode, and XHTML with
195    * a transitional doctype, but standards mode  (there is no quirks mode for
196    * XHTML).</li></ul>
197    *
198    * @return  the new mode value
199    */
200   final public String getMode()
201   {
202     return ComponentUtils.resolveString(getProperty(MODE_KEY), "default");
203   }
204 
205   /**
206    * Sets Set if the page should render in default standards mode, quirks mode, or strict mode.  Behavior of the modes are:<ul>
207    * <li>"default": renders as transitional doctypes for both XHTML and HTML,
208    * with <a href="http://developer.mozilla.org/en/docs/Gecko's_%22Almost_Standards%22_Mode">"almost standards"</a> rendering mode</li>
209    * <li>"strict": renders as a strict doctype for both XHTML and HTML, also
210    * in standards rendering mode</li>
211    * <li>"quirks": renders HTML pages in quirks mode, and XHTML with
212    * a transitional doctype, but standards mode  (there is no quirks mode for
213    * XHTML).</li></ul>
214    * 
215    * @param mode  the new mode value
216    */
217   final public void setMode(String mode)
218   {
219     setProperty(MODE_KEY, (mode));
220   }
221 
222   /**
223    * Gets the CSS styles to use for this component.
224    *
225    * @return  the new inlineStyle value
226    */
227   final public String getInlineStyle()
228   {
229     return ComponentUtils.resolveString(getProperty(INLINE_STYLE_KEY));
230   }
231 
232   /**
233    * Sets the CSS styles to use for this component.
234    * 
235    * @param inlineStyle  the new inlineStyle value
236    */
237   final public void setInlineStyle(String inlineStyle)
238   {
239     setProperty(INLINE_STYLE_KEY, (inlineStyle));
240   }
241 
242   /**
243    * Gets a CSS style class to use for this component.
244    *
245    * @return  the new styleClass value
246    */
247   final public String getStyleClass()
248   {
249     return ComponentUtils.resolveString(getProperty(STYLE_CLASS_KEY));
250   }
251 
252   /**
253    * Sets a CSS style class to use for this component.
254    * 
255    * @param styleClass  the new styleClass value
256    */
257   final public void setStyleClass(String styleClass)
258   {
259     setProperty(STYLE_CLASS_KEY, (styleClass));
260   }
261 
262   /**
263    * Gets The short description of the component. This text is commonly used by user agents to display tooltip help text.
264    *
265    * @return  the new shortDesc value
266    */
267   final public String getShortDesc()
268   {
269     return ComponentUtils.resolveString(getProperty(SHORT_DESC_KEY));
270   }
271 
272   /**
273    * Sets The short description of the component. This text is commonly used by user agents to display tooltip help text.
274    * 
275    * @param shortDesc  the new shortDesc value
276    */
277   final public void setShortDesc(String shortDesc)
278   {
279     setProperty(SHORT_DESC_KEY, (shortDesc));
280   }
281 
282   /**
283    * Gets the IDs of the components that should trigger a partial update.
284    *         <p>
285    *         This component will listen on the trigger components. If one of the
286    *         trigger components receives an event that will cause it to update
287    *         in some way, this component will request to be updated too.</p>
288    *         <p>
289    *         Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"
290    *         </p>
291    *         <p>
292    *         Identifiers must account for NamingContainers.  You can use a single colon to start the search from the root,
293    *         or use multiple colons to move up through the NamingContainer. For example,
294    *         "::" will pop out of this component's naming container (it pops out of itself if it is a naming container), 
295    *         ":::" will pop out of two naming containers, etc. The search for
296    *         the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the 
297    *         component with id = commandButton1 after popping out of two naming containers relative to this component.
298    *         To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".</p>
299    *
300    * @return  the new partialTriggers value
301    */
302   final public String[] getPartialTriggers()
303   {
304     return (String[])getProperty(PARTIAL_TRIGGERS_KEY);
305   }
306 
307   /**
308    * Sets the IDs of the components that should trigger a partial update.
309    *         <p>
310    *         This component will listen on the trigger components. If one of the
311    *         trigger components receives an event that will cause it to update
312    *         in some way, this component will request to be updated too.</p>
313    *         <p>
314    *         Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"
315    *         </p>
316    *         <p>
317    *         Identifiers must account for NamingContainers.  You can use a single colon to start the search from the root,
318    *         or use multiple colons to move up through the NamingContainer. For example,
319    *         "::" will pop out of this component's naming container (it pops out of itself if it is a naming container), 
320    *         ":::" will pop out of two naming containers, etc. The search for
321    *         the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the 
322    *         component with id = commandButton1 after popping out of two naming containers relative to this component.
323    *         To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".</p>
324    * 
325    * @param partialTriggers  the new partialTriggers value
326    */
327   final public void setPartialTriggers(String[] partialTriggers)
328   {
329     setProperty(PARTIAL_TRIGGERS_KEY, (partialTriggers));
330   }
331 
332   /**
333    * Gets an onclick Javascript handler.
334    *
335    * @return  the new onclick value
336    */
337   final public String getOnclick()
338   {
339     return ComponentUtils.resolveString(getProperty(ONCLICK_KEY));
340   }
341 
342   /**
343    * Sets an onclick Javascript handler.
344    * 
345    * @param onclick  the new onclick value
346    */
347   final public void setOnclick(String onclick)
348   {
349     setProperty(ONCLICK_KEY, (onclick));
350   }
351 
352   /**
353    * Gets an ondblclick Javascript handler.
354    *
355    * @return  the new ondblclick value
356    */
357   final public String getOndblclick()
358   {
359     return ComponentUtils.resolveString(getProperty(ONDBLCLICK_KEY));
360   }
361 
362   /**
363    * Sets an ondblclick Javascript handler.
364    * 
365    * @param ondblclick  the new ondblclick value
366    */
367   final public void setOndblclick(String ondblclick)
368   {
369     setProperty(ONDBLCLICK_KEY, (ondblclick));
370   }
371 
372   /**
373    * Gets an onmousedown Javascript handler.
374    *
375    * @return  the new onmousedown value
376    */
377   final public String getOnmousedown()
378   {
379     return ComponentUtils.resolveString(getProperty(ONMOUSEDOWN_KEY));
380   }
381 
382   /**
383    * Sets an onmousedown Javascript handler.
384    * 
385    * @param onmousedown  the new onmousedown value
386    */
387   final public void setOnmousedown(String onmousedown)
388   {
389     setProperty(ONMOUSEDOWN_KEY, (onmousedown));
390   }
391 
392   /**
393    * Gets an onmouseup Javascript handler.
394    *
395    * @return  the new onmouseup value
396    */
397   final public String getOnmouseup()
398   {
399     return ComponentUtils.resolveString(getProperty(ONMOUSEUP_KEY));
400   }
401 
402   /**
403    * Sets an onmouseup Javascript handler.
404    * 
405    * @param onmouseup  the new onmouseup value
406    */
407   final public void setOnmouseup(String onmouseup)
408   {
409     setProperty(ONMOUSEUP_KEY, (onmouseup));
410   }
411 
412   /**
413    * Gets an onmouseover Javascript handler.
414    *
415    * @return  the new onmouseover value
416    */
417   final public String getOnmouseover()
418   {
419     return ComponentUtils.resolveString(getProperty(ONMOUSEOVER_KEY));
420   }
421 
422   /**
423    * Sets an onmouseover Javascript handler.
424    * 
425    * @param onmouseover  the new onmouseover value
426    */
427   final public void setOnmouseover(String onmouseover)
428   {
429     setProperty(ONMOUSEOVER_KEY, (onmouseover));
430   }
431 
432   /**
433    * Gets an onmousemove Javascript handler.
434    *
435    * @return  the new onmousemove value
436    */
437   final public String getOnmousemove()
438   {
439     return ComponentUtils.resolveString(getProperty(ONMOUSEMOVE_KEY));
440   }
441 
442   /**
443    * Sets an onmousemove Javascript handler.
444    * 
445    * @param onmousemove  the new onmousemove value
446    */
447   final public void setOnmousemove(String onmousemove)
448   {
449     setProperty(ONMOUSEMOVE_KEY, (onmousemove));
450   }
451 
452   /**
453    * Gets an onmouseout Javascript handler.
454    *
455    * @return  the new onmouseout value
456    */
457   final public String getOnmouseout()
458   {
459     return ComponentUtils.resolveString(getProperty(ONMOUSEOUT_KEY));
460   }
461 
462   /**
463    * Sets an onmouseout Javascript handler.
464    * 
465    * @param onmouseout  the new onmouseout value
466    */
467   final public void setOnmouseout(String onmouseout)
468   {
469     setProperty(ONMOUSEOUT_KEY, (onmouseout));
470   }
471 
472   /**
473    * Gets an onkeypress Javascript handler.
474    *
475    * @return  the new onkeypress value
476    */
477   final public String getOnkeypress()
478   {
479     return ComponentUtils.resolveString(getProperty(ONKEYPRESS_KEY));
480   }
481 
482   /**
483    * Sets an onkeypress Javascript handler.
484    * 
485    * @param onkeypress  the new onkeypress value
486    */
487   final public void setOnkeypress(String onkeypress)
488   {
489     setProperty(ONKEYPRESS_KEY, (onkeypress));
490   }
491 
492   /**
493    * Gets an onkeydown Javascript handler.
494    *
495    * @return  the new onkeydown value
496    */
497   final public String getOnkeydown()
498   {
499     return ComponentUtils.resolveString(getProperty(ONKEYDOWN_KEY));
500   }
501 
502   /**
503    * Sets an onkeydown Javascript handler.
504    * 
505    * @param onkeydown  the new onkeydown value
506    */
507   final public void setOnkeydown(String onkeydown)
508   {
509     setProperty(ONKEYDOWN_KEY, (onkeydown));
510   }
511 
512   /**
513    * Gets an onkeyup Javascript handler.
514    *
515    * @return  the new onkeyup value
516    */
517   final public String getOnkeyup()
518   {
519     return ComponentUtils.resolveString(getProperty(ONKEYUP_KEY));
520   }
521 
522   /**
523    * Sets an onkeyup Javascript handler.
524    * 
525    * @param onkeyup  the new onkeyup value
526    */
527   final public void setOnkeyup(String onkeyup)
528   {
529     setProperty(ONKEYUP_KEY, (onkeyup));
530   }
531 
532   /**
533    * Gets an onload Javascript handler.
534    *
535    * @return  the new onload value
536    */
537   final public String getOnload()
538   {
539     return ComponentUtils.resolveString(getProperty(ONLOAD_KEY));
540   }
541 
542   /**
543    * Sets an onload Javascript handler.
544    * 
545    * @param onload  the new onload value
546    */
547   final public void setOnload(String onload)
548   {
549     setProperty(ONLOAD_KEY, (onload));
550   }
551 
552   /**
553    * Gets an onunload Javascript handler.
554    *
555    * @return  the new onunload value
556    */
557   final public String getOnunload()
558   {
559     return ComponentUtils.resolveString(getProperty(ONUNLOAD_KEY));
560   }
561 
562   /**
563    * Sets an onunload Javascript handler.
564    * 
565    * @param onunload  the new onunload value
566    */
567   final public void setOnunload(String onunload)
568   {
569     setProperty(ONUNLOAD_KEY, (onunload));
570   }
571 
572   /**
573    * Gets the id of the component to which you want the
574    *         focus to be when the full page renders. The accessibility-mode
575    *         must be set to "inaccessible" for this feature to be on.
576    *
577    * @return  the new initialFocusId value
578    */
579   final public String getInitialFocusId()
580   {
581     return ComponentUtils.resolveString(getProperty(INITIAL_FOCUS_ID_KEY));
582   }
583 
584   /**
585    * Sets the id of the component to which you want the
586    *         focus to be when the full page renders. The accessibility-mode
587    *         must be set to "inaccessible" for this feature to be on.
588    * 
589    * @param initialFocusId  the new initialFocusId value
590    */
591   final public void setInitialFocusId(String initialFocusId)
592   {
593     setProperty(INITIAL_FOCUS_ID_KEY, (initialFocusId));
594   }
595 
596   @Override
597   public String getDefaultEventName()
598   {
599     return "load";
600   }
601 
602   @Override
603   public Collection<String> getEventNames()
604   {
605     return _EVENT_NAMES;
606   }
607 
608   @Override
609   public Map<String, List<ClientBehavior>> getClientBehaviors()
610   {
611     return super.getClientBehaviors();
612   }
613 
614   @Override
615   public void addClientBehavior(
616     String         eventName,
617     ClientBehavior behavior)
618   {
619     super.addClientBehavior(eventName, behavior);
620   }
621 
622   @Override
623   public String getFamily()
624   {
625     return COMPONENT_FAMILY;
626   }
627 
628   @Override
629   protected FacesBean.Type getBeanType()
630   {
631     return TYPE;
632   }
633 
634   /**
635    * Construct an instance of the CoreDocument.
636    */
637   protected CoreDocument(
638     String rendererType
639     )
640   {
641     super(rendererType);
642   }
643 
644   static
645   {
646     TYPE.lockAndRegister("org.apache.myfaces.trinidad.Document","org.apache.myfaces.trinidad.Document");
647   }
648 }