KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ecs > html > 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.html;
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.3 2003/04/27 09:20:29 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 */

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

81     {
82         setElementType("iframe");
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         Adds an Element to the element.
305         @param hashcode name of element for hash table
306         @param element Adds an Element to the element.
307      */

308     public IFrame addElement(String JavaDoc hashcode,Element element)
309     {
310         addElementToRegistry(hashcode,element);
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,String JavaDoc element)
320     {
321         addElementToRegistry(hashcode,element);
322         return(this);
323     }
324
325     /**
326         Adds an Element to the element.
327         @param element Adds an Element to the element.
328      */

329     public IFrame addElement(Element element)
330     {
331         addElementToRegistry(element);
332         return(this);
333     }
334
335     /**
336         Adds an Element to the element.
337         @param element Adds an Element to the element.
338      */

339     public IFrame addElement(String JavaDoc element)
340     {
341         addElementToRegistry(element);
342         return(this);
343     }
344     /**
345         Removes an Element from the element.
346         @param hashcode the name of the element to be removed.
347     */

348     public IFrame removeElement(String JavaDoc hashcode)
349     {
350         removeElementFromRegistry(hashcode);
351         return(this);
352     }
353 }
354
Popular Tags