KickJava   Java API By Example, From Geeks To Geeks.

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


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;frame&gt; tag.
64
65     @version $Id: frame.java,v 1.2 2003/04/27 09:40:36 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 frame 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("frame");
81         setCase(LOWERCASE);
82         setAttributeQuote(true);
83     }
84     /**
85         Basic constructor.
86     */

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

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

104     public frame(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 frame(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 frame(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 nama="" attribute
135         @param src the SRC="" attribute
136     */

137     public frame(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 frame(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 frame 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 frame 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 frame 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 frame 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 frame 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 frame setMarginWidth(String JavaDoc marginwidth)
215     {
216         addAttribute("marginwidth",marginwidth);
217         return this;
218     }
219
220     /**
221         Sets the marginheight="" attribute
222         @param marginheight the marginheight="" attribute
223     */

224     public frame setMarginHeight(int marginheight)
225     {
226         setMarginHeight(Integer.toString(marginheight));
227         return this;
228     }
229
230     /**
231         Sets the marginheight="" attribute
232         @param marginheight the marginheight="" attribute
233     */

234     public frame setMarginHeight(String JavaDoc marginheight)
235     {
236         addAttribute("marginheight",marginheight);
237         return this;
238     }
239
240     /**
241         Sets the scrolling="" attribute
242         @param scrolling the scrolling="" attribute
243     */

244     public frame setScrolling(String JavaDoc scrolling)
245     {
246         addAttribute("scrolling",scrolling);
247         return this;
248     }
249
250     /**
251         Sets the noresize value
252         @param noresize true or false
253     */

254     public frame setNoResize(boolean noresize)
255     {
256         if ( noresize == true )
257             addAttribute("noresize", "noresize");
258         else
259             removeAttribute("noresize");
260             
261         return(this);
262     }
263
264     /**
265         Sets the lang="" and xml:lang="" attributes
266         @param lang the lang="" and xml:lang="" attributes
267     */

268     public Element setLang(String JavaDoc lang)
269     {
270         addAttribute("lang",lang);
271         addAttribute("xml:lang",lang);
272         return this;
273     }
274
275     /**
276         Adds an Element to the element.
277         @param hashcode name of element for hash table
278         @param element Adds an Element to the element.
279      */

280     public frame addElement(String JavaDoc hashcode,Element element)
281     {
282         addElementToRegistry(hashcode,element);
283         return(this);
284     }
285
286     /**
287         Adds an Element to the element.
288         @param hashcode name of element for hash table
289         @param element Adds an Element to the element.
290      */

291     public frame addElement(String JavaDoc hashcode,String JavaDoc element)
292     {
293         addElementToRegistry(hashcode,element);
294         return(this);
295     }
296
297     /**
298         Adds an Element to the element.
299         @param element Adds an Element to the element.
300      */

301     public frame addElement(Element element)
302     {
303         addElementToRegistry(element);
304         return(this);
305     }
306
307     /**
308         Adds an Element to the element.
309         @param element Adds an Element to the element.
310      */

311     public frame addElement(String JavaDoc element)
312     {
313         addElementToRegistry(element);
314         return(this);
315     }
316
317     /**
318         Removes an Element from the element.
319         @param hashcode the name of the element to be removed.
320     */

321     public frame removeElement(String JavaDoc hashcode)
322     {
323         removeElementFromRegistry(hashcode);
324         return(this);
325     }
326 }
327
Popular Tags