View Javadoc
1   package org.andromda.cartridges.jsf.component.html;
2   
3   import javax.faces.component.UICommand;
4   import javax.faces.component.UIComponent;
5   import javax.faces.context.FacesContext;
6   import javax.faces.el.MethodBinding;
7   import javax.faces.el.ValueBinding;
8   import javax.faces.event.ActionEvent;
9   import javax.faces.event.FacesEvent;
10  import javax.faces.event.PhaseId;
11  
12  /**
13   *
14   */
15  public class HtmlPopupFrame
16      extends UICommand
17  {
18      /**
19       * org.andromda.cartridges.jsf.HtmlPopupFrame
20       */
21      public static final String COMPONENT_TYPE = "org.andromda.cartridges.jsf.HtmlPopupFrame";
22      /**
23       * org.andromda.cartridges.jsf.Popup
24       */
25      public static final String RENDERER_TYPE = "org.andromda.cartridges.jsf.Popup";
26      private MethodBinding actionOpen;
27      private MethodBinding actionClose;
28      private String immediate;
29      private String accesskey;
30      private String dir;
31      private String lang;
32      private String tabindex;
33      private String title;
34      private String mouseHorizPos;
35      private String mouseVertPos;
36      private String style;
37      private String styleClass;
38      private String styleFrame;
39      private String styleClassFrame;
40      private String absolute;
41      private String center;
42      private String height;
43      private String width;
44      private String scrolling;
45  
46      /**
47       *
48       */
49      public HtmlPopupFrame()
50      {
51          super();
52          setRendererType(RENDERER_TYPE);
53      }
54  
55      /**
56       * @return accesskey
57       */
58      public String getAccesskey()
59      {
60          if (null != this.accesskey)
61          {
62              return this.accesskey;
63          }
64          final ValueBinding binding = getValueBinding("accesskey");
65          if (binding != null)
66          {
67              return (String)binding.getValue(getFacesContext());
68          }
69          return null;
70      }
71  
72      /**
73       * Returns the component's family. In this case, the component is not
74       * associated with a family, so this method returns null.
75       * @return RENDERER_TYPE
76       */
77      public String getFamily()
78      {
79          return RENDERER_TYPE;
80      }
81  
82      /**
83       * @param accesskey
84       */
85      public void setAccesskey(String accesskey)
86      {
87          this.accesskey = accesskey;
88      }
89  
90      /**
91       * @return getValueBinding("dir").getValue(getFacesContext()
92       */
93      public String getDir()
94      {
95          if (null != this.dir)
96          {
97              return this.dir;
98          }
99          ValueBinding binding = getValueBinding("dir");
100         if (binding != null)
101         {
102             return (String)binding.getValue(getFacesContext());
103         }
104         return null;
105     }
106 
107     /**
108      * @param dir
109      */
110     public void setDir(String dir)
111     {
112         this.dir = dir;
113     }
114 
115     /**
116      * @return lang
117      */
118     public String getLang()
119     {
120         if (null != this.lang)
121         {
122             return this.lang;
123         }
124         final ValueBinding binding = getValueBinding("lang");
125         if (binding != null)
126         {
127             return (String)binding.getValue(getFacesContext());
128         }
129         return null;
130     }
131 
132     /**
133      * @param lang
134      */
135     public void setLang(String lang)
136     {
137         this.lang = lang;
138     }
139 
140     /**
141      * @return tabindex
142      */
143     public String getTabindex()
144     {
145         if (null != this.tabindex)
146         {
147             return this.tabindex;
148         }
149         ValueBinding binding = getValueBinding("tabindex");
150         if (binding != null)
151         {
152             return (String)binding.getValue(getFacesContext());
153         }
154 
155         return null;
156     }
157 
158     /**
159      * @param tabindex
160      */
161     public void setTabindex(String tabindex)
162     {
163         this.tabindex = tabindex;
164     }
165 
166     /**
167      * @return title
168      */
169     public String getTitle()
170     {
171         if (null != this.title)
172         {
173             return this.title;
174         }
175         ValueBinding binding = getValueBinding("title");
176         if (binding != null)
177         {
178             return (String)binding.getValue(getFacesContext());
179         }
180         return null;
181     }
182 
183     /**
184      * @param title
185      */
186     public void setTitle(String title)
187     {
188         this.title = title;
189     }
190 
191     /**
192      * @return height
193      */
194     public String getHeight()
195     {
196         if (null != this.height)
197         {
198             return this.height;
199         }
200         ValueBinding binding = getValueBinding("height");
201         if (binding != null)
202         {
203             return (String)binding.getValue(getFacesContext());
204         }
205 
206         return null;
207     }
208 
209     /**
210      * @param height
211      */
212     public void setHeight(String height)
213     {
214         this.height = height;
215     }
216 
217     /**
218      * @return width
219      */
220     public String getWidth()
221     {
222         if (null != this.width)
223         {
224             return this.width;
225         }
226         ValueBinding binding = getValueBinding("width");
227         if (binding != null)
228         {
229             return (String)binding.getValue(getFacesContext());
230         }
231         return null;
232     }
233 
234     /**
235      * @param width
236      */
237     public void setWidth(String width)
238     {
239         this.width = width;
240     }
241 
242     /**
243      * @return mouseHorizPos
244      */
245     public String getMouseHorizPos()
246     {
247         if (null != this.mouseHorizPos)
248         {
249             return this.mouseHorizPos;
250         }
251         ValueBinding binding = getValueBinding("mouseRelHorizPos");
252         if (binding != null)
253         {
254             return (String)binding.getValue(getFacesContext());
255         }
256         return null;
257     }
258 
259     /**
260      * @param mouseHorizPos
261      */
262     public void setMouseHorizPos(String mouseHorizPos)
263     {
264         this.mouseHorizPos = mouseHorizPos;
265     }
266 
267     /**
268      * @return mouseVertPos
269      */
270     public String getMouseVertPos()
271     {
272         if (null != this.mouseVertPos)
273         {
274             return this.mouseVertPos;
275         }
276         ValueBinding binding = getValueBinding("mouseRelVertPos");
277         if (binding != null)
278         {
279             return (String)binding.getValue(getFacesContext());
280         }
281         return null;
282     }
283 
284     /**
285      * @param mouseVertPos
286      */
287     public void setMouseVertPos(String mouseVertPos)
288     {
289         this.mouseVertPos = mouseVertPos;
290     }
291 
292     /**
293      * @return style
294      */
295     public String getStyle()
296     {
297         if (null != this.style)
298         {
299             return this.style;
300         }
301         ValueBinding binding = getValueBinding("style");
302         if (binding != null)
303         {
304             return (String)binding.getValue(getFacesContext());
305         }
306         return null;
307     }
308 
309     /**
310      * @param style
311      */
312     public void setStyle(String style)
313     {
314         this.style = style;
315     }
316 
317     /**
318      * @return styleClass
319      */
320     public String getStyleClass()
321     {
322         if (null != this.styleClass)
323         {
324             return this.styleClass;
325         }
326         ValueBinding binding = getValueBinding("styleClass");
327         if (binding != null)
328         {
329             return (String)binding.getValue(getFacesContext());
330         }
331         return null;
332     }
333 
334     /**
335      * @param styleClass
336      */
337     public void setStyleClass(String styleClass)
338     {
339         this.styleClass = styleClass;
340     }
341 
342     /**
343      * @return styleFrame
344      */
345     public String getStyleFrame()
346     {
347         if (null != this.styleFrame)
348         {
349             return this.styleFrame;
350         }
351         ValueBinding binding = getValueBinding("styleFrame");
352         if (binding != null)
353         {
354             return (String)binding.getValue(getFacesContext());
355         }
356         return null;
357     }
358 
359     /**
360      * @param styleFrame
361      */
362     public void setStyleFrame(String styleFrame)
363     {
364         this.styleFrame = styleFrame;
365     }
366 
367     /**
368      * @return styleClassFrame
369      */
370     public String getStyleClassFrame()
371     {
372         if (null != this.styleClassFrame)
373         {
374             return this.styleClassFrame;
375         }
376         ValueBinding binding = getValueBinding("styleClassFrame");
377         if (binding != null)
378         {
379             return (String)binding.getValue(getFacesContext());
380         }
381         return null;
382     }
383 
384     /**
385      * @param styleClassFrame
386      */
387     public void setStyleClassFrame(String styleClassFrame)
388     {
389         this.styleClassFrame = styleClassFrame;
390     }
391 
392     /**
393      * @return absolute
394      */
395     public String getAbsolute()
396     {
397         if (null != this.absolute)
398         {
399             return this.absolute;
400         }
401         ValueBinding binding = getValueBinding("absolute");
402         if (binding != null)
403         {
404             return (String)binding.getValue(getFacesContext());
405         }
406         return null;
407     }
408 
409     /**
410      * @param absolute
411      */
412     public void setAbsolute(String absolute)
413     {
414         this.absolute = absolute;
415     }
416 
417     /**
418      * @return actionClose
419      */
420     public MethodBinding getActionClose()
421     {
422         if (this.actionClose == null)
423         {
424             final ValueBinding binding = this.getValueBinding("actionClose");
425             if (binding != null)
426             {
427                 this.actionClose = FacesContext.getCurrentInstance().getApplication().createMethodBinding(
428                         binding.getExpressionString(), new Class[0]);
429             }
430         }
431         return this.actionClose;
432     }
433 
434     /**
435      * @param actionClose
436      */
437     public void setActionClose(MethodBinding actionClose)
438     {
439         this.actionClose = actionClose;
440     }
441 
442     /**
443      * @return actionOpen
444      */
445     public MethodBinding getActionOpen()
446     {
447         if (this.actionOpen == null)
448         {
449             final ValueBinding binding = this.getValueBinding("actionOpen");
450             if (binding != null)
451             {
452                 this.actionOpen = FacesContext.getCurrentInstance().getApplication().createMethodBinding(
453                         binding.getExpressionString(), new Class[0]);
454             }
455         }
456         return this.actionOpen;
457     }
458 
459     /**
460      * @param actionOpen
461      */
462     public void setActionOpen(MethodBinding actionOpen)
463     {
464         this.actionOpen = actionOpen;
465     }
466 
467     /**
468      * @return center
469      */
470     public String getCenter()
471     {
472         if (null != this.center)
473         {
474             return this.center;
475         }
476         ValueBinding binding = getValueBinding("center");
477         if (binding != null)
478         {
479             return (String)binding.getValue(getFacesContext());
480         }
481         return null;
482     }
483 
484     /**
485      * @param center
486      */
487     public void setCenter(String center)
488     {
489         this.center = center;
490     }
491 
492     /**
493      * @return immediate
494      */
495     public String getImmediate()
496     {
497         if (null != this.immediate)
498         {
499             return this.immediate;
500         }
501         ValueBinding binding = getValueBinding("immediate");
502         if (binding != null)
503         {
504             return (String)binding.getValue(getFacesContext());
505         }
506         return null;
507     }
508 
509     /**
510      * @param immediate
511      */
512     public void setImmediate(String immediate)
513     {
514         this.immediate = immediate;
515     }
516 
517     /**
518      * @return scrolling
519      */
520     public String getScrolling()
521     {
522         if (null != this.scrolling)
523         {
524             return this.scrolling;
525         }
526         ValueBinding binding = getValueBinding("scrolling");
527         if (binding != null)
528         {
529             return (String)binding.getValue(getFacesContext());
530         }
531         return null;
532     }
533 
534     /**
535      * @param disableScroll
536      */
537     public void setScrolling(String disableScroll)
538     {
539         this.scrolling = disableScroll;
540     }
541 
542     /**
543      * @see javax.faces.component.UICommand#saveState(javax.faces.context.FacesContext)
544      */
545     public Object saveState(FacesContext _context)
546     {
547         Object[] _values = new Object[20];
548         _values[0] = super.saveState(_context);
549         _values[1] = accesskey;
550         _values[2] = lang;
551         _values[3] = dir;
552         _values[4] = tabindex;
553         _values[5] = title;
554         _values[6] = mouseHorizPos;
555         _values[7] = mouseVertPos;
556         _values[8] = style;
557         _values[9] = styleClass;
558         _values[10] = styleFrame;
559         _values[11] = styleClassFrame;
560         _values[12] = saveAttachedState(
561                 _context,
562                 actionOpen);
563         _values[13] = saveAttachedState(
564                 _context,
565                 actionClose);
566         _values[14] = immediate;
567         _values[15] = absolute;
568         _values[16] = center;
569         _values[17] = height;
570         _values[18] = width;
571         _values[19] = scrolling;
572         return _values;
573     }
574 
575     /**
576      * @see javax.faces.component.UICommand#restoreState(javax.faces.context.FacesContext, Object)
577      */
578     public void restoreState(
579         FacesContext _context,
580         Object _state)
581     {
582         Object[] _values = (Object[])_state;
583         super.restoreState(
584             _context,
585             _values[0]);
586         accesskey = (String)_values[1];
587         lang = (String)_values[2];
588         dir = (String)_values[3];
589         tabindex = (String)_values[4];
590         title = (String)_values[5];
591         mouseHorizPos = (String)_values[6];
592         mouseVertPos = (String)_values[7];
593         style = (String)_values[8];
594         styleClass = (String)_values[9];
595         styleFrame = (String)_values[10];
596         styleClassFrame = (String)_values[11];
597         actionOpen = (MethodBinding)restoreAttachedState(
598                 _context,
599                 _values[12]);
600         actionClose = (MethodBinding)restoreAttachedState(
601                 _context,
602                 _values[13]);
603         immediate = (String)_values[14];
604         absolute = (String)_values[15];
605         center = (String)_values[16];
606         height = (String)_values[17];
607         width = (String)_values[18];
608         scrolling = (String)_values[19];
609     }
610 
611     /**
612      * @param event
613      */
614     public void queueEventNormal(FacesEvent event)
615     {
616         if (event instanceof ActionEvent)
617         {
618             event.setPhaseId(PhaseId.INVOKE_APPLICATION);
619         }
620         if (event == null)
621         {
622             throw new NullPointerException();
623         }
624         UIComponent parent = getParent();
625         if (parent == null)
626         {
627             throw new IllegalStateException();
628         }
629         parent.queueEvent(event);
630     }
631 
632     /**
633      * @param event
634      */
635     public void queueEventImmediate(FacesEvent event)
636     {
637         if (event instanceof ActionEvent)
638         {
639             event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
640         }
641         if (event == null)
642         {
643             throw new NullPointerException();
644         }
645         UIComponent parent = getParent();
646         if (parent == null)
647         {
648             throw new IllegalStateException();
649         }
650         parent.queueEvent(event);
651     }
652 }