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.AbstractUISeparator;
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 UISeparator
46 extends AbstractUISeparator implements SupportsMarkup {
47
48 public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Separator";
49
50 public static final String COMPONENT_FAMILY = "org.apache.myfaces.tobago.Separator";
51
52 private org.apache.myfaces.tobago.context.Markup currentMarkup;
53
54 enum PropertyKeys {
55 currentWidth,
56 markup,
57 marginLeft,
58 marginTop,
59 width,
60 marginRight,
61 currentHeight,
62 preferredHeight,
63 label,
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
198 public java.lang.String getLabel() {
199 return (java.lang.String) getStateHelper().eval(PropertyKeys.label);
200 }
201
202 public void setLabel(java.lang.String label) {
203 getStateHelper().put(PropertyKeys.label, label);
204 }
205
206
207
208
209
210 public org.apache.myfaces.tobago.layout.Display getDisplay() {
211 return (org.apache.myfaces.tobago.layout.Display) getStateHelper().eval(PropertyKeys.display);
212 }
213
214 public void setDisplay(org.apache.myfaces.tobago.layout.Display display) {
215 getStateHelper().put(PropertyKeys.display, display);
216 }
217
218 public org.apache.myfaces.tobago.layout.Measure getMinimumHeight() {
219 Object object = getStateHelper().eval(PropertyKeys.minimumHeight);
220 if (object != null) {
221 return Measure.valueOf(object);
222 }
223 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMinimumHeight(getFacesContext(), this);
224 }
225
226 public void setMinimumHeight(org.apache.myfaces.tobago.layout.Measure minimumHeight) {
227 getStateHelper().put(PropertyKeys.minimumHeight, minimumHeight);
228 }
229
230 public org.apache.myfaces.tobago.layout.Measure getMaximumWidth() {
231 Object object = getStateHelper().eval(PropertyKeys.maximumWidth);
232 if (object != null) {
233 return Measure.valueOf(object);
234 }
235 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumWidth(getFacesContext(), this);
236 }
237
238 public void setMaximumWidth(org.apache.myfaces.tobago.layout.Measure maximumWidth) {
239 getStateHelper().put(PropertyKeys.maximumWidth, maximumWidth);
240 }
241
242 public org.apache.myfaces.tobago.layout.Measure getPreferredWidth() {
243 Object object = getStateHelper().eval(PropertyKeys.preferredWidth);
244 if (object != null) {
245 return Measure.valueOf(object);
246 }
247 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getPreferredWidth(getFacesContext(), this);
248 }
249
250 public void setPreferredWidth(org.apache.myfaces.tobago.layout.Measure preferredWidth) {
251 getStateHelper().put(PropertyKeys.preferredWidth, preferredWidth);
252 }
253
254 public org.apache.myfaces.tobago.layout.Measure getMarginBottom() {
255 Object object = getStateHelper().eval(PropertyKeys.marginBottom);
256 if (object != null) {
257 return Measure.valueOf(object);
258 }
259 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMarginBottom(getFacesContext(), this);
260 }
261
262 public void setMarginBottom(org.apache.myfaces.tobago.layout.Measure marginBottom) {
263 getStateHelper().put(PropertyKeys.marginBottom, marginBottom);
264 }
265
266
267
268
269
270 public org.apache.myfaces.tobago.layout.Measure getHeight() {
271 Object object = getStateHelper().eval(PropertyKeys.height);
272 if (object != null) {
273 return Measure.valueOf(object);
274 }
275 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getHeight(getFacesContext(), this);
276 }
277
278 public void setHeight(org.apache.myfaces.tobago.layout.Measure height) {
279 getStateHelper().put(PropertyKeys.height, height);
280 }
281
282
283
284
285
286 public java.lang.Integer getVerticalIndex() {
287 Number value = (Number) getStateHelper().eval(PropertyKeys.verticalIndex);
288 if (value != null) {
289 return value.intValue();
290 }
291 return null;
292 }
293
294 public void setVerticalIndex(java.lang.Integer verticalIndex) {
295 getStateHelper().put(PropertyKeys.verticalIndex, verticalIndex);
296 }
297
298 public org.apache.myfaces.tobago.layout.Measure getMinimumWidth() {
299 Object object = getStateHelper().eval(PropertyKeys.minimumWidth);
300 if (object != null) {
301 return Measure.valueOf(object);
302 }
303 return ((LayoutComponentRenderer)getRenderer(getFacesContext())).getMinimumWidth(getFacesContext(), this);
304 }
305
306 public void setMinimumWidth(org.apache.myfaces.tobago.layout.Measure minimumWidth) {
307 getStateHelper().put(PropertyKeys.minimumWidth, minimumWidth);
308 }
309
310 public org.apache.myfaces.tobago.context.Markup getCurrentMarkup() {
311 if (currentMarkup != null) {
312 return currentMarkup;
313 }
314 return null;
315 }
316
317 public void setCurrentMarkup(org.apache.myfaces.tobago.context.Markup currentMarkup) {
318 this.currentMarkup = currentMarkup;
319 }
320
321 public java.lang.Integer getRowSpan() {
322 Number value = (Number) getStateHelper().eval(PropertyKeys.rowSpan);
323 if (value != null) {
324 return value.intValue();
325 }
326 return 1;
327 }
328
329 public void setRowSpan(java.lang.Integer rowSpan) {
330 getStateHelper().put(PropertyKeys.rowSpan, rowSpan);
331 }
332
333
334
335
336
337 public java.lang.Integer getHorizontalIndex() {
338 Number value = (Number) getStateHelper().eval(PropertyKeys.horizontalIndex);
339 if (value != null) {
340 return value.intValue();
341 }
342 return null;
343 }
344
345 public void setHorizontalIndex(java.lang.Integer horizontalIndex) {
346 getStateHelper().put(PropertyKeys.horizontalIndex, horizontalIndex);
347 }
348
349
350
351
352
353 public org.apache.myfaces.tobago.layout.Measure getLeft() {
354 Object object = getStateHelper().eval(PropertyKeys.left);
355 if (object != null) {
356 return Measure.valueOf(object);
357 }
358 return null;
359 }
360
361 public void setLeft(org.apache.myfaces.tobago.layout.Measure left) {
362 getStateHelper().put(PropertyKeys.left, left);
363 }
364
365 public java.lang.Integer getColumnSpan() {
366 Number value = (Number) getStateHelper().eval(PropertyKeys.columnSpan);
367 if (value != null) {
368 return value.intValue();
369 }
370 return 1;
371 }
372
373 public void setColumnSpan(java.lang.Integer columnSpan) {
374 getStateHelper().put(PropertyKeys.columnSpan, columnSpan);
375 }
376
377
378
379
380
381 public org.apache.myfaces.tobago.layout.Measure getTop() {
382 Object object = getStateHelper().eval(PropertyKeys.top);
383 if (object != null) {
384 return Measure.valueOf(object);
385 }
386 return null;
387 }
388
389 public void setTop(org.apache.myfaces.tobago.layout.Measure top) {
390 getStateHelper().put(PropertyKeys.top, top);
391 }
392
393 public org.apache.myfaces.tobago.layout.Measure getMaximumHeight() {
394 Object object = getStateHelper().eval(PropertyKeys.maximumHeight);
395 if (object != null) {
396 return Measure.valueOf(object);
397 }
398 return ((LayoutComponentRenderer) getRenderer(getFacesContext())).getMaximumHeight(getFacesContext(), this);
399 }
400
401 public void setMaximumHeight(org.apache.myfaces.tobago.layout.Measure maximumHeight) {
402 getStateHelper().put(PropertyKeys.maximumHeight, maximumHeight);
403 }
404
405 public Object saveState(FacesContext context) {
406 currentMarkup = null;
407 return super.saveState(context);
408 }
409
410
411 }