KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > xml > xhtml > dom > xerces > XHTMLTableCellElementImpl


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Original Code is DigitalSesame
15  * Portions created by DigitalSesame are Copyright (C) 1997-2000 DigitalSesame
16  * All Rights Reserved.
17  *
18  * Contributor(s):
19  * Rex Tsai <chihchun@digitalsesame.com>
20  * David Li <david@digitalsesam.com>
21  *
22  * $Id: XHTMLTableCellElementImpl.java,v 1.2 2005/01/26 08:29:24 jkjome Exp $
23  */

24
25 package org.enhydra.xml.xhtml.dom.xerces;
26
27 import org.w3c.dom.Node JavaDoc;
28 import org.w3c.dom.html.HTMLTableCellElement;
29 import org.w3c.dom.html.HTMLTableRowElement;
30
31 public class XHTMLTableCellElementImpl
32     extends XHTMLElementImpl
33     implements org.enhydra.xml.xhtml.dom.XHTMLTableCellElement
34 {
35
36     public XHTMLTableCellElementImpl (XHTMLDocumentBase owner, String JavaDoc namespaceURI, String JavaDoc tagName) {
37     super( owner, namespaceURI, tagName);
38     }
39
40         public void setId (String JavaDoc newValue) {
41     setAttribute("id", newValue);
42     }
43
44     public String JavaDoc getId () {
45     return getAttribute ("id");
46     }
47     public void setLang (String JavaDoc newValue) {
48     setAttribute("lang", newValue);
49     }
50
51     public String JavaDoc getLang () {
52     return getAttribute ("lang");
53     }
54     public void setDir (String JavaDoc newValue) {
55     setAttribute("dir", newValue);
56     }
57
58     public String JavaDoc getDir () {
59     return getAttribute ("dir");
60     }
61     public void setClassName (String JavaDoc newValue) {
62     setAttribute("class", newValue);
63     }
64
65     public String JavaDoc getClassName () {
66     return getAttribute ("class");
67     }
68     public void setTitle (String JavaDoc newValue) {
69     setAttribute("title", newValue);
70     }
71
72     public String JavaDoc getTitle () {
73     return getAttribute ("title");
74     }
75     public void setAlign (String JavaDoc newValue) {
76     setAttribute("align", newValue);
77     }
78
79     public String JavaDoc getAlign () {
80     return getAttribute ("align");
81     }
82     public void setHeight (String JavaDoc newValue) {
83     setAttribute("height", newValue);
84     }
85
86     public String JavaDoc getHeight () {
87     return getAttribute ("height");
88     }
89     public void setWidth (String JavaDoc newValue) {
90     setAttribute("width", newValue);
91     }
92
93     public String JavaDoc getWidth () {
94     return getAttribute ("width");
95     }
96     public void setBgColor (String JavaDoc newValue) {
97     setAttribute("bgcolor", newValue);
98     }
99
100     public String JavaDoc getBgColor () {
101     return getAttribute ("bgcolor");
102     }
103     public void setAbbr (String JavaDoc newValue) {
104     setAttribute("abbr", newValue);
105     }
106
107     public String JavaDoc getAbbr () {
108     return getAttribute ("abbr");
109     }
110     public void setAxis (String JavaDoc newValue) {
111     setAttribute("axis", newValue);
112     }
113
114     public String JavaDoc getAxis () {
115     return getAttribute ("axis");
116     }
117     public void setColSpan (int newValue) {
118     setAttribute("colspan", newValue);
119     }
120
121     public int getColSpan () {
122     return getIntAttribute ("colspan");
123     }
124     public void setHeaders (String JavaDoc newValue) {
125     setAttribute("headers", newValue);
126     }
127
128     public String JavaDoc getHeaders () {
129     return getAttribute ("headers");
130     }
131     public void setNoWrap (boolean newValue) {
132     setAttribute("nowrap", newValue);
133     }
134
135     public boolean getNoWrap () {
136     return getBooleanAttribute("nowrap");
137     }
138     public void setRowSpan (int newValue) {
139     setAttribute("rowspan", newValue);
140     }
141
142     public int getRowSpan () {
143     return getIntAttribute ("rowspan");
144     }
145     public void setScope (String JavaDoc newValue) {
146     setAttribute("scope", newValue);
147     }
148
149     public String JavaDoc getScope () {
150     return getAttribute ("scope");
151     }
152     public void setVAlign (String JavaDoc newValue) {
153     setAttribute("valign", newValue);
154     }
155
156     public String JavaDoc getVAlign () {
157     return getAttribute ("valign");
158     }
159     public void setOnKeyUp (String JavaDoc newValue) {
160     setAttribute("onkeyup", newValue);
161     }
162
163     public String JavaDoc getOnKeyUp () {
164     return getAttribute ("onkeyup");
165     }
166     public void setStyle (String JavaDoc newValue) {
167     setAttribute("style", newValue);
168     }
169
170     public String JavaDoc getStyle () {
171     return getAttribute ("style");
172     }
173     public void setOnMouseDown (String JavaDoc newValue) {
174     setAttribute("onmousedown", newValue);
175     }
176
177     public String JavaDoc getOnMouseDown () {
178     return getAttribute ("onmousedown");
179     }
180     public void setOnKeyPress (String JavaDoc newValue) {
181     setAttribute("onkeypress", newValue);
182     }
183
184     public String JavaDoc getOnKeyPress () {
185     return getAttribute ("onkeypress");
186     }
187     public void setOnDblClick (String JavaDoc newValue) {
188     setAttribute("ondblclick", newValue);
189     }
190
191     public String JavaDoc getOnDblClick () {
192     return getAttribute ("ondblclick");
193     }
194     public void setOnKeyDown (String JavaDoc newValue) {
195     setAttribute("onkeydown", newValue);
196     }
197
198     public String JavaDoc getOnKeyDown () {
199     return getAttribute ("onkeydown");
200     }
201     public void setOnMouseMove (String JavaDoc newValue) {
202     setAttribute("onmousemove", newValue);
203     }
204
205     public String JavaDoc getOnMouseMove () {
206     return getAttribute ("onmousemove");
207     }
208     public void setOnMouseUp (String JavaDoc newValue) {
209     setAttribute("onmouseup", newValue);
210     }
211
212     public String JavaDoc getOnMouseUp () {
213     return getAttribute ("onmouseup");
214     }
215     public void setXmlLang (String JavaDoc newValue) {
216     setAttribute("xml:lang", newValue);
217     }
218
219     public String JavaDoc getXmlLang () {
220     return getAttribute ("xml:lang");
221     }
222     public void setOnMouseOut (String JavaDoc newValue) {
223     setAttribute("onmouseout", newValue);
224     }
225
226     public String JavaDoc getOnMouseOut () {
227     return getAttribute ("onmouseout");
228     }
229     public void setOnClick (String JavaDoc newValue) {
230     setAttribute("onclick", newValue);
231     }
232
233     public String JavaDoc getOnClick () {
234     return getAttribute ("onclick");
235     }
236     public void setOnMouseOver (String JavaDoc newValue) {
237     setAttribute("onmouseover", newValue);
238     }
239
240     public String JavaDoc getOnMouseOver () {
241     return getAttribute ("onmouseover");
242     }
243     public void setChOff (String JavaDoc newValue) {
244     setAttribute("charoff", newValue);
245     }
246
247     public String JavaDoc getChOff () {
248     return getAttribute ("charoff");
249     }
250     
251     public int getCellIndex() {
252         Node JavaDoc parent;
253         Node JavaDoc child;
254         int index;
255         
256         parent = getParentNode();
257         index = 0;
258         if ( parent instanceof HTMLTableRowElement )
259         {
260             child = parent.getFirstChild();
261             while ( child != null )
262             {
263                 if ( child instanceof HTMLTableCellElement )
264                 {
265                     if ( child == this )
266                         return index;
267                     ++ index;
268                 }
269                 child = child.getNextSibling();
270             }
271         }
272         return -1;
273     }
274     
275     
276     public void setCellIndex( int cellIndex ) {
277         Node JavaDoc parent;
278         Node JavaDoc child;
279         int index;
280         
281         parent = getParentNode();
282         if ( parent instanceof HTMLTableRowElement )
283         {
284             child = parent.getFirstChild();
285             while ( child != null )
286             {
287                 if ( child instanceof HTMLTableCellElement )
288                 {
289                     if ( cellIndex == 0 )
290                     {
291                         if ( this != child )
292                             parent.insertBefore( this, child );
293                         return;
294                     }
295                     -- cellIndex;
296                 }
297                 child = child.getNextSibling();
298             }
299         }
300         parent.appendChild( this );
301     }
302
303     public String JavaDoc getCh() {
304         String JavaDoc ch;
305         
306         // Make sure that the access key is a single character.
307
ch = getAttribute( "char" );
308         if ( ch != null && ch.length() > 1 )
309             ch = ch.substring( 0, 1 );
310         return ch;
311     }
312     
313     
314     public void setCh( String JavaDoc ch ) {
315         // Make sure that the access key is a single character.
316
if ( ch != null && ch.length() > 1 )
317             ch = ch.substring( 0, 1 );
318         setAttribute( "char", ch );
319     }
320 }
321
322
323
Popular Tags