KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ecs > xhtml > iframe


1 /*
2  * ====================================================================
3  *
4  * The Apache Software License, Version 1.1
5  *
6  * Copyright (c) 1999-2003 The Apache Software Foundation. All rights
7  * reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in
18  * the documentation and/or other materials provided with the
19  * distribution.
20  *
21  * 3. The end-user documentation included with the redistribution, if
22  * any, must include the following acknowlegement:
23  * "This product includes software developed by the
24  * Apache Software Foundation (http://www.apache.org/)."
25  * Alternately, this acknowlegement may appear in the software itself,
26  * if and wherever such third-party acknowlegements normally appear.
27  *
28  * 4. The names "The Jakarta Project", "Jakarta Element Construction Set",
29  * "Jakarta ECS" , and "Apache Software Foundation" must not be used
30  * to endorse or promote products derived
31  * from this software without prior written permission. For written
32  * permission, please contact apache@apache.org.
33  *
34  * 5. Products derived from this software may not be called "Apache",
35  * "Jakarta Element Construction Set" nor "Jakarta ECS" nor may "Apache"
36  * appear in their names without prior written permission of the Apache Group.
37  *
38  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
39  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
40  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
41  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
42  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
44  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
45  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
46  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
47  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
48  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
49  * SUCH DAMAGE.
50  * ====================================================================
51  *
52  * This software consists of voluntary contributions made by many
53  * individuals on behalf of the Apache Software Foundation. For more
54  * information on the Apache Software Foundation, please see
55  * <http://www.apache.org/>.
56  *
57  */

58 package org.apache.ecs.xhtml;
59
60 import org.apache.ecs.*;
61
62 /**
63     This class creates a &lt;iframe&gt; tag.
64
65     @version $Id: iframe.java,v 1.2 2003/04/27 09:39:23 rdonkin Exp $
66     @author <a HREF="mailto:snagy@servletapi.com">Stephan Nagy</a>
67     @author <a HREF="mailto:jon@clearink.com">Jon S. Stevens</a>
68     @author <a HREF="mailto:bojan@binarix.com">Bojan Smojver</a>
69 */

70 public class iframe extends MultiPartElement implements Printable
71 {
72     public final static String JavaDoc yes = "yes";
73     public final static String JavaDoc no = "no";
74     public final static String JavaDoc auto = "auto";
75     
76     /**
77         Private initialization routine.
78     */

79     {
80         setElementType("iframe");
81         setCase(LOWERCASE);
82         setAttributeQuote(true);
83     }
84     /**
85         Basic constructor.
86     */

87     public iframe()
88     {
89     }
90
91     /**
92         Basic constructor.
93         @param element Adds an Element to the element.
94     */

95     public iframe(Element element)
96     {
97         addElement(element);
98     }
99
100     /**
101         Basic constructor.
102         @param element Adds an Element to the element.
103     */

104     public iframe(String JavaDoc element)
105     {
106         addElement(element);
107     }
108
109     /**
110         Basic constructor.
111         @param element Adds an Element to the element.
112         @param name the name="" attribute
113     */

114     public iframe(Element element, String JavaDoc name)
115     {
116         addElement(element);
117         setName(name);
118     }
119
120     /**
121         Basic constructor.
122         @param element Adds an Element to the element.
123         @param name the name="" attribute
124     */

125     public iframe(String JavaDoc element, String JavaDoc name)
126     {
127         addElement(element);
128         setName(name);
129     }
130
131     /**
132         Basic constructor.
133         @param element Adds an Element to the element.
134         @param name the name="" attribute
135         @param src the SRC="" attribute
136     */

137     public iframe(Element element, String JavaDoc name, String JavaDoc src)
138     {
139         addElement(element);
140         setName(name);
141         setSrc(src);
142     }
143
144     /**
145         Basic constructor.
146         @param element Adds an Element to the element.
147         @param name the name="" attribute
148         @param src the SRC="" attribute
149     */

150     public iframe(String JavaDoc element, String JavaDoc name, String JavaDoc src)
151     {
152         addElement(element);
153         setName(name);
154         setSrc(src);
155     }
156
157     /**
158         Sets the longdesc="" attribute
159         @param longdesc the longdesc="" attribute
160     */

161     public iframe setLongDesc(String JavaDoc longdesc)
162     {
163         addAttribute("longdesc",longdesc);
164         return this;
165     }
166
167     /**
168         Sets the name="" attribute
169         @param name the name="" attribute
170     */

171     public iframe setName(String JavaDoc name)
172     {
173         addAttribute("name",name);
174         return this;
175     }
176
177     /**
178         Sets the SRC="" attribute
179         @param src the SRC="" attribute
180     */

181     public iframe setSrc(String JavaDoc src)
182     {
183         addAttribute("src",src);
184         return this;
185     }
186
187     /**
188         Sets the frameborder="" attribute
189         @param frameborder the frameborder="" attribute
190     */

191     public iframe setFrameBorder(boolean frameborder)
192     {
193         if (frameborder)
194             addAttribute("frameborder",Integer.toString(1));
195         else
196             addAttribute("frameborder",Integer.toString(0));
197         return this;
198     }
199
200     /**
201         Sets the marginwidth="" attribute
202         @param marginwidth the marginwidth="" attribute
203     */

204     public iframe setMarginWidth(int marginwidth)
205     {
206         setMarginWidth(Integer.toString(marginwidth));
207         return this;
208     }
209
210     /**
211         Sets the marginwidth="" attribute
212         @param marginwidth the marginwidth="" attribute
213     */

214     public iframe setMarginWidth(String JavaDoc marginwidth)
215     {
216         addAttribute("marginwidth",marginwidth);
217         return this;
218     }
219
220
221     /**
222         Sets the height="" attribute
223         @param height the height="" attribute
224     */

225     public iframe setHeight(String JavaDoc height)
226     {
227         addAttribute("height",height);
228         return this;
229     }
230
231     /**
232         Sets the height="" attribute
233         @param height the height="" attribute
234     */

235     public iframe setHeight(int height)
236     {
237         addAttribute("height",Integer.toString(height));
238         return this;
239     }
240
241     /**
242         Sets the width="" attribute
243         @param width the width="" attribute
244     */

245     public iframe setWidth(String JavaDoc width)
246     {
247         addAttribute("width",width);
248         return this;
249     }
250
251     /**
252         Sets the width="" attribute
253         @param width the width="" attribute
254     */

255     public iframe setWidth(int width)
256     {
257         addAttribute("width",Integer.toString(width));
258         return this;
259     }
260
261     /**
262         Sets the marginheight="" attribute
263         @param marginheight the marginheight="" attribute
264     */

265     public iframe setMarginHeight(int marginheight)
266     {
267         setMarginHeight(Integer.toString(marginheight));
268         return this;
269     }
270
271     /**
272         Sets the marginheight="" attribute
273         @param marginheight the marginheight="" attribute
274     */

275     public iframe setMarginHeight(String JavaDoc marginheight)
276     {
277         addAttribute("marginheight",marginheight);
278         return this;
279     }
280
281     /**
282         Sets the scrolling="" attribute
283         @param scrolling the scrolling="" attribute
284     */

285     public iframe setScrolling(String JavaDoc scrolling)
286     {
287         addAttribute("scrolling",scrolling);
288         return this;
289     }
290
291     /**
292         Sets the align="" attribute.
293
294         @param align sets the align="" attribute. You can
295         use the AlignType.* variables for convience.
296     */

297     public iframe setAlign(String JavaDoc align)
298     {
299         addAttribute("align",align);
300         return(this);
301     }
302
303     /**
304         Sets the lang="" and xml:lang="" attributes
305         @param lang the lang="" and xml:lang="" attributes
306     */

307     public Element setLang(String JavaDoc lang)
308     {
309         addAttribute("lang",lang);
310         addAttribute("xml:lang",lang);
311         return this;
312     }
313
314     /**
315         Adds an Element to the element.
316         @param hashcode name of element for hash table
317         @param element Adds an Element to the element.
318      */

319     public iframe addElement(String JavaDoc hashcode,Element element)
320     {
321         addElementToRegistry(hashcode,element);
322         return(this);
323     }
324
325     /**
326         Adds an Element to the element.
327         @param hashcode name of element for hash table
328         @param element Adds an Element to the element.
329      */

330     public iframe addElement(String JavaDoc hashcode,String JavaDoc element)
331     {
332         addElementToRegistry(hashcode,element);
333         return(this);
334     }
335
336     /**
337         Adds an Element to the element.
338         @param element Adds an Element to the element.
339      */

340     public iframe addElement(Element element)
341     {
342         addElementToRegistry(element);
343         return(this);
344     }
345
346     /**
347         Adds an Element to the element.
348         @param element Adds an Element to the element.
349      */

350     public iframe addElement(String JavaDoc element)
351     {
352         addElementToRegistry(element);
353         return(this);
354     }
355     /**
356         Removes an Element from the element.
357         @param hashcode the name of the element to be removed.
358     */

359     public iframe removeElement(String JavaDoc hashcode)
360     {
361         removeElementFromRegistry(hashcode);
362         return(this);
363     }
364 }
365
Popular Tags