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