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.html;
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.UIXComponentBase;
34  import org.apache.myfaces.trinidad.util.ComponentUtils;
35  
36  /**
37   *
38   * A TableLayout is a thin wrapper around the HTML <table>
39   *           element.  It contains a series of row layout elements.
40   *          <section name="Table Layout">
41   *           By default, HTML tables treat cell widths more like suggestions rather than requirements;
42   *           cell content sizes contribute more in determining the size of each column.
43   *           If you care more for the specified cellFormat widths than content sizes (particularly if your
44   *           cellFormat widths are percentage-based and your cells have contents that are
45   *           programmatically-resizable based on the cell width), then you will need to use
46   *           inlineStyle="table-layout:fixed" to declare that you want your cell widths to be explicitly honored.
47   *           Refer to the CSS specification for further details on this style property.
48   *           </section>
49   *
50   * <h4>Events:</h4>
51   * <table border="1" width="100%" cellpadding="3" summary="">
52   * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
53   * <th align="left">Type</th>
54   * <th align="left">Phases</th>
55   * <th align="left">Description</th>
56   * </tr>
57   * <tr class="TableRowColor">
58   * <td valign="top"><code>org.apache.myfaces.trinidad.event.AttributeChangeEvent</code></td>
59   * <td valign="top" nowrap>Invoke<br>Application<br>Apply<br>Request<br>Values</td>
60   * <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>
61   * </tr>
62   * </table>
63   */
64  public class HtmlTableLayout extends UIXComponentBase
65                               implements ClientBehaviorHolder
66  {
67    static public final String HALIGN_RIGHT = "right";
68    static public final String HALIGN_START = "start";
69    static public final String HALIGN_LEFT = "left";
70    static public final String HALIGN_END = "end";
71    static public final String HALIGN_CENTER = "center";
72    static public final FacesBean.Type TYPE = new FacesBean.Type(
73      UIXComponentBase.TYPE);
74    static public final PropertyKey WIDTH_KEY =
75      TYPE.registerKey("width", String.class);
76    static public final PropertyKey HALIGN_KEY =
77      TYPE.registerKey("halign", String.class);
78    static public final PropertyKey CELL_SPACING_KEY =
79      TYPE.registerKey("cellSpacing", Integer.class);
80    static public final PropertyKey CELL_PADDING_KEY =
81      TYPE.registerKey("cellPadding", Integer.class);
82    static public final PropertyKey BORDER_WIDTH_KEY =
83      TYPE.registerKey("borderWidth", Integer.class);
84    static public final PropertyKey SUMMARY_KEY =
85      TYPE.registerKey("summary", String.class);
86    static public final PropertyKey SHORT_DESC_KEY =
87      TYPE.registerKey("shortDesc", String.class);
88    static public final PropertyKey PARTIAL_TRIGGERS_KEY =
89      TYPE.registerKey("partialTriggers", String[].class);
90    static public final PropertyKey ONCLICK_KEY =
91      TYPE.registerKey("onclick", String.class);
92    static public final PropertyKey ONDBLCLICK_KEY =
93      TYPE.registerKey("ondblclick", String.class);
94    static public final PropertyKey ONMOUSEDOWN_KEY =
95      TYPE.registerKey("onmousedown", String.class);
96    static public final PropertyKey ONMOUSEUP_KEY =
97      TYPE.registerKey("onmouseup", String.class);
98    static public final PropertyKey ONMOUSEOVER_KEY =
99      TYPE.registerKey("onmouseover", String.class);
100   static public final PropertyKey ONMOUSEMOVE_KEY =
101     TYPE.registerKey("onmousemove", String.class);
102   static public final PropertyKey ONMOUSEOUT_KEY =
103     TYPE.registerKey("onmouseout", String.class);
104   static public final PropertyKey ONKEYPRESS_KEY =
105     TYPE.registerKey("onkeypress", String.class);
106   static public final PropertyKey ONKEYDOWN_KEY =
107     TYPE.registerKey("onkeydown", String.class);
108   static public final PropertyKey ONKEYUP_KEY =
109     TYPE.registerKey("onkeyup", String.class);
110   static public final PropertyKey STYLE_CLASS_KEY =
111     TYPE.registerKey("styleClass", String.class);
112   static public final PropertyKey INLINE_STYLE_KEY =
113     TYPE.registerKey("inlineStyle", String.class);
114 
115   static public final String COMPONENT_FAMILY =
116     "org.apache.myfaces.trinidad.TableLayout";
117   static public final String COMPONENT_TYPE =
118     "org.apache.myfaces.trinidad.HtmlTableLayout";
119   // Supported client events for client behaviors:
120   private final static Collection<String> _EVENT_NAMES = Collections.unmodifiableCollection(
121     Arrays.asList(
122       "click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove",
123       "mouseout", "keypress", "keydown", "keyup"
124     ));
125 
126   /**
127    * Construct an instance of the HtmlTableLayout.
128    */
129   public HtmlTableLayout()
130   {
131     super("org.apache.myfaces.trinidad.TableLayout");
132   }
133 
134   /**
135    * Gets the preferred total width of the layout.
136    *
137    * @return  the new width value
138    */
139   final public String getWidth()
140   {
141     return ComponentUtils.resolveString(getProperty(WIDTH_KEY));
142   }
143 
144   /**
145    * Sets the preferred total width of the layout.
146    * 
147    * @param width  the new width value
148    */
149   final public void setWidth(String width)
150   {
151     setProperty(WIDTH_KEY, (width));
152   }
153 
154   /**
155    * Sets the preferred total width of the layout.
156    * 
157    * @param width  the new width value
158    */
159   final public void setWidth(int width)
160   {
161     setProperty(WIDTH_KEY, Integer.valueOf(width));
162   }
163 
164   /**
165    * Gets the horizontal alignment of the table.
166    *               The acceptable values are "center", "left", "right", "start", and "end".
167    *
168    * @return  the new halign value
169    */
170   final public String getHalign()
171   {
172     return ComponentUtils.resolveString(getProperty(HALIGN_KEY));
173   }
174 
175   /**
176    * Sets the horizontal alignment of the table.
177    *               The acceptable values are "center", "left", "right", "start", and "end".
178    * 
179    * @param halign  the new halign value
180    */
181   final public void setHalign(String halign)
182   {
183     setProperty(HALIGN_KEY, (halign));
184   }
185 
186   /**
187    * Gets the spacing between cells.
188    *
189    * @return  the new cellSpacing value
190    */
191   final public int getCellSpacing()
192   {
193     return ComponentUtils.resolveInteger(getProperty(CELL_SPACING_KEY));
194   }
195 
196   /**
197    * Sets the spacing between cells.
198    * 
199    * @param cellSpacing  the new cellSpacing value
200    */
201   final public void setCellSpacing(int cellSpacing)
202   {
203     setProperty(CELL_SPACING_KEY, Integer.valueOf(cellSpacing));
204   }
205 
206   /**
207    * Gets the spacing within cells.
208    *
209    * @return  the new cellPadding value
210    */
211   final public int getCellPadding()
212   {
213     return ComponentUtils.resolveInteger(getProperty(CELL_PADDING_KEY));
214   }
215 
216   /**
217    * Sets the spacing within cells.
218    * 
219    * @param cellPadding  the new cellPadding value
220    */
221   final public void setCellPadding(int cellPadding)
222   {
223     setProperty(CELL_PADDING_KEY, Integer.valueOf(cellPadding));
224   }
225 
226   /**
227    * Gets the border width around each cell.
228    *
229    * @return  the new borderWidth value
230    */
231   final public int getBorderWidth()
232   {
233     return ComponentUtils.resolveInteger(getProperty(BORDER_WIDTH_KEY));
234   }
235 
236   /**
237    * Sets the border width around each cell.
238    * 
239    * @param borderWidth  the new borderWidth value
240    */
241   final public void setBorderWidth(int borderWidth)
242   {
243     setProperty(BORDER_WIDTH_KEY, Integer.valueOf(borderWidth));
244   }
245 
246   /**
247    * Gets The summary of the table's purpose and structure
248    *              for user agents rendering to non-visual media. This attribute
249    *              must be set if this element is being used to implement a data
250    *              table (instead of a layout table).
251    *
252    * @return  the new summary value
253    */
254   final public String getSummary()
255   {
256     return ComponentUtils.resolveString(getProperty(SUMMARY_KEY));
257   }
258 
259   /**
260    * Sets The summary of the table's purpose and structure
261    *              for user agents rendering to non-visual media. This attribute
262    *              must be set if this element is being used to implement a data
263    *              table (instead of a layout table).
264    * 
265    * @param summary  the new summary value
266    */
267   final public void setSummary(String summary)
268   {
269     setProperty(SUMMARY_KEY, (summary));
270   }
271 
272   /**
273    * Gets the short description of the bean.  This text
274    *          is commonly used by user agents to display tooltip help text.
275    *
276    * @return  the new shortDesc value
277    */
278   final public String getShortDesc()
279   {
280     return ComponentUtils.resolveString(getProperty(SHORT_DESC_KEY));
281   }
282 
283   /**
284    * Sets the short description of the bean.  This text
285    *          is commonly used by user agents to display tooltip help text.
286    * 
287    * @param shortDesc  the new shortDesc value
288    */
289   final public void setShortDesc(String shortDesc)
290   {
291     setProperty(SHORT_DESC_KEY, (shortDesc));
292   }
293 
294   /**
295    * Gets the IDs of the components that should trigger a partial update.
296    *          This component will listen on the trigger components. If one of the
297    *          trigger components receives an event that will cause it to update
298    *          in some way, this component will request to be updated too.
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    *          This component will listen on the trigger components. If one of the
310    *          trigger components receives an event that will cause it to update
311    *          in some way, this component will request to be updated too.
312    * 
313    * @param partialTriggers  the new partialTriggers value
314    */
315   final public void setPartialTriggers(String[] partialTriggers)
316   {
317     setProperty(PARTIAL_TRIGGERS_KEY, (partialTriggers));
318   }
319 
320   /**
321    * Gets an onclick Javascript handler.
322    *
323    * @return  the new onclick value
324    */
325   final public String getOnclick()
326   {
327     return ComponentUtils.resolveString(getProperty(ONCLICK_KEY));
328   }
329 
330   /**
331    * Sets an onclick Javascript handler.
332    * 
333    * @param onclick  the new onclick value
334    */
335   final public void setOnclick(String onclick)
336   {
337     setProperty(ONCLICK_KEY, (onclick));
338   }
339 
340   /**
341    * Gets an ondblclick Javascript handler.
342    *
343    * @return  the new ondblclick value
344    */
345   final public String getOndblclick()
346   {
347     return ComponentUtils.resolveString(getProperty(ONDBLCLICK_KEY));
348   }
349 
350   /**
351    * Sets an ondblclick Javascript handler.
352    * 
353    * @param ondblclick  the new ondblclick value
354    */
355   final public void setOndblclick(String ondblclick)
356   {
357     setProperty(ONDBLCLICK_KEY, (ondblclick));
358   }
359 
360   /**
361    * Gets an onmousedown Javascript handler.
362    *
363    * @return  the new onmousedown value
364    */
365   final public String getOnmousedown()
366   {
367     return ComponentUtils.resolveString(getProperty(ONMOUSEDOWN_KEY));
368   }
369 
370   /**
371    * Sets an onmousedown Javascript handler.
372    * 
373    * @param onmousedown  the new onmousedown value
374    */
375   final public void setOnmousedown(String onmousedown)
376   {
377     setProperty(ONMOUSEDOWN_KEY, (onmousedown));
378   }
379 
380   /**
381    * Gets an onmouseup Javascript handler.
382    *
383    * @return  the new onmouseup value
384    */
385   final public String getOnmouseup()
386   {
387     return ComponentUtils.resolveString(getProperty(ONMOUSEUP_KEY));
388   }
389 
390   /**
391    * Sets an onmouseup Javascript handler.
392    * 
393    * @param onmouseup  the new onmouseup value
394    */
395   final public void setOnmouseup(String onmouseup)
396   {
397     setProperty(ONMOUSEUP_KEY, (onmouseup));
398   }
399 
400   /**
401    * Gets an onmouseover Javascript handler.
402    *
403    * @return  the new onmouseover value
404    */
405   final public String getOnmouseover()
406   {
407     return ComponentUtils.resolveString(getProperty(ONMOUSEOVER_KEY));
408   }
409 
410   /**
411    * Sets an onmouseover Javascript handler.
412    * 
413    * @param onmouseover  the new onmouseover value
414    */
415   final public void setOnmouseover(String onmouseover)
416   {
417     setProperty(ONMOUSEOVER_KEY, (onmouseover));
418   }
419 
420   /**
421    * Gets an onmousemove Javascript handler.
422    *
423    * @return  the new onmousemove value
424    */
425   final public String getOnmousemove()
426   {
427     return ComponentUtils.resolveString(getProperty(ONMOUSEMOVE_KEY));
428   }
429 
430   /**
431    * Sets an onmousemove Javascript handler.
432    * 
433    * @param onmousemove  the new onmousemove value
434    */
435   final public void setOnmousemove(String onmousemove)
436   {
437     setProperty(ONMOUSEMOVE_KEY, (onmousemove));
438   }
439 
440   /**
441    * Gets an onmouseout Javascript handler.
442    *
443    * @return  the new onmouseout value
444    */
445   final public String getOnmouseout()
446   {
447     return ComponentUtils.resolveString(getProperty(ONMOUSEOUT_KEY));
448   }
449 
450   /**
451    * Sets an onmouseout Javascript handler.
452    * 
453    * @param onmouseout  the new onmouseout value
454    */
455   final public void setOnmouseout(String onmouseout)
456   {
457     setProperty(ONMOUSEOUT_KEY, (onmouseout));
458   }
459 
460   /**
461    * Gets an onkeypress Javascript handler.
462    *
463    * @return  the new onkeypress value
464    */
465   final public String getOnkeypress()
466   {
467     return ComponentUtils.resolveString(getProperty(ONKEYPRESS_KEY));
468   }
469 
470   /**
471    * Sets an onkeypress Javascript handler.
472    * 
473    * @param onkeypress  the new onkeypress value
474    */
475   final public void setOnkeypress(String onkeypress)
476   {
477     setProperty(ONKEYPRESS_KEY, (onkeypress));
478   }
479 
480   /**
481    * Gets an onkeydown Javascript handler.
482    *
483    * @return  the new onkeydown value
484    */
485   final public String getOnkeydown()
486   {
487     return ComponentUtils.resolveString(getProperty(ONKEYDOWN_KEY));
488   }
489 
490   /**
491    * Sets an onkeydown Javascript handler.
492    * 
493    * @param onkeydown  the new onkeydown value
494    */
495   final public void setOnkeydown(String onkeydown)
496   {
497     setProperty(ONKEYDOWN_KEY, (onkeydown));
498   }
499 
500   /**
501    * Gets an onkeyup Javascript handler.
502    *
503    * @return  the new onkeyup value
504    */
505   final public String getOnkeyup()
506   {
507     return ComponentUtils.resolveString(getProperty(ONKEYUP_KEY));
508   }
509 
510   /**
511    * Sets an onkeyup Javascript handler.
512    * 
513    * @param onkeyup  the new onkeyup value
514    */
515   final public void setOnkeyup(String onkeyup)
516   {
517     setProperty(ONKEYUP_KEY, (onkeyup));
518   }
519 
520   /**
521    * Gets the CSS style class of the bean.
522    *
523    * @return  the new styleClass value
524    */
525   final public String getStyleClass()
526   {
527     return ComponentUtils.resolveString(getProperty(STYLE_CLASS_KEY));
528   }
529 
530   /**
531    * Sets the CSS style class of the bean.
532    * 
533    * @param styleClass  the new styleClass value
534    */
535   final public void setStyleClass(String styleClass)
536   {
537     setProperty(STYLE_CLASS_KEY, (styleClass));
538   }
539 
540   /**
541    * Gets the inline CSS style for this element
542    *
543    * @return  the new inlineStyle value
544    */
545   final public String getInlineStyle()
546   {
547     return ComponentUtils.resolveString(getProperty(INLINE_STYLE_KEY));
548   }
549 
550   /**
551    * Sets the inline CSS style for this element
552    * 
553    * @param inlineStyle  the new inlineStyle value
554    */
555   final public void setInlineStyle(String inlineStyle)
556   {
557     setProperty(INLINE_STYLE_KEY, (inlineStyle));
558   }
559 
560   @Override
561   public String getDefaultEventName()
562   {
563     return "click";
564   }
565 
566   @Override
567   public Collection<String> getEventNames()
568   {
569     return _EVENT_NAMES;
570   }
571 
572   @Override
573   public Map<String, List<ClientBehavior>> getClientBehaviors()
574   {
575     return super.getClientBehaviors();
576   }
577 
578   @Override
579   public void addClientBehavior(
580     String         eventName,
581     ClientBehavior behavior)
582   {
583     super.addClientBehavior(eventName, behavior);
584   }
585 
586   @Override
587   public String getFamily()
588   {
589     return COMPONENT_FAMILY;
590   }
591 
592   @Override
593   protected FacesBean.Type getBeanType()
594   {
595     return TYPE;
596   }
597 
598   /**
599    * Construct an instance of the HtmlTableLayout.
600    */
601   protected HtmlTableLayout(
602     String rendererType
603     )
604   {
605     super(rendererType);
606   }
607 
608   static
609   {
610     TYPE.lockAndRegister("org.apache.myfaces.trinidad.TableLayout","org.apache.myfaces.trinidad.TableLayout");
611   }
612 }