KickJava   Java API By Example, From Geeks To Geeks.

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


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;table&gt; object.
64     @version $Id: table.java,v 1.2 2003/04/27 09:36:17 rdonkin Exp $
65     @author <a HREF="mailto:snagy@servletapi.com">Stephan Nagy</a>
66     @author <a HREF="mailto:jon@clearink.com">Jon S. Stevens</a>
67     @author <a HREF="mailto:bojan@binarix.com">Bojan Smojver</a>
68 */

69 public class table extends MultiPartElement implements Printable, MouseEvents, KeyEvents
70 {
71     /**
72         Private iniitialization routine
73     */

74     {
75         setElementType("table");
76         setCase(LOWERCASE);
77         setAttributeQuote(true);
78     }
79     public table()
80     {
81     }
82
83     /**
84         Allows one to set the border size.
85         
86         @param border sets the border="" attribute.
87     */

88     public table(int border)
89     {
90         setBorder(border);
91     }
92
93     /**
94         Allows one to set the border size.
95         
96         @param border sets the border="" attribute.
97     */

98     public table(String JavaDoc border)
99     {
100         setBorder(border);
101     }
102
103     /**
104         Set the summary="" attribue.
105
106         @param summary sets the summary="" attribute.
107     */

108     public table setSummary(String JavaDoc summary)
109     {
110         addAttribute("summary",summary);
111         return(this);
112     }
113
114     /**
115         Sets the align="" attribute.
116
117         @param align sets the align="" attribute. You can
118         use the AlignType.* variables for convience.
119     */

120     public table setAlign(String JavaDoc align)
121     {
122         addAttribute("align",align);
123         return(this);
124     }
125
126     /**
127         Sets the width="" attribute.
128
129         @param width sets the width="" attribute.
130     */

131     public table setWidth(String JavaDoc width)
132     {
133         addAttribute("width",width);
134         return(this);
135     }
136     /**
137         Sets the height="" attribute.
138
139         @param width sets the height="" attribute.
140     */

141     public table setHeight(String JavaDoc height)
142     {
143         addAttribute("height",height);
144         return(this);
145     }
146     /**
147         Sets the width="" attribute.
148
149         @param width sets the width="" attribute.
150     */

151     public table setWidth(int width)
152     {
153         addAttribute("width",Integer.toString(width));
154         return(this);
155     }
156     /**
157         Sets the height="" attribute.
158
159         @param width sets the height="" attribute.
160     */

161     public table setHeight(int height)
162     {
163         addAttribute("height",Integer.toString(height));
164         return(this);
165     }
166     /**
167         Sets the cols="" attribute.
168
169         @param width sets the cols="" attribute.
170     */

171     public table setCols(int cols)
172     {
173         addAttribute("cols",Integer.toString(cols));
174         return(this);
175     }
176     /**
177         Sets the cols="" attribute.
178
179         @param width sets the cols="" attribute.
180     */

181     public table setCols(String JavaDoc cols)
182     {
183         addAttribute("cols",cols);
184         return(this);
185     }
186     /**
187         Sets the cellpading="" attribute.
188         @param cellpadding sets the cellpading="" attribute.
189     */

190     public table setCellPadding(int cellpadding)
191     {
192         addAttribute("cellpadding",Integer.toString(cellpadding));
193         return(this);
194     }
195     /**
196         Sets the cellspacing="" attribute.
197         @param spacing sets the cellspacing="" attribute.
198     */

199     public table setCellSpacing(int cellspacing)
200     {
201         addAttribute("cellspacing",Integer.toString(cellspacing));
202         return(this);
203     }
204     /**
205         Sets the cellpading="" attribute.
206         @param cellpadding sets the cellpading="" attribute.
207     */

208     public table setCellPadding(String JavaDoc cellpadding)
209     {
210         addAttribute("cellpadding",cellpadding);
211         return(this);
212     }
213     /**
214         Sets the cellspacing="" attribute.
215         @param spacing sets the cellspacing="" attribute.
216     */

217     public table setCellSpacing(String JavaDoc cellspacing)
218     {
219         addAttribute("cellspacing",cellspacing);
220         return(this);
221     }
222     /**
223         Sets the border="" attribute.
224         @param border sets the border="" attribute.
225     */

226     public table setBorder(int border)
227     {
228         addAttribute("border",Integer.toString(border));
229         return(this);
230     }
231     /**
232         Sets the border="" attribute.
233         @param border sets the border="" attribute.
234     */

235     public table setBorder(String JavaDoc border)
236     {
237         addAttribute("border",border);
238         return(this);
239     }
240     /**
241         Sets the frame="" attribute.
242         @param frame sets the frame="" attribute.
243     */

244     public table setFrame(String JavaDoc frame)
245     {
246         addAttribute("frame",frame);
247         return(this);
248     }
249     /**
250         Sets the rules="" attribute.
251         @param rules sets the rules="" attribute.
252     */

253     public table setRules(String JavaDoc rules)
254     {
255         addAttribute("rules",rules);
256         return(this);
257     }
258
259     /**
260         Sets the bgcolor="" attribute
261         @param color the bgcolor="" attribute
262     */

263     public table setBgColor(String JavaDoc color)
264     {
265         addAttribute("bgcolor",HtmlColor.convertColor(color));
266         return this;
267     }
268
269     /**
270         Sets the lang="" and xml:lang="" attributes
271         @param lang the lang="" and xml:lang="" attributes
272     */

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

285     public table addElement(String JavaDoc hashcode,Element element)
286     {
287         addElementToRegistry(hashcode,element);
288         return(this);
289     }
290
291     /**
292         Adds an Element to the element.
293         @param hashcode name of element for hash table
294         @param element Adds an Element to the element.
295      */

296     public table addElement(String JavaDoc hashcode,String JavaDoc element)
297     {
298         addElementToRegistry(hashcode,element);
299         return(this);
300     }
301
302     /**
303         Adds an Element to the element.
304         @param element Adds an Element to the element.
305      */

306     public table addElement(Element element)
307     {
308         addElementToRegistry(element);
309         return(this);
310     }
311
312     /**
313         Adds an Element to the element.
314         @param element Adds an Element to the element.
315      */

316     public table addElement(String JavaDoc element)
317     {
318         addElementToRegistry(element);
319         return(this);
320     }
321     /**
322         Removes an Element from the element.
323         @param hashcode the name of the element to be removed.
324     */

325     public table removeElement(String JavaDoc hashcode)
326     {
327         removeElementFromRegistry(hashcode);
328         return(this);
329     }
330
331     /**
332         The onclick event occurs when the pointing device button is clicked
333         over an element. This attribute may be used with most elements.
334         
335         @param The script
336     */

337     public void setOnClick(String JavaDoc script)
338     {
339         addAttribute ( "onclick", script );
340     }
341     /**
342         The ondblclick event occurs when the pointing device button is double
343         clicked over an element. This attribute may be used with most elements.
344
345         @param The script
346     */

347     public void setOnDblClick(String JavaDoc script)
348     {
349         addAttribute ( "ondblclick", script );
350     }
351     /**
352         The onmousedown event occurs when the pointing device button is pressed
353         over an element. This attribute may be used with most elements.
354
355         @param The script
356     */

357     public void setOnMouseDown(String JavaDoc script)
358     {
359         addAttribute ( "onmousedown", script );
360     }
361     /**
362         The onmouseup event occurs when the pointing device button is released
363         over an element. This attribute may be used with most elements.
364
365         @param The script
366     */

367     public void setOnMouseUp(String JavaDoc script)
368     {
369         addAttribute ( "onmouseup", script );
370     }
371     /**
372         The onmouseover event occurs when the pointing device is moved onto an
373         element. This attribute may be used with most elements.
374
375         @param The script
376     */

377     public void setOnMouseOver(String JavaDoc script)
378     {
379         addAttribute ( "onmouseover", script );
380     }
381     /**
382         The onmousemove event occurs when the pointing device is moved while it
383         is over an element. This attribute may be used with most elements.
384
385         @param The script
386     */

387     public void setOnMouseMove(String JavaDoc script)
388     {
389         addAttribute ( "onmousemove", script );
390     }
391     /**
392         The onmouseout event occurs when the pointing device is moved away from
393         an element. This attribute may be used with most elements.
394
395         @param The script
396     */

397     public void setOnMouseOut(String JavaDoc script)
398     {
399         addAttribute ( "onmouseout", script );
400     }
401
402     /**
403         The onkeypress event occurs when a key is pressed and released over an
404         element. This attribute may be used with most elements.
405         
406         @param The script
407     */

408     public void setOnKeyPress(String JavaDoc script)
409     {
410         addAttribute ( "onkeypress", script );
411     }
412
413     /**
414         The onkeydown event occurs when a key is pressed down over an element.
415         This attribute may be used with most elements.
416         
417         @param The script
418     */

419     public void setOnKeyDown(String JavaDoc script)
420     {
421         addAttribute ( "onkeydown", script );
422     }
423
424     /**
425         The onkeyup event occurs when a key is released over an element. This
426         attribute may be used with most elements.
427         
428         @param The script
429     */

430     public void setOnKeyUp(String JavaDoc script)
431     {
432         addAttribute ( "onkeyup", script );
433     }
434 }
435
Popular Tags