1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.tobago.component;
21
22 import javax.el.MethodExpression;
23 import javax.faces.context.FacesContext;
24 import org.apache.myfaces.tobago.context.Markup;
25 import org.apache.myfaces.tobago.internal.component.AbstractUIInput;
26 import org.apache.myfaces.tobago.layout.Display;
27 import org.apache.myfaces.tobago.layout.Measure;
28 import org.apache.commons.lang.ArrayUtils;
29 import org.apache.commons.lang.StringUtils;
30 import org.apache.myfaces.tobago.internal.util.Deprecation;
31 import org.apache.myfaces.tobago.renderkit.MarginValues;
32 import org.apache.myfaces.tobago.renderkit.SpacingValues;
33 import org.apache.myfaces.tobago.renderkit.LayoutComponentRenderer;
34 import javax.el.ELException;
35 import javax.faces.FacesException;
36 import java.util.ArrayList;
37 import java.util.List;
38 import javax.el.MethodExpression;
39 import javax.el.ValueExpression;
40
41
42
43
44
45
46 public class UIIn
47 extends AbstractUIInput implements InputSuggest2, SupportsMarkup {
48
49 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.In";
50
51 public static final String COMPONENT_FAMILY = "javax.faces.Input";
52
53 private org.apache.myfaces.tobago.context.Markup currentMarkup;
54
55 enum PropertyKeys {
56 markup,
57 marginLeft,
58 tabIndex,
59 minimumHeight,
60 password,
61 tip,
62 suggestMethod,
63 suggestDelay,
64 height,
65 minimumWidth,
66 inline,
67 rowSpan,
68 left,
69 focus,
70 columnSpan,
71 suggestMinChars,
72 top,
73 maximumHeight,
74 currentWidth,
75 marginTop,
76 width,
77 marginRight,
78 preferredHeight,
79 currentHeight,
80 label,
81 display,
82 maximumWidth,
83 autocomplete,
84 onchange,
85 preferredWidth,
86 marginBottom,
87 verticalIndex,
88 horizontalIndex,
89 readonly,
90 disabled,
91 }
92
93 public String getFamily() {
94 return COMPONENT_FAMILY;
95 }
96
97
98 public org.apache.myfaces.tobago.context.Markup getMarkup() {
99 Object object = getStateHelper().eval(PropertyKeys.markup);
100 if (object != null) {
101 return Markup.valueOf(object);
102 }
103 return null;
104 }
105
106 public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
107 getStateHelper().put(PropertyKeys.markup, markup);
108 }
109
110 public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
111 Object object = getStateHelper().eval(PropertyKeys.marginLeft);
112 if (object != null) {
113 return Measure.valueOf(object);
114 }
115 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this);
116 }
117
118 public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
119 getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
120 }
121
122
123
124
125
126
127
128
129
130
131
132
133 public java.lang.Integer getTabIndex() {
134 Number value = (Number) getStateHelper().eval(PropertyKeys.tabIndex);
135 if (value != null) {
136 return value.intValue();
137 }
138 return null;
139 }
140
141 public void setTabIndex(java.lang.Integer tabIndex) {
142 getStateHelper().put(PropertyKeys.tabIndex, tabIndex);
143 }
144
145 public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
146 Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
147 if (object != null) {
148 return Measure.valueOf(object);
149 }
150 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this);
151 }
152
153 public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
154 getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
155 }
156
157
158
159
160
161
162 public boolean isPassword() {
163 Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.password);
164 if (bool != null) {
165 return bool;
166 }
167 return false;
168 }
169
170 public void setPassword(boolean password) {
171 getStateHelper().put(PropertyKeys.password, password);
172 }
173
174
175
176
177
178 public java.lang.String getTip() {
179 return (java.lang.String) getStateHelper().eval(PropertyKeys.tip);
180 }
181
182 public void setTip(java.lang.String tip) {
183 getStateHelper().put(PropertyKeys.tip, tip);
184 }
185
186
187
188
189 @Deprecated
190 public javax.faces.el.MethodBinding getSuggestMethod() {
191 javax.el.MethodExpression expression = getSuggestMethodExpression();
192 if (expression instanceof MethodBindingToMethodExpression) {
193 return ((MethodBindingToMethodExpression)expression).getMethodBinding();
194 }
195 if (expression != null) {
196 return new MethodExpressionToMethodBinding(expression);
197 }
198 return null;
199 }
200
201
202
203
204 @Deprecated
205 public void setSuggestMethod(javax.faces.el.MethodBinding suggestMethod) {
206 if (suggestMethod != null) {
207 setSuggestMethodExpression(new MethodBindingToMethodExpression(suggestMethod));
208 } else {
209 setSuggestMethodExpression(null);
210 }
211 }
212
213 public javax.el.MethodExpression getSuggestMethodExpression() {
214 return (javax.el.MethodExpression) getStateHelper().eval(PropertyKeys.suggestMethod);
215 }
216
217 public void setSuggestMethodExpression(javax.el.MethodExpression suggestMethod) {
218 getStateHelper().put(PropertyKeys.suggestMethod, suggestMethod);
219 }
220
221
222
223
224
225
226 public java.lang.Integer getSuggestDelay() {
227 Number value = (Number) getStateHelper().eval(PropertyKeys.suggestDelay);
228 if (value != null) {
229 return value.intValue();
230 }
231 return 300;
232 }
233
234 public void setSuggestDelay(java.lang.Integer suggestDelay) {
235 getStateHelper().put(PropertyKeys.suggestDelay, suggestDelay);
236 }
237
238
239
240
241
242 public org.apache.myfaces.tobago.layout.Measure getHeight() {
243 Object object = getStateHelper().eval(PropertyKeys.height);
244 if (object != null) {
245 return Measure.valueOf(object);
246 }
247 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this);
248 }
249
250 public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
251 getStateHelper().put(PropertyKeys.height, height);
252 }
253
254 public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
255 Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
256 if (object != null) {
257 return Measure.valueOf(object);
258 }
259 return ((LayoutComponentRenderer)getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this);
260 }
261
262 public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
263 getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
264 }
265
266
267
268
269
270 @Deprecated
271 public boolean isInline() {
272 Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.inline);
273 if (bool != null) {
274 return bool;
275 }
276 return false;
277 }
278
279 @Deprecated
280 public void setInline(boolean inline) {
281 Deprecation.LOG.error("The attribute 'inline' of 'UIIn' is deprecated. "
282 + "Please refer the documentation for further information.");
283 getStateHelper().put(PropertyKeys.inline, inline);
284 }
285
286 public java.lang.Integer getRowSpan() {
287 Number value = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
288 if (value != null) {
289 return value.intValue();
290 }
291 return 1;
292 }
293
294 public void setRowSpan(java.lang.Integer rowSpan) {
295 getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
296 }
297
298
299
300
301
302 public org.apache.myfaces.tobago.layout.Measure getLeft() {
303 Object object = getStateHelper().eval(PropertyKeys.left);
304 if (object != null) {
305 return Measure.valueOf(object);
306 }
307 return null;
308 }
309
310 public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
311 getStateHelper().put(PropertyKeys.left, left);
312 }
313
314
315
316
317
318 public boolean isFocus() {
319 Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.focus);
320 if (bool != null) {
321 return bool;
322 }
323 return false;
324 }
325
326 public void setFocus(boolean focus) {
327 getStateHelper().put(PropertyKeys.focus, focus);
328 }
329
330 public java.lang.Integer getColumnSpan() {
331 Number value = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
332 if (value != null) {
333 return value.intValue();
334 }
335 return 1;
336 }
337
338 public void setColumnSpan(java.lang.Integer columnSpan) {
339 getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
340 }
341
342
343
344
345
346 public java.lang.Integer getSuggestMinChars() {
347 Number value = (Number) getStateHelper().eval(PropertyKeys.suggestMinChars);
348 if (value != null) {
349 return value.intValue();
350 }
351 return 1;
352 }
353
354 public void setSuggestMinChars(java.lang.Integer suggestMinChars) {
355 getStateHelper().put(PropertyKeys.suggestMinChars, suggestMinChars);
356 }
357
358
359
360
361
362 public org.apache.myfaces.tobago.layout.Measure getTop() {
363 Object object = getStateHelper().eval(PropertyKeys.top);
364 if (object != null) {
365 return Measure.valueOf(object);
366 }
367 return null;
368 }
369
370 public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
371 getStateHelper().put(PropertyKeys.top, top);
372 }
373
374 public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
375 Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
376 if (object != null) {
377 return Measure.valueOf(object);
378 }
379 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this);
380 }
381
382 public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
383 getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
384 }
385
386
387
388
389
390 public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
391 Object object = getStateHelper().eval(PropertyKeys.currentWidth);
392 if (object != null) {
393 return Measure.valueOf(object);
394 }
395 return getWidth();
396 }
397
398 public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
399 getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
400 }
401
402 public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
403 Object object = getStateHelper().eval(PropertyKeys.marginTop);
404 if (object != null) {
405 return Measure.valueOf(object);
406 }
407 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this);
408 }
409
410 public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
411 getStateHelper().put(PropertyKeys.marginTop, marginTop);
412 }
413
414
415
416
417
418 public org.apache.myfaces.tobago.layout.Measure getWidth() {
419 Object object = getStateHelper().eval(PropertyKeys.width);
420 if (object != null) {
421 return Measure.valueOf(object);
422 }
423 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this);
424 }
425
426 public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
427 getStateHelper().put(PropertyKeys.width, width);
428 }
429
430 public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
431 Object object = getStateHelper().eval(PropertyKeys.marginRight);
432 if (object != null) {
433 return Measure.valueOf(object);
434 }
435 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this);
436 }
437
438 public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
439 getStateHelper().put(PropertyKeys.marginRight, marginRight);
440 }
441
442 public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
443 Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
444 if (object != null) {
445 return Measure.valueOf(object);
446 }
447 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this);
448 }
449
450 public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
451 getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
452 }
453
454
455
456
457
458 public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
459 Object object = getStateHelper().eval(PropertyKeys.currentHeight);
460 if (object != null) {
461 return Measure.valueOf(object);
462 }
463 return getHeight();
464 }
465
466 public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
467 getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
468 }
469
470
471
472
473
474 public java.lang.String getLabel() {
475 return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
476 }
477
478 public void setLabel(java.lang.String label) {
479 getStateHelper().put(PropertyKeys.label, label);
480 }
481
482
483
484
485
486 public org.apache.myfaces.tobago.layout.Display getDisplay() {
487 return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
488 }
489
490 public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
491 getStateHelper().put(PropertyKeys.display, display);
492 }
493
494 public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
495 Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
496 if (object != null) {
497 return Measure.valueOf(object);
498 }
499 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this);
500 }
501
502 public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
503 getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
504 }
505
506 public boolean isAutocomplete() {
507 Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.autocomplete);
508 if (bool != null) {
509 return bool;
510 }
511 return true;
512 }
513
514 public void setAutocomplete(boolean autocomplete) {
515 getStateHelper().put(PropertyKeys.autocomplete, autocomplete);
516 }
517
518
519
520
521
522 public java.lang.String getOnchange() {
523 return (java.lang.String) getStateHelper().eval(PropertyKeys.onchange);
524 }
525
526 public void setOnchange(java.lang.String onchange) {
527 getStateHelper().put(PropertyKeys.onchange, onchange);
528 }
529
530 public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
531 Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
532 if (object != null) {
533 return Measure.valueOf(object);
534 }
535 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this);
536 }
537
538 public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
539 getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
540 }
541
542 public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
543 Object object = getStateHelper().eval(PropertyKeys.marginBottom);
544 if (object != null) {
545 return Measure.valueOf(object);
546 }
547 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this);
548 }
549
550 public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
551 getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
552 }
553
554
555
556
557
558 public java.lang.Integer getVerticalIndex() {
559 Number value = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
560 if (value != null) {
561 return value.intValue();
562 }
563 return null;
564 }
565
566 public void setVerticalIndex(java.lang.Integer verticalIndex) {
567 getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
568 }
569
570 public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
571 if (currentMarkup != null) {
572 return currentMarkup;
573 }
574 return null;
575 }
576
577 public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
578 this.currentMarkup = currentMarkup;
579 }
580
581
582
583
584
585 public java.lang.Integer getHorizontalIndex() {
586 Number value = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
587 if (value != null) {
588 return value.intValue();
589 }
590 return null;
591 }
592
593 public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
594 getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
595 }
596
597
598
599
600
601 public boolean isReadonly() {
602 Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
603 if (bool != null) {
604 return bool;
605 }
606 return false;
607 }
608
609 public void setReadonly(boolean readonly) {
610 getStateHelper().put(PropertyKeys.readonly, readonly);
611 }
612
613
614
615
616
617 public boolean isDisabled() {
618 Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
619 if (bool != null) {
620 return bool;
621 }
622 return false;
623 }
624
625 public void setDisabled(boolean disabled) {
626 getStateHelper().put(PropertyKeys.disabled, disabled);
627 }
628
629 public Object saveState(FacesContext context) {
630 currentMarkup = null;
631 return super.saveState(context);
632 }
633
634
635 }