1 package org.rcfaces.core.component;
2
3 import org.rcfaces.core.component.capability.IPositionCapability;
4 import org.rcfaces.core.component.capability.IVisibilityCapability;
5 import org.rcfaces.core.internal.component.Properties;
6 import org.rcfaces.core.component.capability.ILayoutPositionCapability;
7 import java.lang.String;
8 import org.rcfaces.core.component.capability.IForegroundBackgroundColorCapability;
9 import org.rcfaces.core.component.capability.ILookAndFeelCapability;
10 import org.apache.commons.logging.LogFactory;
11 import org.rcfaces.core.component.capability.IHiddenModeCapability;
12 import javax.faces.context.FacesContext;
13 import org.rcfaces.core.internal.tools.MarginTools;
14 import org.rcfaces.core.internal.converter.AlignmentNormalizer;
15 import org.rcfaces.core.component.capability.IAlignmentCapability;
16 import org.rcfaces.core.internal.component.CameliaBaseComponent;
17 import javax.el.ValueExpression;
18 import org.rcfaces.core.component.capability.ISizeCapability;
19 import java.util.HashSet;
20 import org.apache.commons.logging.Log;
21 import java.util.Set;
22 import java.util.Arrays;
23 import org.rcfaces.core.internal.converter.HiddenModeConverter;
24 import org.rcfaces.core.component.capability.IOrientationCapability;
25 import org.rcfaces.core.component.capability.IMarginCapability;
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63 public class RulerComponent extends CameliaBaseComponent implements
64 IPositionCapability,
65 ILayoutPositionCapability,
66 IMarginCapability,
67 ISizeCapability,
68 IVisibilityCapability,
69 IHiddenModeCapability,
70 ILookAndFeelCapability,
71 IOrientationCapability,
72 IForegroundBackgroundColorCapability,
73 IAlignmentCapability {
74
75 private static final Log LOG = LogFactory.getLog(RulerComponent.class);
76
77 public static final String COMPONENT_TYPE="org.rcfaces.core.ruler";
78
79 protected static final Set CAMELIA_ATTRIBUTES=new HashSet(CameliaBaseComponent.CAMELIA_ATTRIBUTES);
80 static {
81 CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"alignment","orientation","lookId","visible","backgroundColor","marginLeft","marginTop","marginRight","width","rendered","marginBottom","height","hiddenMode","bottom","left","right","foregroundColor","y","margins","x","top"}));
82 }
83
84 public RulerComponent() {
85 setRendererType(COMPONENT_TYPE);
86 }
87
88 public RulerComponent(String componentId) {
89 this();
90 setId(componentId);
91 }
92
93 public void setMargins(String margins) {
94
95
96 MarginTools.setMargins(this, margins);
97
98 }
99
100 public void setHiddenMode(String hiddenMode) {
101
102
103 setHiddenMode(((Integer)HiddenModeConverter.SINGLETON.getAsObject(null, this, hiddenMode)).intValue());
104
105 }
106
107 public Boolean getVisibleState(FacesContext facesContext) {
108
109
110 if (engine.isPropertySetted(Properties.VISIBLE)==false) {
111 return null;
112 }
113
114 return Boolean.valueOf(isVisible(facesContext));
115
116 }
117
118 public java.lang.String getX() {
119 return getX(null);
120 }
121
122
123
124
125 public java.lang.String getX(javax.faces.context.FacesContext facesContext) {
126 return engine.getStringProperty(Properties.X, facesContext);
127 }
128
129
130
131
132
133 public final boolean isXSetted() {
134 return engine.isPropertySetted(Properties.X);
135 }
136
137 public void setX(java.lang.String x) {
138 engine.setProperty(Properties.X, x);
139 }
140
141 public java.lang.String getY() {
142 return getY(null);
143 }
144
145
146
147
148 public java.lang.String getY(javax.faces.context.FacesContext facesContext) {
149 return engine.getStringProperty(Properties.Y, facesContext);
150 }
151
152
153
154
155
156 public final boolean isYSetted() {
157 return engine.isPropertySetted(Properties.Y);
158 }
159
160 public void setY(java.lang.String y) {
161 engine.setProperty(Properties.Y, y);
162 }
163
164 public int getBottom() {
165 return getBottom(null);
166 }
167
168
169
170
171 public int getBottom(javax.faces.context.FacesContext facesContext) {
172 return engine.getIntProperty(Properties.BOTTOM,0, facesContext);
173 }
174
175
176
177
178
179 public final boolean isBottomSetted() {
180 return engine.isPropertySetted(Properties.BOTTOM);
181 }
182
183 public void setBottom(int bottom) {
184 engine.setProperty(Properties.BOTTOM, bottom);
185 }
186
187 public int getLeft() {
188 return getLeft(null);
189 }
190
191
192
193
194 public int getLeft(javax.faces.context.FacesContext facesContext) {
195 return engine.getIntProperty(Properties.LEFT,0, facesContext);
196 }
197
198
199
200
201
202 public final boolean isLeftSetted() {
203 return engine.isPropertySetted(Properties.LEFT);
204 }
205
206 public void setLeft(int left) {
207 engine.setProperty(Properties.LEFT, left);
208 }
209
210 public int getRight() {
211 return getRight(null);
212 }
213
214
215
216
217 public int getRight(javax.faces.context.FacesContext facesContext) {
218 return engine.getIntProperty(Properties.RIGHT,0, facesContext);
219 }
220
221
222
223
224
225 public final boolean isRightSetted() {
226 return engine.isPropertySetted(Properties.RIGHT);
227 }
228
229 public void setRight(int right) {
230 engine.setProperty(Properties.RIGHT, right);
231 }
232
233 public int getTop() {
234 return getTop(null);
235 }
236
237
238
239
240 public int getTop(javax.faces.context.FacesContext facesContext) {
241 return engine.getIntProperty(Properties.TOP,0, facesContext);
242 }
243
244
245
246
247
248 public final boolean isTopSetted() {
249 return engine.isPropertySetted(Properties.TOP);
250 }
251
252 public void setTop(int top) {
253 engine.setProperty(Properties.TOP, top);
254 }
255
256 public java.lang.String getMarginBottom() {
257 return getMarginBottom(null);
258 }
259
260
261
262
263 public java.lang.String getMarginBottom(javax.faces.context.FacesContext facesContext) {
264 return engine.getStringProperty(Properties.MARGIN_BOTTOM, facesContext);
265 }
266
267
268
269
270
271 public final boolean isMarginBottomSetted() {
272 return engine.isPropertySetted(Properties.MARGIN_BOTTOM);
273 }
274
275 public void setMarginBottom(java.lang.String marginBottom) {
276 engine.setProperty(Properties.MARGIN_BOTTOM, marginBottom);
277 }
278
279 public java.lang.String getMarginLeft() {
280 return getMarginLeft(null);
281 }
282
283
284
285
286 public java.lang.String getMarginLeft(javax.faces.context.FacesContext facesContext) {
287 return engine.getStringProperty(Properties.MARGIN_LEFT, facesContext);
288 }
289
290
291
292
293
294 public final boolean isMarginLeftSetted() {
295 return engine.isPropertySetted(Properties.MARGIN_LEFT);
296 }
297
298 public void setMarginLeft(java.lang.String marginLeft) {
299 engine.setProperty(Properties.MARGIN_LEFT, marginLeft);
300 }
301
302 public java.lang.String getMarginRight() {
303 return getMarginRight(null);
304 }
305
306
307
308
309 public java.lang.String getMarginRight(javax.faces.context.FacesContext facesContext) {
310 return engine.getStringProperty(Properties.MARGIN_RIGHT, facesContext);
311 }
312
313
314
315
316
317 public final boolean isMarginRightSetted() {
318 return engine.isPropertySetted(Properties.MARGIN_RIGHT);
319 }
320
321 public void setMarginRight(java.lang.String marginRight) {
322 engine.setProperty(Properties.MARGIN_RIGHT, marginRight);
323 }
324
325 public java.lang.String getMarginTop() {
326 return getMarginTop(null);
327 }
328
329
330
331
332 public java.lang.String getMarginTop(javax.faces.context.FacesContext facesContext) {
333 return engine.getStringProperty(Properties.MARGIN_TOP, facesContext);
334 }
335
336
337
338
339
340 public final boolean isMarginTopSetted() {
341 return engine.isPropertySetted(Properties.MARGIN_TOP);
342 }
343
344 public void setMarginTop(java.lang.String marginTop) {
345 engine.setProperty(Properties.MARGIN_TOP, marginTop);
346 }
347
348 public java.lang.String getWidth() {
349 return getWidth(null);
350 }
351
352
353
354
355 public java.lang.String getWidth(javax.faces.context.FacesContext facesContext) {
356 return engine.getStringProperty(Properties.WIDTH, facesContext);
357 }
358
359
360
361
362
363 public final boolean isWidthSetted() {
364 return engine.isPropertySetted(Properties.WIDTH);
365 }
366
367 public void setWidth(java.lang.String width) {
368 engine.setProperty(Properties.WIDTH, width);
369 }
370
371 public java.lang.String getHeight() {
372 return getHeight(null);
373 }
374
375
376
377
378 public java.lang.String getHeight(javax.faces.context.FacesContext facesContext) {
379 return engine.getStringProperty(Properties.HEIGHT, facesContext);
380 }
381
382
383
384
385
386 public final boolean isHeightSetted() {
387 return engine.isPropertySetted(Properties.HEIGHT);
388 }
389
390 public void setHeight(java.lang.String height) {
391 engine.setProperty(Properties.HEIGHT, height);
392 }
393
394 public boolean isVisible() {
395 return isVisible(null);
396 }
397
398
399
400
401 public boolean isVisible(javax.faces.context.FacesContext facesContext) {
402 return engine.getBoolProperty(Properties.VISIBLE, true, facesContext);
403 }
404
405
406
407
408
409 public final boolean isVisibleSetted() {
410 return engine.isPropertySetted(Properties.VISIBLE);
411 }
412
413 public void setVisible(boolean visible) {
414 engine.setProperty(Properties.VISIBLE, visible);
415 }
416
417 public Boolean getVisibleState() {
418
419
420 return getVisibleState(null);
421
422 }
423
424 public int getHiddenMode() {
425 return getHiddenMode(null);
426 }
427
428
429
430
431 public int getHiddenMode(javax.faces.context.FacesContext facesContext) {
432 return engine.getIntProperty(Properties.HIDDEN_MODE,IHiddenModeCapability.DEFAULT_HIDDEN_MODE, facesContext);
433 }
434
435
436
437
438
439 public final boolean isHiddenModeSetted() {
440 return engine.isPropertySetted(Properties.HIDDEN_MODE);
441 }
442
443 public void setHiddenMode(int hiddenMode) {
444 engine.setProperty(Properties.HIDDEN_MODE, hiddenMode);
445 }
446
447 public java.lang.String getLookId() {
448 return getLookId(null);
449 }
450
451
452
453
454 public java.lang.String getLookId(javax.faces.context.FacesContext facesContext) {
455 return engine.getStringProperty(Properties.LOOK_ID, facesContext);
456 }
457
458
459
460
461
462 public final boolean isLookIdSetted() {
463 return engine.isPropertySetted(Properties.LOOK_ID);
464 }
465
466 public void setLookId(java.lang.String lookId) {
467 engine.setProperty(Properties.LOOK_ID, lookId);
468 }
469
470 public java.lang.String getOrientation() {
471 return getOrientation(null);
472 }
473
474
475
476
477 public java.lang.String getOrientation(javax.faces.context.FacesContext facesContext) {
478 return engine.getStringProperty(Properties.ORIENTATION, facesContext);
479 }
480
481
482
483
484
485 public final boolean isOrientationSetted() {
486 return engine.isPropertySetted(Properties.ORIENTATION);
487 }
488
489 public void setOrientation(java.lang.String orientation) {
490 engine.setProperty(Properties.ORIENTATION, orientation);
491 }
492
493 public java.lang.String getBackgroundColor() {
494 return getBackgroundColor(null);
495 }
496
497
498
499
500 public java.lang.String getBackgroundColor(javax.faces.context.FacesContext facesContext) {
501 return engine.getStringProperty(Properties.BACKGROUND_COLOR, facesContext);
502 }
503
504
505
506
507
508 public final boolean isBackgroundColorSetted() {
509 return engine.isPropertySetted(Properties.BACKGROUND_COLOR);
510 }
511
512 public void setBackgroundColor(java.lang.String backgroundColor) {
513 engine.setProperty(Properties.BACKGROUND_COLOR, backgroundColor);
514 }
515
516 public java.lang.String getForegroundColor() {
517 return getForegroundColor(null);
518 }
519
520
521
522
523 public java.lang.String getForegroundColor(javax.faces.context.FacesContext facesContext) {
524 return engine.getStringProperty(Properties.FOREGROUND_COLOR, facesContext);
525 }
526
527
528
529
530
531 public final boolean isForegroundColorSetted() {
532 return engine.isPropertySetted(Properties.FOREGROUND_COLOR);
533 }
534
535 public void setForegroundColor(java.lang.String foregroundColor) {
536 engine.setProperty(Properties.FOREGROUND_COLOR, foregroundColor);
537 }
538
539 public java.lang.String getAlignment() {
540 return getAlignment(null);
541 }
542
543
544
545
546 public java.lang.String getAlignment(javax.faces.context.FacesContext facesContext) {
547 return engine.getStringProperty(Properties.ALIGNMENT, facesContext);
548 }
549
550
551
552
553
554 public final boolean isAlignmentSetted() {
555 return engine.isPropertySetted(Properties.ALIGNMENT);
556 }
557
558 public void setAlignment(String alignment) {
559
560
561 engine.setProperty(Properties.ALIGNMENT, AlignmentNormalizer.normalize(alignment));
562
563 }
564
565 protected Set getCameliaFields() {
566 return CAMELIA_ATTRIBUTES;
567 }
568 }