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 * <html:p>
40 * The showDetailItem component is used inside of a showOne
41 * component to contain a group of children. It is identified visually
42 * by the the <html:strong>text</html:strong> attribute value and lays
43 * out its children. When inside of a parent showOne, "disclosed" and
44 * "rendered" mean different things: if "rendered" is false, it means
45 * that this item and its contents are not available at all to the user,
46 * while if "disclosed" is false, it means that the contents of the item
47 * are not currently visible, but may be made visible by the user. It is
48 * generally used inside of a showOne component, but may be used on its
49 * own, in which case "disclosed" functions equivalently to "rendered",
50 * and the "text" attribute is ignored.
51 * </html:p>
52 *
53 * <h4>Events:</h4>
54 * <table border="1" width="100%" cellpadding="3" summary="">
55 * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
56 * <th align="left">Type</th>
57 * <th align="left">Phases</th>
58 * <th align="left">Description</th>
59 * </tr>
60 * <tr class="TableRowColor">
61 * <td valign="top"><code>org.apache.myfaces.trinidad.event.DisclosureEvent</code></td>
62 * <td valign="top" nowrap>Apply<br>Request<br>Values<br>Invoke<br>Application</td>
63 * <td valign="top">The disclosure event is delivered when a node is
64 disclosed.</td>
65 * </tr>
66 * <tr class="TableRowColor">
67 * <td valign="top"><code>org.apache.myfaces.trinidad.event.AttributeChangeEvent</code></td>
68 * <td valign="top" nowrap>Invoke<br>Application<br>Apply<br>Request<br>Values</td>
69 * <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>
70 * </tr>
71 * </table>
72 */
73 public class CoreShowDetailItem extends UIXShowDetail
74 implements ClientBehaviorHolder
75 {
76 static public final FacesBean.Type TYPE = new FacesBean.Type(
77 UIXShowDetail.TYPE);
78 static public final PropertyKey INLINE_STYLE_KEY =
79 TYPE.registerKey("inlineStyle", String.class);
80 static public final PropertyKey STYLE_CLASS_KEY =
81 TYPE.registerKey("styleClass", String.class);
82 static public final PropertyKey SHORT_DESC_KEY =
83 TYPE.registerKey("shortDesc", String.class);
84 static public final PropertyKey PARTIAL_TRIGGERS_KEY =
85 TYPE.registerKey("partialTriggers", String[].class, null, 0, PropertyKey.Mutable.RARELY);
86 static public final PropertyKey ONCLICK_KEY =
87 TYPE.registerKey("onclick", String.class);
88 static public final PropertyKey ONDBLCLICK_KEY =
89 TYPE.registerKey("ondblclick", String.class);
90 static public final PropertyKey ONMOUSEDOWN_KEY =
91 TYPE.registerKey("onmousedown", String.class);
92 static public final PropertyKey ONMOUSEUP_KEY =
93 TYPE.registerKey("onmouseup", String.class);
94 static public final PropertyKey ONMOUSEOVER_KEY =
95 TYPE.registerKey("onmouseover", String.class);
96 static public final PropertyKey ONMOUSEMOVE_KEY =
97 TYPE.registerKey("onmousemove", String.class);
98 static public final PropertyKey ONMOUSEOUT_KEY =
99 TYPE.registerKey("onmouseout", String.class);
100 static public final PropertyKey ONKEYPRESS_KEY =
101 TYPE.registerKey("onkeypress", String.class);
102 static public final PropertyKey ONKEYDOWN_KEY =
103 TYPE.registerKey("onkeydown", String.class);
104 static public final PropertyKey ONKEYUP_KEY =
105 TYPE.registerKey("onkeyup", String.class);
106 static public final PropertyKey DISABLED_KEY =
107 TYPE.registerKey("disabled", Boolean.class, Boolean.FALSE);
108 static public final PropertyKey TEXT_KEY =
109 TYPE.registerKey("text", String.class);
110 static public final PropertyKey ACCESS_KEY_KEY =
111 TYPE.registerKey("accessKey", Character.class);
112 static public final PropertyKey FLEX_KEY =
113 TYPE.registerKey("flex", Integer.class, Integer.valueOf(0));
114 static public final String TOOLBAR_FACET = "toolbar";
115
116 static public final String COMPONENT_FAMILY =
117 "org.apache.myfaces.trinidad.ShowDetail";
118 static public final String COMPONENT_TYPE =
119 "org.apache.myfaces.trinidad.CoreShowDetailItem";
120 // Supported client events for client behaviors:
121 private final static Collection<String> _EVENT_NAMES = Collections.unmodifiableCollection(
122 Arrays.asList(
123 "click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove",
124 "mouseout", "keypress", "keydown", "keyup"
125 ));
126
127 /**
128 * Construct an instance of the CoreShowDetailItem.
129 */
130 public CoreShowDetailItem()
131 {
132 super("org.apache.myfaces.trinidad.Item");
133 }
134
135 /**
136 * The content for the toolbar region of the detail item.
137 * This facet will not be rendered as part of this component
138 * but should, instead, be rendered by containers which support
139 * toobars.
140 */
141 final public UIComponent getToolbar()
142 {
143 return getFacet(TOOLBAR_FACET);
144 }
145
146 /**
147 * The content for the toolbar region of the detail item.
148 * This facet will not be rendered as part of this component
149 * but should, instead, be rendered by containers which support
150 * toobars.
151 */
152 @SuppressWarnings("unchecked")
153 final public void setToolbar(UIComponent toolbarFacet)
154 {
155 getFacets().put(TOOLBAR_FACET, toolbarFacet);
156 }
157
158 /**
159 * Gets the CSS styles to use for this component.
160 *
161 * @return the new inlineStyle value
162 */
163 final public String getInlineStyle()
164 {
165 return ComponentUtils.resolveString(getProperty(INLINE_STYLE_KEY));
166 }
167
168 /**
169 * Sets the CSS styles to use for this component.
170 *
171 * @param inlineStyle the new inlineStyle value
172 */
173 final public void setInlineStyle(String inlineStyle)
174 {
175 setProperty(INLINE_STYLE_KEY, (inlineStyle));
176 }
177
178 /**
179 * Gets a CSS style class to use for this component.
180 *
181 * @return the new styleClass value
182 */
183 final public String getStyleClass()
184 {
185 return ComponentUtils.resolveString(getProperty(STYLE_CLASS_KEY));
186 }
187
188 /**
189 * Sets a CSS style class to use for this component.
190 *
191 * @param styleClass the new styleClass value
192 */
193 final public void setStyleClass(String styleClass)
194 {
195 setProperty(STYLE_CLASS_KEY, (styleClass));
196 }
197
198 /**
199 * Gets The short description of the component. This text is commonly used by user agents to display tooltip help text.
200 *
201 * @return the new shortDesc value
202 */
203 final public String getShortDesc()
204 {
205 return ComponentUtils.resolveString(getProperty(SHORT_DESC_KEY));
206 }
207
208 /**
209 * Sets The short description of the component. This text is commonly used by user agents to display tooltip help text.
210 *
211 * @param shortDesc the new shortDesc value
212 */
213 final public void setShortDesc(String shortDesc)
214 {
215 setProperty(SHORT_DESC_KEY, (shortDesc));
216 }
217
218 /**
219 * Gets the IDs of the components that should trigger a partial update.
220 * <p>
221 * This component will listen on the trigger components. If one of the
222 * trigger components receives an event that will cause it to update
223 * in some way, this component will request to be updated too.</p>
224 * <p>
225 * Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"
226 * </p>
227 * <p>
228 * Identifiers must account for NamingContainers. You can use a single colon to start the search from the root,
229 * or use multiple colons to move up through the NamingContainer. For example,
230 * "::" will pop out of this component's naming container (it pops out of itself if it is a naming container),
231 * ":::" will pop out of two naming containers, etc. The search for
232 * the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the
233 * component with id = commandButton1 after popping out of two naming containers relative to this component.
234 * To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".</p>
235 *
236 * @return the new partialTriggers value
237 */
238 final public String[] getPartialTriggers()
239 {
240 return (String[])getProperty(PARTIAL_TRIGGERS_KEY);
241 }
242
243 /**
244 * Sets the IDs of the components that should trigger a partial update.
245 * <p>
246 * This component will listen on the trigger components. If one of the
247 * trigger components receives an event that will cause it to update
248 * in some way, this component will request to be updated too.</p>
249 * <p>
250 * Separate multiple triggers with a space. e.g., partialTriggers="cmp1 cmp2"
251 * </p>
252 * <p>
253 * Identifiers must account for NamingContainers. You can use a single colon to start the search from the root,
254 * or use multiple colons to move up through the NamingContainer. For example,
255 * "::" will pop out of this component's naming container (it pops out of itself if it is a naming container),
256 * ":::" will pop out of two naming containers, etc. The search for
257 * the partialTrigger begins from there. e.g., partialTriggers=":::commandButton1" the search begins for the
258 * component with id = commandButton1 after popping out of two naming containers relative to this component.
259 * To go into naming containers, you separate the naming containers with ':', e.g.,partialTriggers= "nc1:nc2:nc3:componentId".</p>
260 *
261 * @param partialTriggers the new partialTriggers value
262 */
263 final public void setPartialTriggers(String[] partialTriggers)
264 {
265 setProperty(PARTIAL_TRIGGERS_KEY, (partialTriggers));
266 }
267
268 /**
269 * Gets an onclick Javascript handler.
270 *
271 * @return the new onclick value
272 */
273 final public String getOnclick()
274 {
275 return ComponentUtils.resolveString(getProperty(ONCLICK_KEY));
276 }
277
278 /**
279 * Sets an onclick Javascript handler.
280 *
281 * @param onclick the new onclick value
282 */
283 final public void setOnclick(String onclick)
284 {
285 setProperty(ONCLICK_KEY, (onclick));
286 }
287
288 /**
289 * Gets an ondblclick Javascript handler.
290 *
291 * @return the new ondblclick value
292 */
293 final public String getOndblclick()
294 {
295 return ComponentUtils.resolveString(getProperty(ONDBLCLICK_KEY));
296 }
297
298 /**
299 * Sets an ondblclick Javascript handler.
300 *
301 * @param ondblclick the new ondblclick value
302 */
303 final public void setOndblclick(String ondblclick)
304 {
305 setProperty(ONDBLCLICK_KEY, (ondblclick));
306 }
307
308 /**
309 * Gets an onmousedown Javascript handler.
310 *
311 * @return the new onmousedown value
312 */
313 final public String getOnmousedown()
314 {
315 return ComponentUtils.resolveString(getProperty(ONMOUSEDOWN_KEY));
316 }
317
318 /**
319 * Sets an onmousedown Javascript handler.
320 *
321 * @param onmousedown the new onmousedown value
322 */
323 final public void setOnmousedown(String onmousedown)
324 {
325 setProperty(ONMOUSEDOWN_KEY, (onmousedown));
326 }
327
328 /**
329 * Gets an onmouseup Javascript handler.
330 *
331 * @return the new onmouseup value
332 */
333 final public String getOnmouseup()
334 {
335 return ComponentUtils.resolveString(getProperty(ONMOUSEUP_KEY));
336 }
337
338 /**
339 * Sets an onmouseup Javascript handler.
340 *
341 * @param onmouseup the new onmouseup value
342 */
343 final public void setOnmouseup(String onmouseup)
344 {
345 setProperty(ONMOUSEUP_KEY, (onmouseup));
346 }
347
348 /**
349 * Gets an onmouseover Javascript handler.
350 *
351 * @return the new onmouseover value
352 */
353 final public String getOnmouseover()
354 {
355 return ComponentUtils.resolveString(getProperty(ONMOUSEOVER_KEY));
356 }
357
358 /**
359 * Sets an onmouseover Javascript handler.
360 *
361 * @param onmouseover the new onmouseover value
362 */
363 final public void setOnmouseover(String onmouseover)
364 {
365 setProperty(ONMOUSEOVER_KEY, (onmouseover));
366 }
367
368 /**
369 * Gets an onmousemove Javascript handler.
370 *
371 * @return the new onmousemove value
372 */
373 final public String getOnmousemove()
374 {
375 return ComponentUtils.resolveString(getProperty(ONMOUSEMOVE_KEY));
376 }
377
378 /**
379 * Sets an onmousemove Javascript handler.
380 *
381 * @param onmousemove the new onmousemove value
382 */
383 final public void setOnmousemove(String onmousemove)
384 {
385 setProperty(ONMOUSEMOVE_KEY, (onmousemove));
386 }
387
388 /**
389 * Gets an onmouseout Javascript handler.
390 *
391 * @return the new onmouseout value
392 */
393 final public String getOnmouseout()
394 {
395 return ComponentUtils.resolveString(getProperty(ONMOUSEOUT_KEY));
396 }
397
398 /**
399 * Sets an onmouseout Javascript handler.
400 *
401 * @param onmouseout the new onmouseout value
402 */
403 final public void setOnmouseout(String onmouseout)
404 {
405 setProperty(ONMOUSEOUT_KEY, (onmouseout));
406 }
407
408 /**
409 * Gets an onkeypress Javascript handler.
410 *
411 * @return the new onkeypress value
412 */
413 final public String getOnkeypress()
414 {
415 return ComponentUtils.resolveString(getProperty(ONKEYPRESS_KEY));
416 }
417
418 /**
419 * Sets an onkeypress Javascript handler.
420 *
421 * @param onkeypress the new onkeypress value
422 */
423 final public void setOnkeypress(String onkeypress)
424 {
425 setProperty(ONKEYPRESS_KEY, (onkeypress));
426 }
427
428 /**
429 * Gets an onkeydown Javascript handler.
430 *
431 * @return the new onkeydown value
432 */
433 final public String getOnkeydown()
434 {
435 return ComponentUtils.resolveString(getProperty(ONKEYDOWN_KEY));
436 }
437
438 /**
439 * Sets an onkeydown Javascript handler.
440 *
441 * @param onkeydown the new onkeydown value
442 */
443 final public void setOnkeydown(String onkeydown)
444 {
445 setProperty(ONKEYDOWN_KEY, (onkeydown));
446 }
447
448 /**
449 * Gets an onkeyup Javascript handler.
450 *
451 * @return the new onkeyup value
452 */
453 final public String getOnkeyup()
454 {
455 return ComponentUtils.resolveString(getProperty(ONKEYUP_KEY));
456 }
457
458 /**
459 * Sets an onkeyup Javascript handler.
460 *
461 * @param onkeyup the new onkeyup value
462 */
463 final public void setOnkeyup(String onkeyup)
464 {
465 setProperty(ONKEYUP_KEY, (onkeyup));
466 }
467
468 /**
469 * Gets If value is "true", the component becomes non-interactive.
470 * Otherwise,the default value is "false" and component assumes
471 * its expected behavior.
472 *
473 * @return the new disabled value
474 */
475 final public boolean isDisabled()
476 {
477 return ComponentUtils.resolveBoolean(getProperty(DISABLED_KEY), false);
478 }
479
480 /**
481 * Sets If value is "true", the component becomes non-interactive.
482 * Otherwise,the default value is "false" and component assumes
483 * its expected behavior.
484 *
485 * @param disabled the new disabled value
486 */
487 final public void setDisabled(boolean disabled)
488 {
489 setProperty(DISABLED_KEY, disabled ? Boolean.TRUE : Boolean.FALSE);
490 }
491
492 /**
493 * Gets the textual label of the showDetailItem.
494 *
495 * @return the new text value
496 */
497 final public String getText()
498 {
499 return ComponentUtils.resolveString(getProperty(TEXT_KEY));
500 }
501
502 /**
503 * Sets the textual label of the showDetailItem.
504 *
505 * @param text the new text value
506 */
507 final public void setText(String text)
508 {
509 setProperty(TEXT_KEY, (text));
510 }
511
512 /**
513 * Gets Character used to gain quick access to this showDetailItem.
514 * For accessibility reasons, this functionality is not supported
515 * in screen reader mode.
516 * <p>
517 * If the same access key appears in multiple locations in the
518 * same page of output, the rendering user agent will cycle
519 * among the elements accessed by the similar keys.
520 * </p>
521 * <p>
522 * This attribute is sometimes referred to as the "mnemonic".
523 * </p>
524 *
525 * @return the new accessKey value
526 */
527 final public char getAccessKey()
528 {
529 return ComponentUtils.resolveCharacter((Character)getProperty(ACCESS_KEY_KEY));
530 }
531
532 /**
533 * Sets Character used to gain quick access to this showDetailItem.
534 * For accessibility reasons, this functionality is not supported
535 * in screen reader mode.
536 * <p>
537 * If the same access key appears in multiple locations in the
538 * same page of output, the rendering user agent will cycle
539 * among the elements accessed by the similar keys.
540 * </p>
541 * <p>
542 * This attribute is sometimes referred to as the "mnemonic".
543 * </p>
544 *
545 * @param accessKey the new accessKey value
546 */
547 final public void setAccessKey(char accessKey)
548 {
549 setProperty(ACCESS_KEY_KEY, Character.valueOf(accessKey));
550 }
551
552 /**
553 * Gets A non-negative integer that indicates the flexibility of this
554 * component in its container. If the container supports it, flex
555 * is used to determine how space is distributed among its children.
556 * Components with larger flex values will be made larger than
557 * components with lower flex values. This is done so at the ratio
558 * determined by the flex of each of the two components. The actual
559 * value is only relevant if there are other flexible components
560 * (components with flex values larger than zero) within the same
561 * container.
562 *
563 * @return the new flex value
564 */
565 final public int getFlex()
566 {
567 return ComponentUtils.resolveInteger(getProperty(FLEX_KEY), 0);
568 }
569
570 /**
571 * Sets A non-negative integer that indicates the flexibility of this
572 * component in its container. If the container supports it, flex
573 * is used to determine how space is distributed among its children.
574 * Components with larger flex values will be made larger than
575 * components with lower flex values. This is done so at the ratio
576 * determined by the flex of each of the two components. The actual
577 * value is only relevant if there are other flexible components
578 * (components with flex values larger than zero) within the same
579 * container.
580 *
581 * @param flex the new flex value
582 */
583 final public void setFlex(int flex)
584 {
585 setProperty(FLEX_KEY, Integer.valueOf(flex));
586 }
587
588 @Override
589 public String getDefaultEventName()
590 {
591 return "click";
592 }
593
594 @Override
595 public Collection<String> getEventNames()
596 {
597 return _EVENT_NAMES;
598 }
599
600 @Override
601 public Map<String, List<ClientBehavior>> getClientBehaviors()
602 {
603 return super.getClientBehaviors();
604 }
605
606 @Override
607 public void addClientBehavior(
608 String eventName,
609 ClientBehavior behavior)
610 {
611 super.addClientBehavior(eventName, behavior);
612 }
613
614 @Override
615 public String getFamily()
616 {
617 return COMPONENT_FAMILY;
618 }
619
620 @Override
621 protected FacesBean.Type getBeanType()
622 {
623 return TYPE;
624 }
625
626 /**
627 * Construct an instance of the CoreShowDetailItem.
628 */
629 protected CoreShowDetailItem(
630 String rendererType
631 )
632 {
633 super(rendererType);
634 }
635
636 static
637 {
638 TYPE.lockAndRegister("org.apache.myfaces.trinidad.ShowDetail","org.apache.myfaces.trinidad.Item");
639 }
640 }