KickJava   Java API By Example, From Geeks To Geeks.

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


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;tr&gt; object.
64     @version $Id: tr.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 tr extends MultiPartElement implements Printable, MouseEvents, KeyEvents
70 {
71     /**
72         Private initializer.
73     */

74     {
75         setElementType("tr");
76         setCase(LOWERCASE);
77         setAttributeQuote(true);
78     }
79     /**
80         Basic Constructor use set* methods.
81     */

82     public tr()
83     {
84     }
85
86     /**
87         Basic Constructor use set* methods.
88     */

89     public tr(Element element)
90     {
91         addElement(element);
92     }
93
94     /**
95         Basic Constructor use set* methods.
96     */

97     public tr(String JavaDoc element)
98     {
99         addElement(element);
100     }
101
102     /*
103         Basic Constructor use set* methods.
104         @param close. Print the closing tag or not.
105      *
106     public tr(boolean close)
107     {
108         setNeedClosingTag(close);
109     }*/

110     /**
111         Sets the align="" attribute convience variables are provided in the AlignType interface
112         @param align Sets the align="" attribute
113     */

114     public tr setAlign(String JavaDoc align)
115     {
116         addAttribute("align",align);
117         return(this);
118     }
119
120     /**
121         Sets the valign="" attribute convience variables are provided in the AlignType interface
122         @param align Sets the valign="" attribute
123     */

124     public tr setVAlign(String JavaDoc valign)
125     {
126         addAttribute("valign",valign);
127         return(this);
128     }
129
130     /**
131         Sets the char="" attribute.
132         @param character the character to use for alignment.
133     */

134     public tr setChar(String JavaDoc character)
135     {
136         addAttribute("char",character);
137         return(this);
138     }
139
140     /**
141         Sets the charoff="" attribute.
142         @param char_off When present this attribute specifies the offset
143         of the first occurrence of the alignment character on each line.
144     */

145     public tr setCharOff(int char_off)
146     {
147         addAttribute("charoff",Integer.toString(char_off));
148         return(this);
149     }
150
151     /**
152         Sets the charoff="" attribute.
153         @param char_off When present this attribute specifies the offset
154         of the first occurrence of the alignment character on each line.
155     */

156     public tr setCharOff(String JavaDoc char_off)
157     {
158         addAttribute("charoff",char_off);
159         return(this);
160     }
161     
162     /**
163         Sets the bgcolor="" attribute
164         @param color sets the background color of the cell.
165     */

166     public tr setBgColor(String JavaDoc color)
167     {
168         addAttribute("bgcolor",HtmlColor.convertColor(color));
169         return(this);
170     }
171
172     /**
173         Sets the lang="" and xml:lang="" attributes
174         @param lang the lang="" and xml:lang="" attributes
175     */

176     public Element setLang(String JavaDoc lang)
177     {
178         addAttribute("lang",lang);
179         addAttribute("xml:lang",lang);
180         return this;
181     }
182
183     /**
184         Adds an Element to the element.
185         @param hashcode name of element for hash table
186         @param element Adds an Element to the element.
187      */

188     public tr addElement(String JavaDoc hashcode,Element element)
189     {
190         addElementToRegistry(hashcode,element);
191         return(this);
192     }
193
194     /**
195         Adds an Element to the element.
196         @param hashcode name of element for hash table
197         @param element Adds an Element to the element.
198      */

199     public tr addElement(String JavaDoc hashcode,String JavaDoc element)
200     {
201         addElementToRegistry(hashcode,element);
202         return(this);
203     }
204
205     /**
206         Adds an Element to the element.
207         @param element Adds an Element to the element.
208      */

209     public tr addElement(Element element)
210     {
211         addElementToRegistry(element);
212         return(this);
213     }
214
215     /**
216         Adds an Element to the element.
217         @param element Adds an Element to the element.
218      */

219     public tr addElement(String JavaDoc element)
220     {
221         addElementToRegistry(element);
222         return(this);
223     }
224     /**
225         Removes an Element from the element.
226         @param hashcode the name of the element to be removed.
227     */

228     public tr removeElement(String JavaDoc hashcode)
229     {
230         removeElementFromRegistry(hashcode);
231         return(this);
232     }
233
234     /**
235         The onclick event occurs when the pointing device button is clicked
236         over an element. This attribute may be used with most elements.
237         
238         @param The script
239     */

240     public void setOnClick(String JavaDoc script)
241     {
242         addAttribute ( "onclick", script );
243     }
244     /**
245         The ondblclick event occurs when the pointing device button is double
246         clicked over an element. This attribute may be used with most elements.
247
248         @param The script
249     */

250     public void setOnDblClick(String JavaDoc script)
251     {
252         addAttribute ( "ondblclick", script );
253     }
254     /**
255         The onmousedown event occurs when the pointing device button is pressed
256         over an element. This attribute may be used with most elements.
257
258         @param The script
259     */

260     public void setOnMouseDown(String JavaDoc script)
261     {
262         addAttribute ( "onmousedown", script );
263     }
264     /**
265         The onmouseup event occurs when the pointing device button is released
266         over an element. This attribute may be used with most elements.
267
268         @param The script
269     */

270     public void setOnMouseUp(String JavaDoc script)
271     {
272         addAttribute ( "onmouseup", script );
273     }
274     /**
275         The onmouseover event occurs when the pointing device is moved onto an
276         element. This attribute may be used with most elements.
277
278         @param The script
279     */

280     public void setOnMouseOver(String JavaDoc script)
281     {
282         addAttribute ( "onmouseover", script );
283     }
284     /**
285         The onmousemove event occurs when the pointing device is moved while it
286         is over an element. This attribute may be used with most elements.
287
288         @param The script
289     */

290     public void setOnMouseMove(String JavaDoc script)
291     {
292         addAttribute ( "onmousemove", script );
293     }
294     /**
295         The onmouseout event occurs when the pointing device is moved away from
296         an element. This attribute may be used with most elements.
297
298         @param The script
299     */

300     public void setOnMouseOut(String JavaDoc script)
301     {
302         addAttribute ( "onmouseout", script );
303     }
304
305     /**
306         The onkeypress event occurs when a key is pressed and released over an
307         element. This attribute may be used with most elements.
308         
309         @param The script
310     */

311     public void setOnKeyPress(String JavaDoc script)
312     {
313         addAttribute ( "onkeypress", script );
314     }
315
316     /**
317         The onkeydown event occurs when a key is pressed down over an element.
318         This attribute may be used with most elements.
319         
320         @param The script
321     */

322     public void setOnKeyDown(String JavaDoc script)
323     {
324         addAttribute ( "onkeydown", script );
325     }
326
327     /**
328         The onkeyup event occurs when a key is released over an element. This
329         attribute may be used with most elements.
330         
331         @param The script
332     */

333     public void setOnKeyUp(String JavaDoc script)
334     {
335         addAttribute ( "onkeyup", script );
336     }
337 }
338
Popular Tags