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.UIXPanel;
35 import org.apache.myfaces.trinidad.util.ComponentUtils;
36
37 /**
38 *
39 * <html:p>
40 * The panelFormLayout lays out input form controls, such that their
41 * labels and fields line up vertically. It supports multiple
42 * columns, and also supports a footer facet.
43 * </html:p>
44 * <html:p>
45 * Usually, this component will simply contain labelled Apache Trinidad input
46 * components in its main content - these are inputText, inputFile,
47 * inputColor, inputListOfValues, inputDate,
48 * selectBooleanCheckbox, selectBooleanRadio, selectOneChoice,
49 * selectOneListbox, selectOneRadio, selectManyCheckbox, and
50 * selectManyListbox. These components must have
51 * their "simple" attribute set to false, which is the default,
52 * and will cause the labels and fields inside the panelFormLayout
53 * to be aligned vertically.
54 * </html:p>
55 * <html:p>
56 * When more complex field contents are needed, use
57 * a panelLabelAndMessage around the more complex contents
58 * needed; see the example below.
59 * </html:p>
60 * <html:p>
61 * Other components can be added to panelFormLayout, but they
62 * will not line up with labels and fields automatically,
63 * and each will appear on its own row.
64 * You can use other panel components - like panelHorizontal -
65 * to get some level of layout within a row, but to align
66 * contents with the other labels and fields, use panelLabelAndMessage
67 * or the "footer" facet.
68 * </html:p>
69 * <html:p>
70 * The panelFormLayout is an example of one of the components that has support
71 * for grouping its children components.
72 * If you place panelFormLayout child items inside of a group, separators will
73 * be drawn around the group of form items if adjacent to other form items
74 * (separators won't be drawn at the top if the group is the first item in
75 * the column or, similarly, at the bottom if the group is the last item
76 * in the column).
77 * Grouped panelFormLayout items are kept in the same column of the panelFormLayout
78 * even when the assigned rows attribute is set to a value smaller than
79 * the number of items in the group.
80 * The panelFormLayout component also supports the group component in its footer
81 * facet so you can place more than one item in the footer. You can even
82 * group footer items one additional time to get separators to appear.
83 * </html:p>
84 *
85 * <h4>Events:</h4>
86 * <table border="1" width="100%" cellpadding="3" summary="">
87 * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
88 * <th align="left">Type</th>
89 * <th align="left">Phases</th>
90 * <th align="left">Description</th>
91 * </tr>
92 * <tr class="TableRowColor">
93 * <td valign="top"><code>org.apache.myfaces.trinidad.event.AttributeChangeEvent</code></td>
94 * <td valign="top" nowrap>Invoke<br>Application<br>Apply<br>Request<br>Values</td>
95 * <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>
96 * </tr>
97 * </table>
98 */
99 public class CorePanelFormLayout extends UIXPanel
100 implements ClientBehaviorHolder
101 {
102 static public final String LABEL_ALIGNMENT_START = "start";
103 static public final String LABEL_ALIGNMENT_TOP = "top";
104 static public final FacesBean.Type TYPE = new FacesBean.Type(
105 UIXPanel.TYPE);
106 static public final PropertyKey INLINE_STYLE_KEY =
107 TYPE.registerKey("inlineStyle", String.class);
108 static public final PropertyKey STYLE_CLASS_KEY =
109 TYPE.registerKey("styleClass", String.class);
110 static public final PropertyKey SHORT_DESC_KEY =
111 TYPE.registerKey("shortDesc", String.class);
112 static public final PropertyKey PARTIAL_TRIGGERS_KEY =
113 TYPE.registerKey("partialTriggers", String[].class, null, 0, PropertyKey.Mutable.RARELY);
114 static public final PropertyKey ONCLICK_KEY =
115 TYPE.registerKey("onclick", String.class);
116 static public final PropertyKey ONDBLCLICK_KEY =
117 TYPE.registerKey("ondblclick", String.class);
118 static public final PropertyKey ONMOUSEDOWN_KEY =
119 TYPE.registerKey("onmousedown", String.class);
120 static public final PropertyKey ONMOUSEUP_KEY =
121 TYPE.registerKey("onmouseup", String.class);
122 static public final PropertyKey ONMOUSEOVER_KEY =
123 TYPE.registerKey("onmouseover", String.class);
124 static public final PropertyKey ONMOUSEMOVE_KEY =
125 TYPE.registerKey("onmousemove", String.class);
126 static public final PropertyKey ONMOUSEOUT_KEY =
127 TYPE.registerKey("onmouseout", String.class);
128 static public final PropertyKey ONKEYPRESS_KEY =
129 TYPE.registerKey("onkeypress", String.class);
130 static public final PropertyKey ONKEYDOWN_KEY =
131 TYPE.registerKey("onkeydown", String.class);
132 static public final PropertyKey ONKEYUP_KEY =
133 TYPE.registerKey("onkeyup", String.class);
134 static public final PropertyKey FIELD_WIDTH_KEY =
135 TYPE.registerKey("fieldWidth", String.class);
136 static public final PropertyKey LABEL_WIDTH_KEY =
137 TYPE.registerKey("labelWidth", String.class);
138 static public final PropertyKey MAX_COLUMNS_KEY =
139 TYPE.registerKey("maxColumns", Integer.class);
140 static public final PropertyKey ROWS_KEY =
141 TYPE.registerKey("rows", Integer.class);
142 static public final PropertyKey LABEL_ALIGNMENT_KEY =
143 TYPE.registerKey("labelAlignment", String.class);
144 static public final String FOOTER_FACET = "footer";
145
146 static public final String COMPONENT_FAMILY =
147 "org.apache.myfaces.trinidad.Panel";
148 static public final String COMPONENT_TYPE =
149 "org.apache.myfaces.trinidad.CorePanelFormLayout";
150 // Supported client events for client behaviors:
151 private final static Collection<String> _EVENT_NAMES = Collections.unmodifiableCollection(
152 Arrays.asList(
153 "click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove",
154 "mouseout", "keypress", "keydown", "keyup"
155 ));
156
157 /**
158 * Construct an instance of the CorePanelFormLayout.
159 */
160 public CorePanelFormLayout()
161 {
162 super("org.apache.myfaces.trinidad.FormLayout");
163 }
164
165 /**
166 * This facet is rendered under the columns and usually contains a panelButtonBar.
167 * <p>
168 * This facet may not always line up perfectly, especially if the labels or fields are longer than expected. Try adjusting things with the labelWidth and fieldWidth attributes when necessary. Also, the columns attribute on inputText may be helpful.
169 * </p>
170 */
171 final public UIComponent getFooter()
172 {
173 return getFacet(FOOTER_FACET);
174 }
175
176 /**
177 * This facet is rendered under the columns and usually contains a panelButtonBar.
178 * <p>
179 * This facet may not always line up perfectly, especially if the labels or fields are longer than expected. Try adjusting things with the labelWidth and fieldWidth attributes when necessary. Also, the columns attribute on inputText may be helpful.
180 * </p>
181 */
182 @SuppressWarnings("unchecked")
183 final public void setFooter(UIComponent footerFacet)
184 {
185 getFacets().put(FOOTER_FACET, footerFacet);
186 }
187
188 /**
189 * Gets the CSS styles to use for this component.
190 *
191 * @return the new inlineStyle value
192 */
193 final public String getInlineStyle()
194 {
195 return ComponentUtils.resolveString(getProperty(INLINE_STYLE_KEY));
196 }
197
198 /**
199 * Sets the CSS styles to use for this component.
200 *
201 * @param inlineStyle the new inlineStyle value
202 */
203 final public void setInlineStyle(String inlineStyle)
204 {
205 setProperty(INLINE_STYLE_KEY, (inlineStyle));
206 }
207
208 /**
209 * Gets a CSS style class to use for this component.
210 *
211 * @return the new styleClass value
212 */
213 final public String getStyleClass()
214 {
215 return ComponentUtils.resolveString(getProperty(STYLE_CLASS_KEY));
216 }
217
218 /**
219 * Sets a CSS style class to use for this component.
220 *
221 * @param styleClass the new styleClass value
222 */
223 final public void setStyleClass(String styleClass)
224 {
225 setProperty(STYLE_CLASS_KEY, (styleClass));
226 }
227
228 /**
229 * Gets The short description of the component. This text is commonly used by user agents to display tooltip help text.
230 *
231 * @return the new shortDesc value
232 */
233 final public String getShortDesc()
234 {
235 return ComponentUtils.resolveString(getProperty(SHORT_DESC_KEY));
236 }
237
238 /**
239 * Sets The short description of the component. This text is commonly used by user agents to display tooltip help text.
240 *
241 * @param shortDesc the new shortDesc value
242 */
243 final public void setShortDesc(String shortDesc)
244 {
245 setProperty(SHORT_DESC_KEY, (shortDesc));
246 }
247
248 /**
249 * Gets the IDs of the components that should trigger a partial update.
250 * <p>
251 * This component will listen on the trigger components. If one of the
252 * trigger components receives an event that will cause it to update
253 * in some way, this component will request to be updated too.</p>
254 * <p>
255 * Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"
256 * </p>
257 * <p>
258 * Identifiers must account for NamingContainers. You can use a single colon to start the search from the root,
259 * or use multiple colons to move up through the NamingContainer. For example,
260 * "::" will pop out of this component's naming container (it pops out of itself if it is a naming container),
261 * ":::" will pop out of two naming containers, etc. The search for
262 * the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the
263 * component with id = commandButton1 after popping out of two naming containers relative to this component.
264 * To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".</p>
265 *
266 * @return the new partialTriggers value
267 */
268 final public String[] getPartialTriggers()
269 {
270 return (String[])getProperty(PARTIAL_TRIGGERS_KEY);
271 }
272
273 /**
274 * Sets the IDs of the components that should trigger a partial update.
275 * <p>
276 * This component will listen on the trigger components. If one of the
277 * trigger components receives an event that will cause it to update
278 * in some way, this component will request to be updated too.</p>
279 * <p>
280 * Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"
281 * </p>
282 * <p>
283 * Identifiers must account for NamingContainers. You can use a single colon to start the search from the root,
284 * or use multiple colons to move up through the NamingContainer. For example,
285 * "::" will pop out of this component's naming container (it pops out of itself if it is a naming container),
286 * ":::" will pop out of two naming containers, etc. The search for
287 * the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the
288 * component with id = commandButton1 after popping out of two naming containers relative to this component.
289 * To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".</p>
290 *
291 * @param partialTriggers the new partialTriggers value
292 */
293 final public void setPartialTriggers(String[] partialTriggers)
294 {
295 setProperty(PARTIAL_TRIGGERS_KEY, (partialTriggers));
296 }
297
298 /**
299 * Gets an onclick Javascript handler.
300 *
301 * @return the new onclick value
302 */
303 final public String getOnclick()
304 {
305 return ComponentUtils.resolveString(getProperty(ONCLICK_KEY));
306 }
307
308 /**
309 * Sets an onclick Javascript handler.
310 *
311 * @param onclick the new onclick value
312 */
313 final public void setOnclick(String onclick)
314 {
315 setProperty(ONCLICK_KEY, (onclick));
316 }
317
318 /**
319 * Gets an ondblclick Javascript handler.
320 *
321 * @return the new ondblclick value
322 */
323 final public String getOndblclick()
324 {
325 return ComponentUtils.resolveString(getProperty(ONDBLCLICK_KEY));
326 }
327
328 /**
329 * Sets an ondblclick Javascript handler.
330 *
331 * @param ondblclick the new ondblclick value
332 */
333 final public void setOndblclick(String ondblclick)
334 {
335 setProperty(ONDBLCLICK_KEY, (ondblclick));
336 }
337
338 /**
339 * Gets an onmousedown Javascript handler.
340 *
341 * @return the new onmousedown value
342 */
343 final public String getOnmousedown()
344 {
345 return ComponentUtils.resolveString(getProperty(ONMOUSEDOWN_KEY));
346 }
347
348 /**
349 * Sets an onmousedown Javascript handler.
350 *
351 * @param onmousedown the new onmousedown value
352 */
353 final public void setOnmousedown(String onmousedown)
354 {
355 setProperty(ONMOUSEDOWN_KEY, (onmousedown));
356 }
357
358 /**
359 * Gets an onmouseup Javascript handler.
360 *
361 * @return the new onmouseup value
362 */
363 final public String getOnmouseup()
364 {
365 return ComponentUtils.resolveString(getProperty(ONMOUSEUP_KEY));
366 }
367
368 /**
369 * Sets an onmouseup Javascript handler.
370 *
371 * @param onmouseup the new onmouseup value
372 */
373 final public void setOnmouseup(String onmouseup)
374 {
375 setProperty(ONMOUSEUP_KEY, (onmouseup));
376 }
377
378 /**
379 * Gets an onmouseover Javascript handler.
380 *
381 * @return the new onmouseover value
382 */
383 final public String getOnmouseover()
384 {
385 return ComponentUtils.resolveString(getProperty(ONMOUSEOVER_KEY));
386 }
387
388 /**
389 * Sets an onmouseover Javascript handler.
390 *
391 * @param onmouseover the new onmouseover value
392 */
393 final public void setOnmouseover(String onmouseover)
394 {
395 setProperty(ONMOUSEOVER_KEY, (onmouseover));
396 }
397
398 /**
399 * Gets an onmousemove Javascript handler.
400 *
401 * @return the new onmousemove value
402 */
403 final public String getOnmousemove()
404 {
405 return ComponentUtils.resolveString(getProperty(ONMOUSEMOVE_KEY));
406 }
407
408 /**
409 * Sets an onmousemove Javascript handler.
410 *
411 * @param onmousemove the new onmousemove value
412 */
413 final public void setOnmousemove(String onmousemove)
414 {
415 setProperty(ONMOUSEMOVE_KEY, (onmousemove));
416 }
417
418 /**
419 * Gets an onmouseout Javascript handler.
420 *
421 * @return the new onmouseout value
422 */
423 final public String getOnmouseout()
424 {
425 return ComponentUtils.resolveString(getProperty(ONMOUSEOUT_KEY));
426 }
427
428 /**
429 * Sets an onmouseout Javascript handler.
430 *
431 * @param onmouseout the new onmouseout value
432 */
433 final public void setOnmouseout(String onmouseout)
434 {
435 setProperty(ONMOUSEOUT_KEY, (onmouseout));
436 }
437
438 /**
439 * Gets an onkeypress Javascript handler.
440 *
441 * @return the new onkeypress value
442 */
443 final public String getOnkeypress()
444 {
445 return ComponentUtils.resolveString(getProperty(ONKEYPRESS_KEY));
446 }
447
448 /**
449 * Sets an onkeypress Javascript handler.
450 *
451 * @param onkeypress the new onkeypress value
452 */
453 final public void setOnkeypress(String onkeypress)
454 {
455 setProperty(ONKEYPRESS_KEY, (onkeypress));
456 }
457
458 /**
459 * Gets an onkeydown Javascript handler.
460 *
461 * @return the new onkeydown value
462 */
463 final public String getOnkeydown()
464 {
465 return ComponentUtils.resolveString(getProperty(ONKEYDOWN_KEY));
466 }
467
468 /**
469 * Sets an onkeydown Javascript handler.
470 *
471 * @param onkeydown the new onkeydown value
472 */
473 final public void setOnkeydown(String onkeydown)
474 {
475 setProperty(ONKEYDOWN_KEY, (onkeydown));
476 }
477
478 /**
479 * Gets an onkeyup Javascript handler.
480 *
481 * @return the new onkeyup value
482 */
483 final public String getOnkeyup()
484 {
485 return ComponentUtils.resolveString(getProperty(ONKEYUP_KEY));
486 }
487
488 /**
489 * Sets an onkeyup Javascript handler.
490 *
491 * @param onkeyup the new onkeyup value
492 */
493 final public void setOnkeyup(String onkeyup)
494 {
495 setProperty(ONKEYUP_KEY, (onkeyup));
496 }
497
498 /**
499 * Gets The preferred width of the field. Usually a percentage, but may be specified as either a percentage or an absolute number of pixels. If the width is not specified, it will default appropriately. If specified as a percentage the labelWidth plus the fieldWidth should add up to 100%, regardless of the number of columns. If the fieldWidth is specified and is a percentage the labelWidth will be derived appropriately if not specified.
500 *
501 * @return the new fieldWidth value
502 */
503 final public String getFieldWidth()
504 {
505 return ComponentUtils.resolveString(getProperty(FIELD_WIDTH_KEY));
506 }
507
508 /**
509 * Sets The preferred width of the field. Usually a percentage, but may be specified as either a percentage or an absolute number of pixels. If the width is not specified, it will default appropriately. If specified as a percentage the labelWidth plus the fieldWidth should add up to 100%, regardless of the number of columns. If the fieldWidth is specified and is a percentage the labelWidth will be derived appropriately if not specified.
510 *
511 * @param fieldWidth the new fieldWidth value
512 */
513 final public void setFieldWidth(String fieldWidth)
514 {
515 setProperty(FIELD_WIDTH_KEY, (fieldWidth));
516 }
517
518 /**
519 * Gets The preferred width of the label. Usually a percentage, but may be specified as either a percentage or an absolute number of pixels. If the width is not specified, it will default appropriately. If specified as a percentage the labelWidth plus the fieldWidth should add up to 100%, regardless of the number of columns. If the labelWidth is specified and is a percentage the fieldWidth will be derived appropriately if not specified.
520 *
521 * @return the new labelWidth value
522 */
523 final public String getLabelWidth()
524 {
525 return ComponentUtils.resolveString(getProperty(LABEL_WIDTH_KEY));
526 }
527
528 /**
529 * Sets The preferred width of the label. Usually a percentage, but may be specified as either a percentage or an absolute number of pixels. If the width is not specified, it will default appropriately. If specified as a percentage the labelWidth plus the fieldWidth should add up to 100%, regardless of the number of columns. If the labelWidth is specified and is a percentage the fieldWidth will be derived appropriately if not specified.
530 *
531 * @param labelWidth the new labelWidth value
532 */
533 final public void setLabelWidth(String labelWidth)
534 {
535 setProperty(LABEL_WIDTH_KEY, (labelWidth));
536 }
537
538 /**
539 * Gets Sets the maximum number of columns to show. This attribute defaults to 3 and 2 on PDAs. If this panelFormLayout is inside of another panelFormLayout, this will always be 1.
540 *
541 * @return the new maxColumns value
542 */
543 final public int getMaxColumns()
544 {
545 return ComponentUtils.resolveInteger(getProperty(MAX_COLUMNS_KEY));
546 }
547
548 /**
549 * Sets Sets the maximum number of columns to show. This attribute defaults to 3 and 2 on PDAs. If this panelFormLayout is inside of another panelFormLayout, this will always be 1.
550 *
551 * @param maxColumns the new maxColumns value
552 */
553 final public void setMaxColumns(int maxColumns)
554 {
555 setProperty(MAX_COLUMNS_KEY, Integer.valueOf(maxColumns));
556 }
557
558 /**
559 * Gets Sets the number of rows after which to start a new column. This attribute defaults to Integer.MAX_VALUE. The number of rows actually rendered depends also on the "maxColumns" property. If the children will not fit in the given number of rows and columns, the number of rows will increase to accomodate the children.
560 *
561 * @return the new rows value
562 */
563 final public int getRows()
564 {
565 return ComponentUtils.resolveInteger(getProperty(ROWS_KEY));
566 }
567
568 /**
569 * Sets Sets the number of rows after which to start a new column. This attribute defaults to Integer.MAX_VALUE. The number of rows actually rendered depends also on the "maxColumns" property. If the children will not fit in the given number of rows and columns, the number of rows will increase to accomodate the children.
570 *
571 * @param rows the new rows value
572 */
573 final public void setRows(int rows)
574 {
575 setProperty(ROWS_KEY, Integer.valueOf(rows));
576 }
577
578 /**
579 * Gets The alignment of label prompts for the form items.
580 *
581 * @return the new labelAlignment value
582 */
583 final public String getLabelAlignment()
584 {
585 return ComponentUtils.resolveString(getProperty(LABEL_ALIGNMENT_KEY));
586 }
587
588 /**
589 * Sets The alignment of label prompts for the form items.
590 *
591 * @param labelAlignment the new labelAlignment value
592 */
593 final public void setLabelAlignment(String labelAlignment)
594 {
595 setProperty(LABEL_ALIGNMENT_KEY, (labelAlignment));
596 }
597
598 @Override
599 public String getDefaultEventName()
600 {
601 return "click";
602 }
603
604 @Override
605 public Collection<String> getEventNames()
606 {
607 return _EVENT_NAMES;
608 }
609
610 @Override
611 public Map<String, List<ClientBehavior>> getClientBehaviors()
612 {
613 return super.getClientBehaviors();
614 }
615
616 @Override
617 public void addClientBehavior(
618 String eventName,
619 ClientBehavior behavior)
620 {
621 super.addClientBehavior(eventName, behavior);
622 }
623
624 @Override
625 public String getFamily()
626 {
627 return COMPONENT_FAMILY;
628 }
629
630 @Override
631 protected FacesBean.Type getBeanType()
632 {
633 return TYPE;
634 }
635
636 /**
637 * Construct an instance of the CorePanelFormLayout.
638 */
639 protected CorePanelFormLayout(
640 String rendererType
641 )
642 {
643 super(rendererType);
644 }
645
646 static
647 {
648 TYPE.lockAndRegister("org.apache.myfaces.trinidad.Panel","org.apache.myfaces.trinidad.FormLayout");
649 }
650 }