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