KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > lobobrowser > html > domimpl > HTMLTableCellElementImpl


1 /*
2     GNU LESSER GENERAL PUBLIC LICENSE
3     Copyright (C) 2006 The Lobo Project
4
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Lesser General Public
7     License as published by the Free Software Foundation; either
8     version 2.1 of the License, or (at your option) any later version.
9
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13     Lesser General Public License for more details.
14
15     You should have received a copy of the GNU Lesser General Public
16     License along with this library; if not, write to the Free Software
17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19     Contact info: xamjadmin@users.sourceforge.net
20 */

21 /*
22  * Created on Dec 4, 2005
23  */

24 package org.lobobrowser.html.domimpl;
25
26 import org.lobobrowser.html.style.*;
27 import org.w3c.dom.html2.HTMLTableCellElement;
28
29 public class HTMLTableCellElementImpl extends HTMLAbstractUIElement implements
30         HTMLTableCellElement {
31     public HTMLTableCellElementImpl(String JavaDoc name) {
32         super(name);
33     }
34
35     public int getCellIndex() {
36         // TODO Cell index in row
37
return 0;
38     }
39
40     public String JavaDoc getAbbr() {
41         return this.getAttribute("abbr");
42     }
43
44     public void setAbbr(String JavaDoc abbr) {
45         this.setAttribute("abbr", abbr);
46     }
47
48     public String JavaDoc getAlign() {
49         return this.getAttribute("align");
50     }
51
52     public void setAlign(String JavaDoc align) {
53         this.setAttribute("align", align);
54     }
55
56     public String JavaDoc getAxis() {
57         return this.getAttribute("axis");
58     }
59
60     public void setAxis(String JavaDoc axis) {
61         this.setAttribute("axis", axis);
62     }
63
64     public String JavaDoc getBgColor() {
65         return this.getAttribute("bgcolor");
66     }
67
68     public void setBgColor(String JavaDoc bgColor) {
69         this.setAttribute("bgcolor", bgColor);
70     }
71
72     public String JavaDoc getCh() {
73         return this.getAttribute("ch");
74     }
75
76     public void setCh(String JavaDoc ch) {
77         this.setAttribute("ch", ch);
78     }
79
80     public String JavaDoc getChOff() {
81         return this.getAttribute("choff");
82     }
83
84     public void setChOff(String JavaDoc chOff) {
85         this.setAttribute("choff", chOff);
86     }
87
88     public int getColSpan() {
89         String JavaDoc colSpanText = this.getAttribute("colspan");
90         if(colSpanText == null) {
91             return 1;
92         }
93         else {
94             try {
95                 return Integer.parseInt(colSpanText);
96             } catch(NumberFormatException JavaDoc nfe) {
97                 return 1;
98             }
99         }
100     }
101
102     public void setColSpan(int colSpan) {
103         this.setAttribute("colspan", String.valueOf(colSpan));
104     }
105
106     public String JavaDoc getHeaders() {
107         return this.getAttribute("headers");
108     }
109
110     public void setHeaders(String JavaDoc headers) {
111         this.setAttribute("headers", headers);
112     }
113
114     public String JavaDoc getHeight() {
115         return this.getAttribute("height");
116     }
117
118     public void setHeight(String JavaDoc height) {
119         this.setAttribute("height", height);
120     }
121     
122     public boolean getNoWrap() {
123         return "nowrap".equalsIgnoreCase(this.getAttribute("nowrap"));
124     }
125
126     public void setNoWrap(boolean noWrap) {
127         this.setAttribute("nowrap", noWrap ? "nowrap" : null);
128     }
129
130     public int getRowSpan() {
131         String JavaDoc rowSpanText = this.getAttribute("rowspan");
132         if(rowSpanText == null) {
133             return 1;
134         }
135         else {
136             try {
137                 return Integer.parseInt(rowSpanText);
138             } catch(NumberFormatException JavaDoc nfe) {
139                 return 1;
140             }
141         }
142     }
143
144     public void setRowSpan(int rowSpan) {
145         this.setAttribute("rowspan", String.valueOf(rowSpan));
146     }
147
148     public String JavaDoc getScope() {
149         return this.getAttribute("scope");
150     }
151
152     public void setScope(String JavaDoc scope) {
153         this.setAttribute("scope", scope);
154     }
155
156     public String JavaDoc getVAlign() {
157         return this.getAttribute("valign");
158     }
159
160     public void setVAlign(String JavaDoc vAlign) {
161         this.setAttribute("valign", vAlign);
162     }
163
164     public String JavaDoc getWidth() {
165         return this.getAttribute("width");
166     }
167
168     public void setWidth(String JavaDoc width) {
169         this.setAttribute("width", width);
170     }
171
172     protected RenderState createRenderState(RenderState prevRenderState) {
173         return new TableCellRenderState(prevRenderState, this);
174     }
175 }
176
Popular Tags