KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > custom > popup > HtmlPopup


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.myfaces.custom.popup;
17
18 import javax.faces.component.UIComponentBase;
19 import javax.faces.component.UIComponent;
20 import javax.faces.el.ValueBinding;
21 import javax.faces.context.FacesContext;
22
23 /**
24  * @author Martin Marinschek (latest modification by $Author: mmarinschek $)
25  * @version $Revision: 1.3 $ $Date: 2004/11/23 23:24:04 $
26  */

27 public class HtmlPopup
28         extends UIComponentBase
29 {
30     //private static final Log log = LogFactory.getLog(HtmlPopup.class);
31

32     private static final String JavaDoc POPUP_FACET_NAME = "popup";
33
34     public void setPopup(UIComponent popup)
35     {
36         getFacets().put(POPUP_FACET_NAME, popup);
37     }
38
39     public UIComponent getPopup()
40     {
41         return (UIComponent)getFacets().get(POPUP_FACET_NAME);
42     }
43
44     public boolean getRendersChildren()
45     {
46         return true;
47     }
48
49
50     //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
51

52     public static final String JavaDoc COMPONENT_TYPE = "org.apache.myfaces.HtmlPopup";
53     public static final String JavaDoc COMPONENT_FAMILY = "javax.faces.Panel";
54     private static final String JavaDoc DEFAULT_RENDERER_TYPE = "org.apache.myfaces.Popup";
55
56     private String JavaDoc _style = null;
57     private String JavaDoc _styleClass = null;
58     private Integer JavaDoc _displayAtDistanceX = null;
59     private Integer JavaDoc _displayAtDistanceY = null;
60     private Boolean JavaDoc _closePopupOnExitingElement = null;
61     private Boolean JavaDoc _closePopupOnExitingPopup = null;
62
63     public HtmlPopup()
64     {
65         setRendererType(DEFAULT_RENDERER_TYPE);
66     }
67
68     public String JavaDoc getFamily()
69     {
70         return COMPONENT_FAMILY;
71     }
72
73     public void setStyle(String JavaDoc style)
74     {
75         _style = style;
76     }
77
78     public String JavaDoc getStyle()
79     {
80         if (_style != null) return _style;
81         ValueBinding vb = getValueBinding("style");
82         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
83     }
84
85     public void setStyleClass(String JavaDoc styleClass)
86     {
87         _styleClass = styleClass;
88     }
89
90     public String JavaDoc getStyleClass()
91     {
92         if (_styleClass != null) return _styleClass;
93         ValueBinding vb = getValueBinding("styleClass");
94         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
95     }
96
97     public void setDisplayAtDistanceX(Integer JavaDoc displayAtDistanceX)
98     {
99         _displayAtDistanceX = displayAtDistanceX;
100     }
101
102     public Integer JavaDoc getDisplayAtDistanceX()
103     {
104         if (_displayAtDistanceX != null) return _displayAtDistanceX;
105         ValueBinding vb = getValueBinding("displayAtDistanceX");
106         return vb != null ? (Integer JavaDoc)vb.getValue(getFacesContext()) : null;
107     }
108
109     public void setDisplayAtDistanceY(Integer JavaDoc displayAtDistanceY)
110     {
111         _displayAtDistanceY = displayAtDistanceY;
112     }
113
114     public Integer JavaDoc getDisplayAtDistanceY()
115     {
116         if (_displayAtDistanceY != null) return _displayAtDistanceY;
117         ValueBinding vb = getValueBinding("displayAtDistanceY");
118         return vb != null ? (Integer JavaDoc)vb.getValue(getFacesContext()) : null;
119     }
120
121     public void setClosePopupOnExitingElement(Boolean JavaDoc closePopupOnExitingElement)
122     {
123         _closePopupOnExitingElement = closePopupOnExitingElement;
124     }
125
126     public Boolean JavaDoc getClosePopupOnExitingElement()
127     {
128         if (_closePopupOnExitingElement != null) return _closePopupOnExitingElement;
129         ValueBinding vb = getValueBinding("closePopupOnExitingElement");
130         return vb != null ? (Boolean JavaDoc)vb.getValue(getFacesContext()) : null;
131     }
132
133     public void setClosePopupOnExitingPopup(Boolean JavaDoc closePopupOnExitingPopup)
134     {
135         _closePopupOnExitingPopup = closePopupOnExitingPopup;
136     }
137
138     public Boolean JavaDoc getClosePopupOnExitingPopup()
139     {
140         if (_closePopupOnExitingPopup != null) return _closePopupOnExitingPopup;
141         ValueBinding vb = getValueBinding("closePopupOnExitingPopup");
142         return vb != null ? (Boolean JavaDoc)vb.getValue(getFacesContext()) : null;
143     }
144
145
146
147     public Object JavaDoc saveState(FacesContext context)
148     {
149         Object JavaDoc values[] = new Object JavaDoc[7];
150         values[0] = super.saveState(context);
151         values[1] = _style;
152         values[2] = _styleClass;
153         values[3] = _displayAtDistanceX;
154         values[4] = _displayAtDistanceY;
155         values[5] = _closePopupOnExitingElement;
156         values[6] = _closePopupOnExitingPopup;
157         return ((Object JavaDoc) (values));
158     }
159
160     public void restoreState(FacesContext context, Object JavaDoc state)
161     {
162         Object JavaDoc values[] = (Object JavaDoc[])state;
163         super.restoreState(context, values[0]);
164         _style = (String JavaDoc)values[1];
165         _styleClass = (String JavaDoc)values[2];
166         _displayAtDistanceX = (Integer JavaDoc)values[3];
167         _displayAtDistanceY = (Integer JavaDoc)values[4];
168         _closePopupOnExitingElement = (Boolean JavaDoc)values[5];
169         _closePopupOnExitingPopup = (Boolean JavaDoc)values[6];
170     }
171     //------------------ GENERATED CODE END ---------------------------------------
172
}
173
Popular Tags