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