KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ecs > html > 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.html;
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.3 2003/04/27 09:21:50 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 Frame 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("frame");
83         setNeedClosingTag(false);
84     }
85     /**
86         Basic constructor.
87     */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

255     public Frame setNoResize(boolean noresize)
256     {
257         if ( noresize == true )
258             addAttribute("noresize", NO_ATTRIBUTE_VALUE);
259         else
260             removeAttribute("noresize");
261             
262         return(this);
263     }
264
265     /**
266         Adds an Element to the element.
267         @param hashcode name of element for hash table
268         @param element Adds an Element to the element.
269      */

270     public Frame addElement(String JavaDoc hashcode,Element element)
271     {
272         addElementToRegistry(hashcode,element);
273         return(this);
274     }
275
276     /**
277         Adds an Element to the element.
278         @param hashcode name of element for hash table
279         @param element Adds an Element to the element.
280      */

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

291     public Frame addElement(Element element)
292     {
293         addElementToRegistry(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(String JavaDoc element)
302     {
303         addElementToRegistry(element);
304         return(this);
305     }
306     /**
307         Removes an Element from the element.
308         @param hashcode the name of the element to be removed.
309     */

310     public Frame removeElement(String JavaDoc hashcode)
311     {
312         removeElementFromRegistry(hashcode);
313         return(this);
314     }
315 }
316
Popular Tags