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.AbstractUINumberSlider;
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 UINumberSlider
46 extends AbstractUINumberSlider implements SupportsMarkup {
47
48 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.NumberSlider";
49
50 public static final String COMPONENT_FAMILY = "javax.faces.Input";
51
52 private org.apache.myfaces.tobago.context.Markup currentMarkup;
53
54 enum PropertyKeys {
55 markup,
56 marginLeft,
57 minimumHeight,
58 height,
59 minimumWidth,
60 rowSpan,
61 left,
62 columnSpan,
63 maximumHeight,
64 top,
65 min,
66 currentWidth,
67 max,
68 marginTop,
69 width,
70 marginRight,
71 currentHeight,
72 preferredHeight,
73 display,
74 maximumWidth,
75 preferredWidth,
76 marginBottom,
77 verticalIndex,
78 horizontalIndex,
79 readonly,
80 disabled,
81 }
82
83 public String getFamily() {
84 return COMPONENT_FAMILY;
85 }
86
87
88 public org.apache.myfaces.tobago.context.Markup getMarkup() {
89 Object object = getStateHelper().eval(PropertyKeys.markup);
90 if (object != null) {
91 return Markup.valueOf(object);
92 }
93 return null;
94 }
95
96 public void setMarkup(org.apache.myfaces.tobago.context.Markup markup) {
97 getStateHelper().put(PropertyKeys.markup, markup);
98 }
99
100 public org.apache.myfaces.tobago.layout.Measure getMarginLeft() {
101 Object object = getStateHelper().eval(PropertyKeys.marginLeft);
102 if (object != null) {
103 return Measure.valueOf(object);
104 }
105 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginLeft(getFacesContext(), this);
106 }
107
108 public void setMarginLeft(org.apache.myfaces.tobago.layout.Measure marginLeft) {
109 getStateHelper().put(PropertyKeys.marginLeft, marginLeft);
110 }
111
112 public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
113 Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
114 if (object != null) {
115 return Measure.valueOf(object);
116 }
117 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this);
118 }
119
120 public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
121 getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
122 }
123
124
125
126
127
128 public org.apache.myfaces.tobago.layout.Measure getHeight() {
129 Object object = getStateHelper().eval(PropertyKeys.height);
130 if (object != null) {
131 return Measure.valueOf(object);
132 }
133 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this);
134 }
135
136 public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
137 getStateHelper().put(PropertyKeys.height, height);
138 }
139
140 public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
141 Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
142 if (object != null) {
143 return Measure.valueOf(object);
144 }
145 return ((LayoutComponentRenderer)getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this);
146 }
147
148 public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
149 getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
150 }
151
152 public java.lang.Integer getRowSpan() {
153 Number value = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
154 if (value != null) {
155 return value.intValue();
156 }
157 return 1;
158 }
159
160 public void setRowSpan(java.lang.Integer rowSpan) {
161 getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
162 }
163
164
165
166
167
168 public org.apache.myfaces.tobago.layout.Measure getLeft() {
169 Object object = getStateHelper().eval(PropertyKeys.left);
170 if (object != null) {
171 return Measure.valueOf(object);
172 }
173 return null;
174 }
175
176 public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
177 getStateHelper().put(PropertyKeys.left, left);
178 }
179
180 public java.lang.Integer getColumnSpan() {
181 Number value = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
182 if (value != null) {
183 return value.intValue();
184 }
185 return 1;
186 }
187
188 public void setColumnSpan(java.lang.Integer columnSpan) {
189 getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
190 }
191
192 public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
193 Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
194 if (object != null) {
195 return Measure.valueOf(object);
196 }
197 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this);
198 }
199
200 public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
201 getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
202 }
203
204
205
206
207
208 public org.apache.myfaces.tobago.layout.Measure getTop() {
209 Object object = getStateHelper().eval(PropertyKeys.top);
210 if (object != null) {
211 return Measure.valueOf(object);
212 }
213 return null;
214 }
215
216 public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
217 getStateHelper().put(PropertyKeys.top, top);
218 }
219
220
221
222
223
224
225 public java.lang.Integer getMin() {
226 Number value = (Number) getStateHelper().eval(PropertyKeys.min);
227 if (value != null) {
228 return value.intValue();
229 }
230 return 0;
231 }
232
233 public void setMin(java.lang.Integer min) {
234 getStateHelper().put(PropertyKeys.min, min);
235 }
236
237
238
239
240
241 public org.apache.myfaces.tobago.layout.Measure getCurrentWidth() {
242 Object object = getStateHelper().eval(PropertyKeys.currentWidth);
243 if (object != null) {
244 return Measure.valueOf(object);
245 }
246 return getWidth();
247 }
248
249 public void setCurrentWidth(org.apache.myfaces.tobago.layout.Measure currentWidth) {
250 getStateHelper().put(PropertyKeys.currentWidth, currentWidth);
251 }
252
253
254
255
256
257
258 public java.lang.Integer getMax() {
259 Number value = (Number) getStateHelper().eval(PropertyKeys.max);
260 if (value != null) {
261 return value.intValue();
262 }
263 return 100;
264 }
265
266 public void setMax(java.lang.Integer max) {
267 getStateHelper().put(PropertyKeys.max, max);
268 }
269
270 public org.apache.myfaces.tobago.layout.Measure getMarginTop() {
271 Object object = getStateHelper().eval(PropertyKeys.marginTop);
272 if (object != null) {
273 return Measure.valueOf(object);
274 }
275 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginTop(getFacesContext(), this);
276 }
277
278 public void setMarginTop(org.apache.myfaces.tobago.layout.Measure marginTop) {
279 getStateHelper().put(PropertyKeys.marginTop, marginTop);
280 }
281
282
283
284
285
286 public org.apache.myfaces.tobago.layout.Measure getWidth() {
287 Object object = getStateHelper().eval(PropertyKeys.width);
288 if (object != null) {
289 return Measure.valueOf(object);
290 }
291 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getWidth(getFacesContext(), this);
292 }
293
294 public void setWidth(org.apache.myfaces.tobago.layout.Measure width) {
295 getStateHelper().put(PropertyKeys.width, width);
296 }
297
298 public org.apache.myfaces.tobago.layout.Measure getMarginRight() {
299 Object object = getStateHelper().eval(PropertyKeys.marginRight);
300 if (object != null) {
301 return Measure.valueOf(object);
302 }
303 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginRight(getFacesContext(), this);
304 }
305
306 public void setMarginRight(org.apache.myfaces.tobago.layout.Measure marginRight) {
307 getStateHelper().put(PropertyKeys.marginRight, marginRight);
308 }
309
310
311
312
313
314 public org.apache.myfaces.tobago.layout.Measure getCurrentHeight() {
315 Object object = getStateHelper().eval(PropertyKeys.currentHeight);
316 if (object != null) {
317 return Measure.valueOf(object);
318 }
319 return getHeight();
320 }
321
322 public void setCurrentHeight(org.apache.myfaces.tobago.layout.Measure currentHeight) {
323 getStateHelper().put(PropertyKeys.currentHeight, currentHeight);
324 }
325
326 public org.apache.myfaces.tobago.layout.Measure getPreferredHeight() {
327 Object object = getStateHelper().eval(PropertyKeys.preferredHeight);
328 if (object != null) {
329 return Measure.valueOf(object);
330 }
331 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredHeight(getFacesContext(), this);
332 }
333
334 public void setPreferredHeight(org.apache.myfaces.tobago.layout.Measure preferredHeight) {
335 getStateHelper().put(PropertyKeys.preferredHeight, preferredHeight);
336 }
337
338
339
340
341
342 public org.apache.myfaces.tobago.layout.Display getDisplay() {
343 return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
344 }
345
346 public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
347 getStateHelper().put(PropertyKeys.display, display);
348 }
349
350 public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
351 Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
352 if (object != null) {
353 return Measure.valueOf(object);
354 }
355 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this);
356 }
357
358 public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
359 getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
360 }
361
362 public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
363 Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
364 if (object != null) {
365 return Measure.valueOf(object);
366 }
367 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this);
368 }
369
370 public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
371 getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
372 }
373
374 public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
375 Object object = getStateHelper().eval(PropertyKeys.marginBottom);
376 if (object != null) {
377 return Measure.valueOf(object);
378 }
379 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this);
380 }
381
382 public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
383 getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
384 }
385
386
387
388
389
390 public java.lang.Integer getVerticalIndex() {
391 Number value = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
392 if (value != null) {
393 return value.intValue();
394 }
395 return null;
396 }
397
398 public void setVerticalIndex(java.lang.Integer verticalIndex) {
399 getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
400 }
401
402 public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
403 if (currentMarkup != null) {
404 return currentMarkup;
405 }
406 return null;
407 }
408
409 public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
410 this.currentMarkup = currentMarkup;
411 }
412
413
414
415
416
417 public java.lang.Integer getHorizontalIndex() {
418 Number value = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
419 if (value != null) {
420 return value.intValue();
421 }
422 return null;
423 }
424
425 public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
426 getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
427 }
428
429
430
431
432
433 public boolean isReadonly() {
434 Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.readonly);
435 if (bool != null) {
436 return bool;
437 }
438 return false;
439 }
440
441 public void setReadonly(boolean readonly) {
442 getStateHelper().put(PropertyKeys.readonly, readonly);
443 }
444
445
446
447
448
449 public boolean isDisabled() {
450 Boolean bool = (Boolean) getStateHelper().eval(PropertyKeys.disabled);
451 if (bool != null) {
452 return bool;
453 }
454 return false;
455 }
456
457 public void setDisabled(boolean disabled) {
458 getStateHelper().put(PropertyKeys.disabled, disabled);
459 }
460
461 public Object saveState(FacesContext context) {
462 currentMarkup = null;
463 return super.saveState(context);
464 }
465
466
467 }