1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.htmlunit.javascript.host.html;
16
17 import org.htmlunit.html.HtmlTableColumn;
18 import org.htmlunit.html.HtmlTableColumnGroup;
19 import org.htmlunit.javascript.JavaScriptEngine;
20 import org.htmlunit.javascript.configuration.JsxClass;
21 import org.htmlunit.javascript.configuration.JsxConstructor;
22 import org.htmlunit.javascript.configuration.JsxGetter;
23 import org.htmlunit.javascript.configuration.JsxSetter;
24
25
26
27
28
29
30
31
32 @JsxClass(domClass = HtmlTableColumn.class)
33 @JsxClass(domClass = HtmlTableColumnGroup.class)
34 public class HTMLTableColElement extends HTMLElement {
35
36
37 private static final String VALIGN_DEFAULT_VALUE = "top";
38
39
40
41
42 @Override
43 @JsxConstructor
44 public void jsConstructor() {
45 super.jsConstructor();
46 }
47
48
49
50
51
52 @JsxGetter
53 public int getSpan() {
54 final String span = getDomNodeOrDie().getAttributeDirect("span");
55 int i;
56 try {
57 i = Integer.parseInt(span);
58 if (i < 1) {
59 i = 1;
60 }
61 }
62 catch (final NumberFormatException e) {
63 i = 1;
64 }
65 return i;
66 }
67
68
69
70
71
72 @JsxSetter
73 public void setSpan(final Object span) {
74 final double d = JavaScriptEngine.toNumber(span);
75 int i = (int) d;
76 if (i < 1) {
77 i = 1;
78 }
79 getDomNodeOrDie().setAttribute("span", Integer.toString(i));
80 }
81
82
83
84
85
86 @JsxGetter(propertyName = "width")
87 public String getWidth_js() {
88 return getWidthOrHeight("width", null);
89 }
90
91
92
93
94
95 @JsxSetter(propertyName = "width")
96 public void setWidth_js(final Object width) {
97 final String value = JavaScriptEngine.toString(width);
98 setWidthOrHeight("width", value, false);
99 }
100
101
102
103
104 @Override
105 protected boolean isEndTagForbidden() {
106 return getDomNodeOrDie() instanceof HtmlTableColumn;
107 }
108
109
110
111
112
113 @Override
114 public void setOuterHTML(final Object value) {
115 throw JavaScriptEngine.reportRuntimeError("outerHTML is read-only for tag '"
116 + getDomNodeOrDie().getNodeName() + "'");
117 }
118
119
120
121
122
123 @JsxGetter
124 public String getAlign() {
125 return getAlign(true);
126 }
127
128
129
130
131
132 @JsxSetter
133 public void setAlign(final String align) {
134 setAlign(align, false);
135 }
136
137
138
139
140
141 @JsxGetter
142 public String getVAlign() {
143 return getVAlign(getValidVAlignValues(), VALIGN_DEFAULT_VALUE);
144 }
145
146
147
148
149
150 @JsxSetter
151 public void setVAlign(final Object vAlign) {
152 setVAlign(vAlign, getValidVAlignValues());
153 }
154
155
156
157
158
159 private String[] getValidVAlignValues() {
160 return null;
161 }
162
163
164
165
166
167 @Override
168 @JsxGetter
169 public String getCh() {
170 return super.getCh();
171 }
172
173
174
175
176
177 @Override
178 @JsxSetter
179 public void setCh(final String ch) {
180 super.setCh(ch);
181 }
182
183
184
185
186
187 @Override
188 @JsxGetter
189 public String getChOff() {
190 return super.getChOff();
191 }
192
193
194
195
196
197 @Override
198 @JsxSetter
199 public void setChOff(final String chOff) {
200 super.setChOff(chOff);
201 }
202 }