View Javadoc
1   /*
2    * Copyright (c) 2002-2025 Gargoyle Software Inc.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * https://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  package org.htmlunit.html;
16  
17  import java.util.Map;
18  
19  import org.htmlunit.SgmlPage;
20  
21  /**
22   * Wrapper for the HTML "th" tag.
23   *
24   * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
25   * @author David K. Taylor
26   * @author <a href="mailto:cse@dynabean.de">Christian Sell</a>
27   * @author Ahmed Ashour
28   * @author Frank Danek
29   */
30  public class HtmlTableHeaderCell extends HtmlTableCell {
31  
32      /** The HTML tag represented by this element. */
33      public static final String TAG_NAME = "th";
34  
35      /**
36       * Creates an instance.
37       *
38       * @param qualifiedName the qualified name of the element type to instantiate
39       * @param page the page that this element is contained within
40       * @param attributes the initial attributes
41       */
42      HtmlTableHeaderCell(final String qualifiedName, final SgmlPage page,
43              final Map<String, DomAttr> attributes) {
44          super(qualifiedName, page, attributes);
45      }
46  
47      /**
48       * Returns the value of the attribute {@code abbr}. Refer to the
49       * <a href="http://www.w3.org/TR/html401/">HTML 4.01</a>
50       * documentation for details on the use of this attribute.
51       *
52       * @return the value of the attribute {@code abbr}
53       *         or an empty string if that attribute isn't defined.
54       */
55      public final String getAbbrAttribute() {
56          return getAttributeDirect("abbr");
57      }
58  
59      /**
60       * Returns the value of the attribute {@code axis}. Refer to the
61       * <a href="http://www.w3.org/TR/html401/">HTML 4.01</a>
62       * documentation for details on the use of this attribute.
63       *
64       * @return the value of the attribute {@code axis}
65       *         or an empty string if that attribute isn't defined.
66       */
67      public final String getAxisAttribute() {
68          return getAttributeDirect("axis");
69      }
70  
71      /**
72       * Returns the value of the attribute {@code headers}. Refer to the
73       * <a href="http://www.w3.org/TR/html401/">HTML 4.01</a>
74       * documentation for details on the use of this attribute.
75       *
76       * @return the value of the attribute {@code headers}
77       *         or an empty string if that attribute isn't defined.
78       */
79      public final String getHeadersAttribute() {
80          return getAttributeDirect("headers");
81      }
82  
83      /**
84       * Returns the value of the attribute {@code scope}. Refer to the
85       * <a href="http://www.w3.org/TR/html401/">HTML 4.01</a>
86       * documentation for details on the use of this attribute.
87       *
88       * @return the value of the attribute {@code scope}
89       *         or an empty string if that attribute isn't defined.
90       */
91      public final String getScopeAttribute() {
92          return getAttributeDirect("scope");
93      }
94  
95      /**
96       * Returns the value of the attribute {@code rowspan}. Refer to the
97       * <a href="http://www.w3.org/TR/html401/">HTML 4.01</a>
98       * documentation for details on the use of this attribute.
99       *
100      * @return the value of the attribute {@code rowspan}
101      *         or an empty string if that attribute isn't defined.
102      */
103     public final String getRowSpanAttribute() {
104         return getAttributeDirect("rowspan");
105     }
106 
107     /**
108      * Returns the value of the attribute {@code colspan}. Refer to the
109      * <a href="http://www.w3.org/TR/html401/">HTML 4.01</a>
110      * documentation for details on the use of this attribute.
111      *
112      * @return the value of the attribute {@code colspan}
113      *         or an empty string if that attribute isn't defined.
114      */
115     public final String getColumnSpanAttribute() {
116         return getAttributeDirect("colspan");
117     }
118 
119     /**
120      * Returns the value of the attribute {@code align}. Refer to the
121      * <a href="http://www.w3.org/TR/html401/">HTML 4.01</a>
122      * documentation for details on the use of this attribute.
123      *
124      * @return the value of the attribute {@code align}
125      *         or an empty string if that attribute isn't defined.
126      */
127     public final String getAlignAttribute() {
128         return getAttributeDirect("align");
129     }
130 
131     /**
132      * Returns the value of the attribute {@code char}. Refer to the
133      * <a href="http://www.w3.org/TR/html401/">HTML 4.01</a>
134      * documentation for details on the use of this attribute.
135      *
136      * @return the value of the attribute {@code char}
137      *         or an empty string if that attribute isn't defined.
138      */
139     public final String getCharAttribute() {
140         return getAttributeDirect("char");
141     }
142 
143     /**
144      * Returns the value of the attribute {@code charoff}. Refer to the
145      * <a href="http://www.w3.org/TR/html401/">HTML 4.01</a>
146      * documentation for details on the use of this attribute.
147      *
148      * @return the value of the attribute {@code charoff}
149      *         or an empty string if that attribute isn't defined.
150      */
151     public final String getCharoffAttribute() {
152         return getAttributeDirect("charoff");
153     }
154 
155     /**
156      * Returns the value of the attribute {@code valign}. Refer to the
157      * <a href="http://www.w3.org/TR/html401/">HTML 4.01</a>
158      * documentation for details on the use of this attribute.
159      *
160      * @return the value of the attribute {@code valign}
161      *         or an empty string if that attribute isn't defined.
162      */
163     public final String getValignAttribute() {
164         return getAttributeDirect("valign");
165     }
166 
167     /**
168      * Returns the value of the attribute {@code nowrap}. Refer to the
169      * <a href="http://www.w3.org/TR/html401/">HTML 4.01</a>
170      * documentation for details on the use of this attribute.
171      *
172      * @return the value of the attribute {@code nowrap}
173      *         or an empty string if that attribute isn't defined.
174      */
175     public final String getNoWrapAttribute() {
176         return getAttributeDirect("nowrap");
177     }
178 
179     /**
180      * Returns the value of the attribute {@code bgcolor}. Refer to the
181      * <a href="http://www.w3.org/TR/html401/">HTML 4.01</a>
182      * documentation for details on the use of this attribute.
183      *
184      * @return the value of the attribute {@code bgcolor}
185      *         or an empty string if that attribute isn't defined.
186      */
187     public final String getBgcolorAttribute() {
188         return getAttributeDirect("bgcolor");
189     }
190 
191     /**
192      * Returns the value of the attribute {@code width}. Refer to the
193      * <a href="http://www.w3.org/TR/html401/">HTML 4.01</a>
194      * documentation for details on the use of this attribute.
195      *
196      * @return the value of the attribute {@code width}
197      *         or an empty string if that attribute isn't defined.
198      */
199     public final String getWidthAttribute() {
200         return getAttributeDirect("width");
201     }
202 
203     /**
204      * Returns the value of the attribute {@code height}. Refer to the
205      * <a href="http://www.w3.org/TR/html401/">HTML 4.01</a>
206      * documentation for details on the use of this attribute.
207      *
208      * @return the value of the attribute {@code height}
209      *         or an empty string if that attribute isn't defined.
210      */
211     public final String getHeightAttribute() {
212         return getAttributeDirect("height");
213     }
214 }