KickJava   Java API By Example, From Geeks To Geeks.

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


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 an &lt;applet&gt; tag.
64
65     @version $Id: applet.java,v 1.2 2003/04/27 09:41:09 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 applet extends MultiPartElement implements Printable
71 {
72     /**
73         Private initializer.
74     */

75     {
76         setElementType("applet");
77         setCase(LOWERCASE);
78         setAttributeQuote(true);
79     }
80
81     /**
82         Default constructor. Creates the &lt;applet/&gt; Element.<br>
83         use set* methods.
84     */

85     public applet()
86     {
87     }
88
89    /**
90         Determines the base url for this applet.
91         @param url base url for this applet.
92     */

93     public applet setCodeBase(String JavaDoc url)
94     {
95         addAttribute("codebase",url);
96         return(this);
97     }
98
99     /**
100         Comma seperated archive list.
101         @param url Comma seperate archive list.
102     */

103     public applet setArchive(String JavaDoc url)
104     {
105         addAttribute("archive",url);
106         return(this);
107     }
108
109     /**
110         Applet class file.
111         @param code applet class file.
112     */

113     public applet setCode(String JavaDoc code)
114     {
115         addAttribute("code",code);
116         return(this);
117     }
118
119     /**
120         Suggested height of applet.
121         @param height suggested link height.
122     */

123     public applet setHeight(String JavaDoc height)
124     {
125         addAttribute("height",height);
126         return(this);
127     }
128
129     /**
130         Suggested height of applet.
131         @param height suggested link height.
132     */

133     public applet setHeight(int height)
134     {
135         addAttribute("height",Integer.toString(height));
136         return(this);
137     }
138
139     /**
140         Suggested height of applet.
141         @param height suggested link height.
142     */

143     public applet setHeight(double height)
144     {
145         addAttribute("height",Double.toString(height));
146         return(this);
147     }
148
149     /**
150         Suggested width of applet.
151         @param height suggested link width.
152     */

153     public applet setWidth(String JavaDoc width)
154     {
155         addAttribute("width",width);
156         return(this);
157     }
158
159     /**
160         Suggested width of applet.
161         @param height suggested link width.
162     */

163     public applet setWidth(int width)
164     {
165         addAttribute("width",Integer.toString(width));
166         return(this);
167     }
168
169     /**
170         Suggested width of object.
171         @param height suggested link width.
172     */

173     public applet setWidth(double width)
174     {
175         addAttribute("width",Double.toString(width));
176         return(this);
177     }
178
179     /**
180         Suggested horizontal gutter.
181         @param hspace suggested horizontal gutter.
182     */

183     public applet setHSpace(String JavaDoc hspace)
184     {
185         addAttribute("hspace",hspace);
186         return(this);
187     }
188
189     /**
190         Suggested horizontal gutter.
191         @param hspace suggested horizontal gutter.
192     */

193     public applet setHSpace(int hspace)
194     {
195         addAttribute("hspace",Integer.toString(hspace));
196         return(this);
197     }
198
199     /**
200         Suggested horizontal gutter.
201         @param hspace suggested horizontal gutter.
202     */

203     public applet setHSpace(double hspace)
204     {
205         addAttribute("hspace",Double.toString(hspace));
206         return(this);
207     }
208
209     /**
210         Suggested vertical gutter.
211         @param hspace suggested vertical gutter.
212     */

213     public applet setVSpace(String JavaDoc vspace)
214     {
215         addAttribute("vspace",vspace);
216         return(this);
217     }
218
219     /**
220         Suggested vertical gutter.
221         @param hspace suggested vertical gutter.
222     */

223     public applet setVSpace(int vspace)
224     {
225         addAttribute("vspace",Integer.toString(vspace));
226         return(this);
227     }
228
229     /**
230         Suggested vertical gutter.
231         @param hspace suggested vertical gutter.
232     */

233     public applet setVSpace(double vspace)
234     {
235         addAttribute("vspace",Double.toString(vspace));
236         return(this);
237     }
238
239     /**
240         Set the horizontal or vertical alignment of this applet.<br>
241         Convience variables are in the AlignTypes interface.
242         @param alignment Set the horizontal or vertical alignment of this applet.<br>
243         Convience variables are in the AlignTypes interface.
244     */

245     public applet setAlign(String JavaDoc alignment)
246     {
247         addAttribute("align",alignment);
248         return(this);
249     }
250
251     /**
252         Set the name of this applet.
253         @param name set the name of this applet.
254     */

255     public applet setName(String JavaDoc name)
256     {
257         addAttribute("name",name);
258         return(this);
259     }
260
261     /**
262         Serialized applet file.
263         @param object Serialized applet file.
264     */

265     // someone give me a better description of what this does.
266
public applet setObject(String JavaDoc object)
267     {
268         addAttribute("object",object);
269         return(this);
270     }
271
272     /**
273         Breif description, alternate text for the applet.
274         @param alt alternat text.
275     */

276     public applet setAlt(String JavaDoc alt)
277     {
278         addAttribute("alt",alt);
279         return(this);
280     }
281
282     /**
283         Sets the lang="" and xml:lang="" attributes
284         @param lang the lang="" and xml:lang="" attributes
285     */

286     public Element setLang(String JavaDoc lang)
287     {
288         addAttribute("lang",lang);
289         addAttribute("xml:lang",lang);
290         return this;
291     }
292     
293     /**
294         Adds an Element to the element.
295         @param hashcode name of element for hash table
296         @param element Adds an Element to the element.
297      */

298     public applet addElement(String JavaDoc hashcode,Element element)
299     {
300         addElementToRegistry(hashcode,element);
301         return(this);
302     }
303
304     /**
305         Adds an Element to the element.
306         @param hashcode name of element for hash table
307         @param element Adds an Element to the element.
308      */

309     public applet addElement(String JavaDoc hashcode,String JavaDoc element)
310     {
311         addElementToRegistry(hashcode,element);
312         return(this);
313     }
314
315     /**
316         Add an element to the element
317         @param element a string representation of the element
318     */

319     public applet addElement(String JavaDoc element)
320     {
321         addElementToRegistry(element);
322         return(this);
323     }
324
325     /**
326         Add an element to the element
327         @param element an element to add
328     */

329     public applet addElement(Element element)
330     {
331         addElementToRegistry(element);
332         return(this);
333     }
334
335     /**
336         Removes an Element from the element.
337         @param hashcode the name of the element to be removed.
338     */

339     public applet removeElement(String JavaDoc hashcode)
340     {
341         removeElementFromRegistry(hashcode);
342         return(this);
343     }
344 }
345
Popular Tags