1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.apache.myfaces.trinidad.component.core.layout;
23
24 import java.util.Arrays;
25 import java.util.Collection;
26 import java.util.Collections;
27 import java.util.List;
28 import java.util.Map;
29 import javax.faces.component.UIComponent;
30 import javax.faces.component.behavior.ClientBehavior;
31 import javax.faces.component.behavior.ClientBehaviorHolder;
32 import org.apache.myfaces.trinidad.bean.FacesBean;
33 import org.apache.myfaces.trinidad.bean.PropertyKey;
34 import org.apache.myfaces.trinidad.component.UIXPanel;
35 import org.apache.myfaces.trinidad.util.ComponentUtils;
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
64
65
66
67
68
69
70
71
72
73
74
75
76 public class CorePanelPopup extends UIXPanel
77 implements ClientBehaviorHolder
78 {
79 static public final String TRIGGER_TYPE_CLICK = "click";
80 static public final String TRIGGER_TYPE_HOVER = "hover";
81 static public final String POSITION_RELATIVE = "relative";
82 static public final String POSITION_CENTERED = "centered";
83 static public final FacesBean.Type TYPE = new FacesBean.Type(
84 UIXPanel.TYPE);
85 static public final PropertyKey INLINE_STYLE_KEY =
86 TYPE.registerKey("inlineStyle", String.class);
87 static public final PropertyKey STYLE_CLASS_KEY =
88 TYPE.registerKey("styleClass", String.class);
89 static public final PropertyKey SHORT_DESC_KEY =
90 TYPE.registerKey("shortDesc", String.class);
91 static public final PropertyKey PARTIAL_TRIGGERS_KEY =
92 TYPE.registerKey("partialTriggers", String[].class);
93 static public final PropertyKey ONCLICK_KEY =
94 TYPE.registerKey("onclick", String.class);
95 static public final PropertyKey ONDBLCLICK_KEY =
96 TYPE.registerKey("ondblclick", String.class);
97 static public final PropertyKey ONMOUSEDOWN_KEY =
98 TYPE.registerKey("onmousedown", String.class);
99 static public final PropertyKey ONMOUSEUP_KEY =
100 TYPE.registerKey("onmouseup", String.class);
101 static public final PropertyKey ONMOUSEOVER_KEY =
102 TYPE.registerKey("onmouseover", String.class);
103 static public final PropertyKey ONMOUSEMOVE_KEY =
104 TYPE.registerKey("onmousemove", String.class);
105 static public final PropertyKey ONMOUSEOUT_KEY =
106 TYPE.registerKey("onmouseout", String.class);
107 static public final PropertyKey ONKEYPRESS_KEY =
108 TYPE.registerKey("onkeypress", String.class);
109 static public final PropertyKey ONKEYDOWN_KEY =
110 TYPE.registerKey("onkeydown", String.class);
111 static public final PropertyKey ONKEYUP_KEY =
112 TYPE.registerKey("onkeyup", String.class);
113 static public final PropertyKey TRIGGER_TYPE_KEY =
114 TYPE.registerKey("triggerType", String.class, "click");
115 static public final PropertyKey ICON_KEY =
116 TYPE.registerKey("icon", String.class);
117 static public final PropertyKey TEXT_KEY =
118 TYPE.registerKey("text", String.class);
119 static public final PropertyKey TITLE_KEY =
120 TYPE.registerKey("title", String.class);
121 static public final PropertyKey MODAL_KEY =
122 TYPE.registerKey("modal", Boolean.class, Boolean.FALSE);
123 static public final PropertyKey POSITION_KEY =
124 TYPE.registerKey("position", String.class, "relative");
125 static public final PropertyKey XOFFSET_KEY =
126 TYPE.registerKey("xoffset", Integer.class, Integer.valueOf(0));
127 static public final PropertyKey YOFFSET_KEY =
128 TYPE.registerKey("yoffset", Integer.class, Integer.valueOf(0));
129 static public final PropertyKey CONTENT_STYLE_KEY =
130 TYPE.registerKey("contentStyle", String.class);
131 static public final PropertyKey WIDTH_KEY =
132 TYPE.registerKey("width", Integer.class, Integer.valueOf(0));
133 static public final PropertyKey HEIGHT_KEY =
134 TYPE.registerKey("height", Integer.class, Integer.valueOf(0));
135 static public final String TRIGGER_FACET = "trigger";
136
137 static public final String COMPONENT_FAMILY =
138 "org.apache.myfaces.trinidad.Panel";
139 static public final String COMPONENT_TYPE =
140 "org.apache.myfaces.trinidad.CorePanelPopup";
141
142 private final static Collection<String> _EVENT_NAMES = Collections.unmodifiableCollection(
143 Arrays.asList(
144 "click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove",
145 "mouseout", "keypress", "keydown", "keyup"
146 ));
147
148
149
150
151 public CorePanelPopup()
152 {
153 super("org.apache.myfaces.trinidad.Popup");
154 }
155
156
157
158
159
160
161 final public UIComponent getTrigger()
162 {
163 return getFacet(TRIGGER_FACET);
164 }
165
166
167
168
169
170
171 @SuppressWarnings("unchecked")
172 final public void setTrigger(UIComponent triggerFacet)
173 {
174 getFacets().put(TRIGGER_FACET, triggerFacet);
175 }
176
177
178
179
180
181
182 final public String getInlineStyle()
183 {
184 return ComponentUtils.resolveString(getProperty(INLINE_STYLE_KEY));
185 }
186
187
188
189
190
191
192 final public void setInlineStyle(String inlineStyle)
193 {
194 setProperty(INLINE_STYLE_KEY, (inlineStyle));
195 }
196
197
198
199
200
201
202 final public String getStyleClass()
203 {
204 return ComponentUtils.resolveString(getProperty(STYLE_CLASS_KEY));
205 }
206
207
208
209
210
211
212 final public void setStyleClass(String styleClass)
213 {
214 setProperty(STYLE_CLASS_KEY, (styleClass));
215 }
216
217
218
219
220
221
222 final public String getShortDesc()
223 {
224 return ComponentUtils.resolveString(getProperty(SHORT_DESC_KEY));
225 }
226
227
228
229
230
231
232 final public void setShortDesc(String shortDesc)
233 {
234 setProperty(SHORT_DESC_KEY, (shortDesc));
235 }
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257 final public String[] getPartialTriggers()
258 {
259 return (String[])getProperty(PARTIAL_TRIGGERS_KEY);
260 }
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282 final public void setPartialTriggers(String[] partialTriggers)
283 {
284 setProperty(PARTIAL_TRIGGERS_KEY, (partialTriggers));
285 }
286
287
288
289
290
291
292 final public String getOnclick()
293 {
294 return ComponentUtils.resolveString(getProperty(ONCLICK_KEY));
295 }
296
297
298
299
300
301
302 final public void setOnclick(String onclick)
303 {
304 setProperty(ONCLICK_KEY, (onclick));
305 }
306
307
308
309
310
311
312 final public String getOndblclick()
313 {
314 return ComponentUtils.resolveString(getProperty(ONDBLCLICK_KEY));
315 }
316
317
318
319
320
321
322 final public void setOndblclick(String ondblclick)
323 {
324 setProperty(ONDBLCLICK_KEY, (ondblclick));
325 }
326
327
328
329
330
331
332 final public String getOnmousedown()
333 {
334 return ComponentUtils.resolveString(getProperty(ONMOUSEDOWN_KEY));
335 }
336
337
338
339
340
341
342 final public void setOnmousedown(String onmousedown)
343 {
344 setProperty(ONMOUSEDOWN_KEY, (onmousedown));
345 }
346
347
348
349
350
351
352 final public String getOnmouseup()
353 {
354 return ComponentUtils.resolveString(getProperty(ONMOUSEUP_KEY));
355 }
356
357
358
359
360
361
362 final public void setOnmouseup(String onmouseup)
363 {
364 setProperty(ONMOUSEUP_KEY, (onmouseup));
365 }
366
367
368
369
370
371
372 final public String getOnmouseover()
373 {
374 return ComponentUtils.resolveString(getProperty(ONMOUSEOVER_KEY));
375 }
376
377
378
379
380
381
382 final public void setOnmouseover(String onmouseover)
383 {
384 setProperty(ONMOUSEOVER_KEY, (onmouseover));
385 }
386
387
388
389
390
391
392 final public String getOnmousemove()
393 {
394 return ComponentUtils.resolveString(getProperty(ONMOUSEMOVE_KEY));
395 }
396
397
398
399
400
401
402 final public void setOnmousemove(String onmousemove)
403 {
404 setProperty(ONMOUSEMOVE_KEY, (onmousemove));
405 }
406
407
408
409
410
411
412 final public String getOnmouseout()
413 {
414 return ComponentUtils.resolveString(getProperty(ONMOUSEOUT_KEY));
415 }
416
417
418
419
420
421
422 final public void setOnmouseout(String onmouseout)
423 {
424 setProperty(ONMOUSEOUT_KEY, (onmouseout));
425 }
426
427
428
429
430
431
432 final public String getOnkeypress()
433 {
434 return ComponentUtils.resolveString(getProperty(ONKEYPRESS_KEY));
435 }
436
437
438
439
440
441
442 final public void setOnkeypress(String onkeypress)
443 {
444 setProperty(ONKEYPRESS_KEY, (onkeypress));
445 }
446
447
448
449
450
451
452 final public String getOnkeydown()
453 {
454 return ComponentUtils.resolveString(getProperty(ONKEYDOWN_KEY));
455 }
456
457
458
459
460
461
462 final public void setOnkeydown(String onkeydown)
463 {
464 setProperty(ONKEYDOWN_KEY, (onkeydown));
465 }
466
467
468
469
470
471
472 final public String getOnkeyup()
473 {
474 return ComponentUtils.resolveString(getProperty(ONKEYUP_KEY));
475 }
476
477
478
479
480
481
482 final public void setOnkeyup(String onkeyup)
483 {
484 setProperty(ONKEYUP_KEY, (onkeyup));
485 }
486
487
488
489
490
491
492
493
494
495 final public String getTriggerType()
496 {
497 return ComponentUtils.resolveString(getProperty(TRIGGER_TYPE_KEY), "click");
498 }
499
500
501
502
503
504
505
506
507
508 final public void setTriggerType(String triggerType)
509 {
510 setProperty(TRIGGER_TYPE_KEY, (triggerType));
511 }
512
513
514
515
516
517
518
519
520 final public String getIcon()
521 {
522 return ComponentUtils.resolveString(getProperty(ICON_KEY));
523 }
524
525
526
527
528
529
530
531
532 final public void setIcon(String icon)
533 {
534 setProperty(ICON_KEY, (icon));
535 }
536
537
538
539
540
541
542
543 final public String getText()
544 {
545 return ComponentUtils.resolveString(getProperty(TEXT_KEY));
546 }
547
548
549
550
551
552
553
554 final public void setText(String text)
555 {
556 setProperty(TEXT_KEY, (text));
557 }
558
559
560
561
562
563
564
565 final public String getTitle()
566 {
567 return ComponentUtils.resolveString(getProperty(TITLE_KEY));
568 }
569
570
571
572
573
574
575
576 final public void setTitle(String title)
577 {
578 setProperty(TITLE_KEY, (title));
579 }
580
581
582
583
584
585
586
587
588
589 final public boolean isModal()
590 {
591 return ComponentUtils.resolveBoolean(getProperty(MODAL_KEY), false);
592 }
593
594
595
596
597
598
599
600
601
602 final public void setModal(boolean modal)
603 {
604 setProperty(MODAL_KEY, modal ? Boolean.TRUE : Boolean.FALSE);
605 }
606
607
608
609
610
611
612
613 final public String getPosition()
614 {
615 return ComponentUtils.resolveString(getProperty(POSITION_KEY), "relative");
616 }
617
618
619
620
621
622
623
624 final public void setPosition(String position)
625 {
626 setProperty(POSITION_KEY, (position));
627 }
628
629
630
631
632
633
634
635 final public int getXoffset()
636 {
637 return ComponentUtils.resolveInteger(getProperty(XOFFSET_KEY), 0);
638 }
639
640
641
642
643
644
645
646 final public void setXoffset(int xoffset)
647 {
648 setProperty(XOFFSET_KEY, Integer.valueOf(xoffset));
649 }
650
651
652
653
654
655
656
657 final public int getYoffset()
658 {
659 return ComponentUtils.resolveInteger(getProperty(YOFFSET_KEY), 0);
660 }
661
662
663
664
665
666
667
668 final public void setYoffset(int yoffset)
669 {
670 setProperty(YOFFSET_KEY, Integer.valueOf(yoffset));
671 }
672
673
674
675
676
677
678 final public String getContentStyle()
679 {
680 return ComponentUtils.resolveString(getProperty(CONTENT_STYLE_KEY));
681 }
682
683
684
685
686
687
688 final public void setContentStyle(String contentStyle)
689 {
690 setProperty(CONTENT_STYLE_KEY, (contentStyle));
691 }
692
693
694
695
696
697
698 final public int getWidth()
699 {
700 return ComponentUtils.resolveInteger(getProperty(WIDTH_KEY), 0);
701 }
702
703
704
705
706
707
708 final public void setWidth(int width)
709 {
710 setProperty(WIDTH_KEY, Integer.valueOf(width));
711 }
712
713
714
715
716
717
718 final public int getHeight()
719 {
720 return ComponentUtils.resolveInteger(getProperty(HEIGHT_KEY), 0);
721 }
722
723
724
725
726
727
728 final public void setHeight(int height)
729 {
730 setProperty(HEIGHT_KEY, Integer.valueOf(height));
731 }
732
733 @Override
734 public String getDefaultEventName()
735 {
736 return "click";
737 }
738
739 @Override
740 public Collection<String> getEventNames()
741 {
742 return _EVENT_NAMES;
743 }
744
745 @Override
746 public Map<String, List<ClientBehavior>> getClientBehaviors()
747 {
748 return super.getClientBehaviors();
749 }
750
751 @Override
752 public void addClientBehavior(
753 String eventName,
754 ClientBehavior behavior)
755 {
756 super.addClientBehavior(eventName, behavior);
757 }
758
759 @Override
760 public String getFamily()
761 {
762 return COMPONENT_FAMILY;
763 }
764
765 @Override
766 protected FacesBean.Type getBeanType()
767 {
768 return TYPE;
769 }
770
771
772
773
774 protected CorePanelPopup(
775 String rendererType
776 )
777 {
778 super(rendererType);
779 }
780
781 static
782 {
783 TYPE.lockAndRegister("org.apache.myfaces.trinidad.Panel","org.apache.myfaces.trinidad.Popup");
784 }
785 }