KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ecs > html > 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.html;
59
60 import org.apache.ecs.*;
61
62 /**
63     This class creates a &lt;TR&gt; object.
64     @version $Id: TR.java,v 1.5 2003/04/27 09:03:39 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 */

68 public class TR extends MultiPartElement implements Printable, MouseEvents, KeyEvents
69 {
70     /**
71         Private initializer.
72     */

73     {
74         setElementType("tr");
75     }
76     /**
77         Basic Constructor use set* methods.
78     */

79     public TR()
80     {
81     }
82
83     /**
84         Basic Constructor use set* methods.
85     */

86     public TR(Element element)
87     {
88         addElement(element);
89     }
90
91     /**
92         Basic Constructor use set* methods.
93     */

94     public TR(String JavaDoc element)
95     {
96         addElement(element);
97     }
98
99     /**
100         Basic Constructor use set* methods.
101         @param close. Print the closing tag or not.
102     */

103     public TR(boolean close)
104     {
105         setNeedClosingTag(close);
106     }
107     /**
108         Sets the ALIGN="" attribute convience variables are provided in the AlignType interface
109         @param align Sets the ALIGN="" attribute
110     */

111     public TR setAlign(String JavaDoc align)
112     {
113         addAttribute("align",align);
114         return(this);
115     }
116
117     /**
118         Sets the ALIGN="" attribute convience variables are provided in the AlignType interface
119         @param align Sets the ALIGN="" attribute
120     */

121     public TR setVAlign(String JavaDoc valign)
122     {
123         addAttribute("valign",valign);
124         return(this);
125     }
126
127     /**
128         Sets the CHAR="" attribute.
129         @param character the character to use for alignment.
130     */

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

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

153     public TR setCharOff(String JavaDoc char_off)
154     {
155         addAttribute("charoff",char_off);
156         return(this);
157     }
158     
159     /**
160         Sets the BGCOLOR="" attribute
161         @param color sets the background color of the cell.
162     */

163     public TR setBgColor(String JavaDoc color)
164     {
165         addAttribute("bgcolor",HtmlColor.convertColor(color));
166         return(this);
167     }
168
169     /**
170         Adds an Element to the element.
171         @param hashcode name of element for hash table
172         @param element Adds an Element to the element.
173      */

174     public TR addElement(String JavaDoc hashcode,Element element)
175     {
176         addElementToRegistry(hashcode,element);
177         return(this);
178     }
179
180     /**
181         Adds an Element to the element.
182         @param hashcode name of element for hash table
183         @param element Adds an Element to the element.
184      */

185     public TR addElement(String JavaDoc hashcode,String JavaDoc element)
186     {
187         addElementToRegistry(hashcode,element);
188         return(this);
189     }
190
191     /**
192         Adds an Element to the element.
193         @param element Adds an Element to the element.
194      */

195     public TR addElement(Element element)
196     {
197         addElementToRegistry(element);
198         return(this);
199     }
200
201     /**
202         Adds an Element to the element.
203         @param element Adds an Element to the element.
204      */

205     public TR addElement(String JavaDoc element)
206     {
207         addElementToRegistry(element);
208         return(this);
209     }
210     /**
211         Removes an Element from the element.
212         @param hashcode the name of the element to be removed.
213     */

214     public TR removeElement(String JavaDoc hashcode)
215     {
216         removeElementFromRegistry(hashcode);
217         return(this);
218     }
219
220     /**
221         The onclick event occurs when the pointing device button is clicked
222         over an element. This attribute may be used with most elements.
223         
224         @param The script
225     */

226     public void setOnClick(String JavaDoc script)
227     {
228         addAttribute ( "onClick", script );
229     }
230     /**
231         The ondblclick event occurs when the pointing device button is double
232         clicked over an element. This attribute may be used with most elements.
233
234         @param The script
235     */

236     public void setOnDblClick(String JavaDoc script)
237     {
238         addAttribute ( "onDblClick", script );
239     }
240     /**
241         The onmousedown event occurs when the pointing device button is pressed
242         over an element. This attribute may be used with most elements.
243
244         @param The script
245     */

246     public void setOnMouseDown(String JavaDoc script)
247     {
248         addAttribute ( "onMouseDown", script );
249     }
250     /**
251         The onmouseup event occurs when the pointing device button is released
252         over an element. This attribute may be used with most elements.
253
254         @param The script
255     */

256     public void setOnMouseUp(String JavaDoc script)
257     {
258         addAttribute ( "onMouseUp", script );
259     }
260     /**
261         The onmouseover event occurs when the pointing device is moved onto an
262         element. This attribute may be used with most elements.
263
264         @param The script
265     */

266     public void setOnMouseOver(String JavaDoc script)
267     {
268         addAttribute ( "onMouseOver", script );
269     }
270     /**
271         The onmousemove event occurs when the pointing device is moved while it
272         is over an element. This attribute may be used with most elements.
273
274         @param The script
275     */

276     public void setOnMouseMove(String JavaDoc script)
277     {
278         addAttribute ( "onMouseMove", script );
279     }
280     /**
281         The onmouseout event occurs when the pointing device is moved away from
282         an element. This attribute may be used with most elements.
283
284         @param The script
285     */

286     public void setOnMouseOut(String JavaDoc script)
287     {
288         addAttribute ( "onMouseOut", script );
289     }
290
291     /**
292         The onkeypress event occurs when a key is pressed and released over an
293         element. This attribute may be used with most elements.
294         
295         @param The script
296     */

297     public void setOnKeyPress(String JavaDoc script)
298     {
299         addAttribute ( "onKeyPress", script );
300     }
301
302     /**
303         The onkeydown event occurs when a key is pressed down over an element.
304         This attribute may be used with most elements.
305         
306         @param The script
307     */

308     public void setOnKeyDown(String JavaDoc script)
309     {
310         addAttribute ( "onKeyDown", script );
311     }
312
313     /**
314         The onkeyup event occurs when a key is released over an element. This
315         attribute may be used with most elements.
316         
317         @param The script
318     */

319     public void setOnKeyUp(String JavaDoc script)
320     {
321         addAttribute ( "onKeyUp", script );
322     }
323 }
324
Popular Tags