KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > custom > swapimage > HtmlSwapImage


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.swapimage;
17
18 import org.apache.myfaces.component.UserRoleUtils;
19
20 import javax.faces.component.UIGraphic;
21 import javax.faces.el.ValueBinding;
22 import javax.faces.context.FacesContext;
23
24 /**
25  * @author Thomas Spiegl
26  * @version $Revision: 1.2 $ $Date: 2005/01/09 21:56:33 $
27  * $Log: HtmlSwapImage.java,v $
28  * Revision 1.2 2005/01/09 21:56:33 tomsp
29  * added new component swapimage
30  *
31  * Revision 1.1 2005/01/09 12:36:58 tomsp
32  * added new component swapimage
33  *
34  */

35 public class HtmlSwapImage extends UIGraphic
36 {
37
38     //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
39

40     public static final String JavaDoc COMPONENT_TYPE = "org.apache.myfaces.HtmlSwapImage";
41     public static final String JavaDoc COMPONENT_FAMILY = "javax.faces.Graphic";
42     private static final String JavaDoc DEFAULT_RENDERER_TYPE = "org.apache.myfaces.SwapImage";
43     private static final boolean DEFAULT_ISMAP = false;
44
45     private String JavaDoc _swapImageUrl = null;
46     private String JavaDoc _activeImageUrl = null;
47     private String JavaDoc _alt = null;
48     private String JavaDoc _dir = null;
49     private String JavaDoc _height = null;
50     private Boolean JavaDoc _ismap = null;
51     private String JavaDoc _lang = null;
52     private String JavaDoc _longdesc = null;
53     private String JavaDoc _onclick = null;
54     private String JavaDoc _ondblclick = null;
55     private String JavaDoc _onkeydown = null;
56     private String JavaDoc _onkeypress = null;
57     private String JavaDoc _onkeyup = null;
58     private String JavaDoc _style = null;
59     private String JavaDoc _styleClass = null;
60     private String JavaDoc _title = null;
61     private String JavaDoc _usemap = null;
62     private String JavaDoc _width = null;
63
64     public HtmlSwapImage()
65     {
66         setRendererType(DEFAULT_RENDERER_TYPE);
67     }
68
69     public String JavaDoc getFamily()
70     {
71         return COMPONENT_FAMILY;
72     }
73
74     public void setSwapImageUrl(String JavaDoc swapImageUrl)
75     {
76         _swapImageUrl = swapImageUrl;
77     }
78
79     public String JavaDoc getSwapImageUrl()
80     {
81         if (_swapImageUrl != null) return _swapImageUrl;
82         ValueBinding vb = getValueBinding("swapImageUrl");
83         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
84     }
85
86     public void setActiveImageUrl(String JavaDoc activeImageUrl)
87     {
88         _activeImageUrl = activeImageUrl;
89     }
90
91     public String JavaDoc getActiveImageUrl()
92     {
93         if (_activeImageUrl != null) return _activeImageUrl;
94         ValueBinding vb = getValueBinding("activeImageUrl");
95         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
96     }
97
98     public void setAlt(String JavaDoc alt)
99     {
100         _alt = alt;
101     }
102
103     public String JavaDoc getAlt()
104     {
105         if (_alt != null) return _alt;
106         ValueBinding vb = getValueBinding("alt");
107         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
108     }
109
110     public void setDir(String JavaDoc dir)
111     {
112         _dir = dir;
113     }
114
115     public String JavaDoc getDir()
116     {
117         if (_dir != null) return _dir;
118         ValueBinding vb = getValueBinding("dir");
119         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
120     }
121
122     public void setHeight(String JavaDoc height)
123     {
124         _height = height;
125     }
126
127     public String JavaDoc getHeight()
128     {
129         if (_height != null) return _height;
130         ValueBinding vb = getValueBinding("height");
131         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
132     }
133
134     public void setIsmap(boolean ismap)
135     {
136         _ismap = Boolean.valueOf(ismap);
137     }
138
139     public boolean isIsmap()
140     {
141         if (_ismap != null) return _ismap.booleanValue();
142         ValueBinding vb = getValueBinding("ismap");
143         Boolean JavaDoc v = vb != null ? (Boolean JavaDoc)vb.getValue(getFacesContext()) : null;
144         return v != null ? v.booleanValue() : DEFAULT_ISMAP;
145     }
146
147     public void setLang(String JavaDoc lang)
148     {
149         _lang = lang;
150     }
151
152     public String JavaDoc getLang()
153     {
154         if (_lang != null) return _lang;
155         ValueBinding vb = getValueBinding("lang");
156         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
157     }
158
159     public void setLongdesc(String JavaDoc longdesc)
160     {
161         _longdesc = longdesc;
162     }
163
164     public String JavaDoc getLongdesc()
165     {
166         if (_longdesc != null) return _longdesc;
167         ValueBinding vb = getValueBinding("longdesc");
168         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
169     }
170
171     public void setOnclick(String JavaDoc onclick)
172     {
173         _onclick = onclick;
174     }
175
176     public String JavaDoc getOnclick()
177     {
178         if (_onclick != null) return _onclick;
179         ValueBinding vb = getValueBinding("onclick");
180         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
181     }
182
183     public void setOndblclick(String JavaDoc ondblclick)
184     {
185         _ondblclick = ondblclick;
186     }
187
188     public String JavaDoc getOndblclick()
189     {
190         if (_ondblclick != null) return _ondblclick;
191         ValueBinding vb = getValueBinding("ondblclick");
192         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
193     }
194
195     public void setOnkeydown(String JavaDoc onkeydown)
196     {
197         _onkeydown = onkeydown;
198     }
199
200     public String JavaDoc getOnkeydown()
201     {
202         if (_onkeydown != null) return _onkeydown;
203         ValueBinding vb = getValueBinding("onkeydown");
204         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
205     }
206
207     public void setOnkeypress(String JavaDoc onkeypress)
208     {
209         _onkeypress = onkeypress;
210     }
211
212     public String JavaDoc getOnkeypress()
213     {
214         if (_onkeypress != null) return _onkeypress;
215         ValueBinding vb = getValueBinding("onkeypress");
216         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
217     }
218
219     public void setOnkeyup(String JavaDoc onkeyup)
220     {
221         _onkeyup = onkeyup;
222     }
223
224     public String JavaDoc getOnkeyup()
225     {
226         if (_onkeyup != null) return _onkeyup;
227         ValueBinding vb = getValueBinding("onkeyup");
228         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
229     }
230
231     public void setStyle(String JavaDoc style)
232     {
233         _style = style;
234     }
235
236     public String JavaDoc getStyle()
237     {
238         if (_style != null) return _style;
239         ValueBinding vb = getValueBinding("style");
240         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
241     }
242
243     public void setStyleClass(String JavaDoc styleClass)
244     {
245         _styleClass = styleClass;
246     }
247
248     public String JavaDoc getStyleClass()
249     {
250         if (_styleClass != null) return _styleClass;
251         ValueBinding vb = getValueBinding("styleClass");
252         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
253     }
254
255     public void setTitle(String JavaDoc title)
256     {
257         _title = title;
258     }
259
260     public String JavaDoc getTitle()
261     {
262         if (_title != null) return _title;
263         ValueBinding vb = getValueBinding("title");
264         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
265     }
266
267     public void setUsemap(String JavaDoc usemap)
268     {
269         _usemap = usemap;
270     }
271
272     public String JavaDoc getUsemap()
273     {
274         if (_usemap != null) return _usemap;
275         ValueBinding vb = getValueBinding("usemap");
276         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
277     }
278
279     public void setWidth(String JavaDoc width)
280     {
281         _width = width;
282     }
283
284     public String JavaDoc getWidth()
285     {
286         if (_width != null) return _width;
287         ValueBinding vb = getValueBinding("width");
288         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
289     }
290
291
292     public boolean isRendered()
293     {
294         if (!UserRoleUtils.isVisibleOnUserRole(this)) return false;
295         return super.isRendered();
296     }
297
298     public Object JavaDoc saveState(FacesContext context)
299     {
300         Object JavaDoc values[] = new Object JavaDoc[19];
301         values[0] = super.saveState(context);
302         values[1] = _swapImageUrl;
303         values[2] = _activeImageUrl;
304         values[3] = _alt;
305         values[4] = _dir;
306         values[5] = _height;
307         values[6] = _ismap;
308         values[7] = _lang;
309         values[8] = _longdesc;
310         values[9] = _onclick;
311         values[10] = _ondblclick;
312         values[11] = _onkeydown;
313         values[12] = _onkeypress;
314         values[13] = _onkeyup;
315         values[14] = _style;
316         values[15] = _styleClass;
317         values[16] = _title;
318         values[17] = _usemap;
319         values[18] = _width;
320         return ((Object JavaDoc) (values));
321     }
322
323     public void restoreState(FacesContext context, Object JavaDoc state)
324     {
325         Object JavaDoc values[] = (Object JavaDoc[])state;
326         super.restoreState(context, values[0]);
327         _swapImageUrl = (String JavaDoc)values[1];
328         _activeImageUrl = (String JavaDoc)values[2];
329         _alt = (String JavaDoc)values[3];
330         _dir = (String JavaDoc)values[4];
331         _height = (String JavaDoc)values[5];
332         _ismap = (Boolean JavaDoc)values[6];
333         _lang = (String JavaDoc)values[7];
334         _longdesc = (String JavaDoc)values[8];
335         _onclick = (String JavaDoc)values[9];
336         _ondblclick = (String JavaDoc)values[10];
337         _onkeydown = (String JavaDoc)values[11];
338         _onkeypress = (String JavaDoc)values[12];
339         _onkeyup = (String JavaDoc)values[13];
340         _style = (String JavaDoc)values[14];
341         _styleClass = (String JavaDoc)values[15];
342         _title = (String JavaDoc)values[16];
343         _usemap = (String JavaDoc)values[17];
344         _width = (String JavaDoc)values[18];
345     }
346     //------------------ GENERATED CODE END ---------------------------------------
347
}
348
Popular Tags