KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

85     public object()
86     {
87     }
88
89     /**
90         Sets the declare attribute. (declare this object but don't instantiate it.
91         @param declare declare on or off
92     */

93     public object setDeclare(boolean declare)
94     {
95         if(declare)
96             addAttribute("declare","declare");
97         else
98             removeAttribute("declare");
99         return(this);
100     }
101
102     /**
103         Identifies an implementation.
104         @param url location of classid.
105     */

106     public object setClassId(String JavaDoc url)
107     {
108         addAttribute("classid",url);
109         return(this);
110     }
111
112     /**
113         Sets the Internet content type for the code.
114         @param codetype Sets the Internet content type for the code.
115     */

116     public object setCodeType(String JavaDoc codetype)
117     {
118         addAttribute("codetype",codetype);
119         return(this);
120     }
121
122     /**
123         Determines the base path to resolve relative urls specified by classid.
124         @param url base path to resolve relative urls specified by classid.
125     */

126     public object setCodeBase(String JavaDoc url)
127     {
128         addAttribute("codebase",url);
129         return(this);
130     }
131
132     /**
133         This attribute specifies the location of the data to be rendered.
134         @param url this attribute specifies the location of the data to be rendered.
135     */

136     public object setData(String JavaDoc url)
137     {
138         addAttribute("data",url);
139         return(this);
140     }
141
142     /**
143         This attribute specifies the Internet Media Type for the data specified by data.<br>
144         This should be a mime type.
145         @param type a mime type for the data specifed by the data attribute.
146     */

147     public object setType(String JavaDoc type)
148     {
149         addAttribute("type",type);
150         return(this);
151     }
152
153     /**
154         Space seperated archive list.
155         @param url Space seperate archive list.
156     */

157     // Anyone know what the hell this is? the spec is rather vague in its definition.
158
public object setArchive(String JavaDoc url)
159     {
160         addAttribute("archive",url);
161         return(this);
162     }
163
164     /**
165         Message to show while the object is loading.
166         @param cdata the message to show while the object is loading.
167     */

168     public object setStandBy(String JavaDoc cdata)
169     {
170         addAttribute("standby",cdata);
171         return(this);
172     }
173
174     /**
175         Suggested link border width.
176         @param border suggested link border width.
177     */

178     public object setBorder(String JavaDoc border)
179     {
180         addAttribute("border",border);
181         return(this);
182     }
183
184     /**
185         Suggested link border width.
186         @param border suggested link border width.
187     */

188     public object setBorder(int border)
189     {
190         addAttribute("border",Integer.toString(border));
191         return(this);
192     }
193
194     /**
195         Suggested link border width.
196         @param border suggested link border width.
197     */

198     public object setBorder(double border)
199     {
200         addAttribute("border",Double.toString(border));
201         return(this);
202     }
203
204     /**
205         Suggested height of object.
206         @param height suggested link height.
207     */

208     public object setHeight(String JavaDoc height)
209     {
210         addAttribute("height",height);
211         return(this);
212     }
213
214     /**
215         Suggested height of object.
216         @param height suggested link height.
217     */

218     public object setHeight(int height)
219     {
220         addAttribute("height",Integer.toString(height));
221         return(this);
222     }
223
224     /**
225         Suggested height of object.
226         @param height suggested link height.
227     */

228     public object setHeight(double height)
229     {
230         addAttribute("height",Double.toString(height));
231         return(this);
232     }
233
234     /**
235         Suggested width of object.
236         @param height suggested link width.
237     */

238     public object setWidth(String JavaDoc width)
239     {
240         addAttribute("width",width);
241         return(this);
242     }
243
244     /**
245         Suggested width of object.
246         @param height suggested link width.
247     */

248     public object setWidth(int width)
249     {
250         addAttribute("width",Integer.toString(width));
251         return(this);
252     }
253
254     /**
255         Suggested width of object.
256         @param height suggested link width.
257     */

258     public object setWidth(double width)
259     {
260         addAttribute("width",Double.toString(width));
261         return(this);
262     }
263
264     /**
265         Suggested horizontal gutter.
266         @param hspace suggested horizontal gutter.
267     */

268     public object setHSpace(String JavaDoc hspace)
269     {
270         addAttribute("hspace",hspace);
271         return(this);
272     }
273
274     /**
275         Suggested horizontal gutter.
276         @param hspace suggested horizontal gutter.
277     */

278     public object setHSpace(int hspace)
279     {
280         addAttribute("hspace",Integer.toString(hspace));
281         return(this);
282     }
283
284     /**
285         Suggested horizontal gutter.
286         @param hspace suggested horizontal gutter.
287     */

288     public object setHSpace(double hspace)
289     {
290         addAttribute("hspace",Double.toString(hspace));
291         return(this);
292     }
293
294     /**
295         Suggested vertical gutter.
296         @param hspace suggested vertical gutter.
297     */

298     public object setVSpace(String JavaDoc vspace)
299     {
300         addAttribute("vspace",vspace);
301         return(this);
302     }
303
304     /**
305         Suggested vertical gutter.
306         @param hspace suggested vertical gutter.
307     */

308     public object setVSpace(int vspace)
309     {
310         addAttribute("vspace",Integer.toString(vspace));
311         return(this);
312     }
313
314     /**
315         Suggested vertical gutter.
316         @param hspace suggested vertical gutter.
317     */

318     public object setVSpace(double vspace)
319     {
320         addAttribute("vspace",Double.toString(vspace));
321         return(this);
322     }
323
324     /**
325         Set the horizontal or vertical alignment of this object.<br>
326         Convience variables are in the AlignTypes interface.
327         @param alignment Set the horizontal or vertical alignment of this object.<br>
328         Convience variables are in the AlignTypes interface.
329     */

330     public object setAlign(String JavaDoc alignment)
331     {
332         addAttribute("align",alignment);
333         return(this);
334     }
335
336     /**
337         Location of image map to use.
338         @param url location of image map to use.
339     */

340     public object setUseMap(String JavaDoc url)
341     {
342         addAttribute("usemap",url);
343         return(this);
344     }
345
346     /**
347         Object has shaped hypertext links.
348         @param shape does the object have shaped hypertext links?
349     */

350     public object setShapes(boolean shape)
351     {
352         if(shape)
353             addAttribute("shapes","shapes");
354         else
355             removeAttribute("shapes");
356         return(this);
357     }
358
359     /**
360         Set the name of this object.
361         @param name set the name of this object.
362     */

363     public object setName(String JavaDoc name)
364     {
365         addAttribute("name",name);
366         return(this);
367     }
368
369     /**
370         Set the elements position in the tabbing order.
371         @param number set the elements position in the tabbing order.
372     */

373     public object setTabIndex(int number)
374     {
375         addAttribute("tabindex",Integer.toString(number));
376         return(this);
377     }
378
379     /**
380         Set the elements position in the tabbing order.
381         @param number set the elements position in the tabbing order.
382     */

383     public object setTabIndex(String JavaDoc number)
384     {
385         addAttribute("tabindex",number);
386         return(this);
387     }
388
389     /**
390         Sets the lang="" and xml:lang="" attributes
391         @param lang the lang="" and xml:lang="" attributes
392     */

393     public Element setLang(String JavaDoc lang)
394     {
395         addAttribute("lang",lang);
396         addAttribute("xml:lang",lang);
397         return this;
398     }
399
400     /**
401         Adds an Element to the element.
402         @param hashcode name of element for hash table
403         @param element Adds an Element to the element.
404      */

405     public object addElement(String JavaDoc hashcode,Element element)
406     {
407         addElementToRegistry(hashcode,element);
408         return(this);
409     }
410
411     /**
412         Adds an Element to the element.
413         @param hashcode name of element for hash table
414         @param element Adds an Element to the element.
415      */

416     public object addElement(String JavaDoc hashcode,String JavaDoc element)
417     {
418         addElementToRegistry(hashcode,element);
419         return(this);
420     }
421
422     /**
423         Add an element to the element
424         @param element a string representation of the element
425     */

426     public object addElement(String JavaDoc element)
427     {
428         addElementToRegistry(element);
429         return(this);
430     }
431
432     /**
433         Add an element to the element
434         @param element an element to add
435     */

436     public object addElement(Element element)
437     {
438         addElementToRegistry(element);
439         return(this);
440     }
441     /**
442         Removes an Element from the element.
443         @param hashcode the name of the element to be removed.
444     */

445     public object removeElement(String JavaDoc hashcode)
446     {
447         removeElementFromRegistry(hashcode);
448         return(this);
449     }
450
451     /**
452         The onclick event occurs when the pointing device button is clicked
453         over an element. This attribute may be used with most elements.
454         
455         @param The script
456     */

457     public void setOnClick(String JavaDoc script)
458     {
459         addAttribute ( "onclick", script );
460     }
461     /**
462         The ondblclick event occurs when the pointing device button is double
463         clicked over an element. This attribute may be used with most elements.
464
465         @param The script
466     */

467     public void setOnDblClick(String JavaDoc script)
468     {
469         addAttribute ( "ondblclick", script );
470     }
471     /**
472         The onmousedown event occurs when the pointing device button is pressed
473         over an element. This attribute may be used with most elements.
474
475         @param The script
476     */

477     public void setOnMouseDown(String JavaDoc script)
478     {
479         addAttribute ( "onmousedown", script );
480     }
481     /**
482         The onmouseup event occurs when the pointing device button is released
483         over an element. This attribute may be used with most elements.
484
485         @param The script
486     */

487     public void setOnMouseUp(String JavaDoc script)
488     {
489         addAttribute ( "onmouseup", script );
490     }
491     /**
492         The onmouseover event occurs when the pointing device is moved onto an
493         element. This attribute may be used with most elements.
494
495         @param The script
496     */

497     public void setOnMouseOver(String JavaDoc script)
498     {
499         addAttribute ( "onmouseover", script );
500     }
501     /**
502         The onmousemove event occurs when the pointing device is moved while it
503         is over an element. This attribute may be used with most elements.
504
505         @param The script
506     */

507     public void setOnMouseMove(String JavaDoc script)
508     {
509         addAttribute ( "onmousemove", script );
510     }
511     /**
512         The onmouseout event occurs when the pointing device is moved away from
513         an element. This attribute may be used with most elements.
514
515         @param The script
516     */

517     public void setOnMouseOut(String JavaDoc script)
518     {
519         addAttribute ( "onmouseout", script );
520     }
521
522     /**
523         The onkeypress event occurs when a key is pressed and released over an
524         element. This attribute may be used with most elements.
525         
526         @param The script
527     */

528     public void setOnKeyPress(String JavaDoc script)
529     {
530         addAttribute ( "onkeypress", script );
531     }
532
533     /**
534         The onkeydown event occurs when a key is pressed down over an element.
535         This attribute may be used with most elements.
536         
537         @param The script
538     */

539     public void setOnKeyDown(String JavaDoc script)
540     {
541         addAttribute ( "onkeydown", script );
542     }
543
544     /**
545         The onkeyup event occurs when a key is released over an element. This
546         attribute may be used with most elements.
547         
548         @param The script
549     */

550     public void setOnKeyUp(String JavaDoc script)
551     {
552         addAttribute ( "onkeyup", script );
553     }
554 }
555
Popular Tags