1/*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation.  Oracle designates this
7 * particular file as subject to the "Classpath" exception as provided
8 * by Oracle in the LICENSE file that accompanied this code.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 */
24
25/*
26 * This file is available under and governed by the GNU General Public
27 * License version 2 only, as published by the Free Software Foundation.
28 * However, the following notice accompanied the original version of this
29 * file and, per its terms, should not be removed:
30 *
31 * Copyright (c) 2000 World Wide Web Consortium,
32 * (Massachusetts Institute of Technology, Institut National de
33 * Recherche en Informatique et en Automatique, Keio University). All
34 * Rights Reserved. This program is distributed under the W3C's Software
35 * Intellectual Property License. This program is distributed in the
36 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
37 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
38 * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
39 * details.
40 */
41
42package org.w3c.dom.html;
43
44import org.w3c.dom.DOMException;
45
46/**
47 *  The create* and delete* methods on the table allow authors to construct
48 * and modify tables. HTML 4.0 specifies that only one of each of the
49 * <code>CAPTION</code> , <code>THEAD</code> , and <code>TFOOT</code>
50 * elements may exist in a table. Therefore, if one exists, and the
51 * createTHead() or createTFoot() method is called, the method returns the
52 * existing THead or TFoot element. See the  TABLE element definition in HTML
53 * 4.0.
54 * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
55 *
56 * @since 1.4, DOM Level 2
57 */
58public interface HTMLTableElement extends HTMLElement {
59    /**
60     *  Returns the table's <code>CAPTION</code> , or void if none exists.
61     */
62    public HTMLTableCaptionElement getCaption();
63    public void setCaption(HTMLTableCaptionElement caption);
64
65    /**
66     *  Returns the table's <code>THEAD</code> , or <code>null</code> if none
67     * exists.
68     */
69    public HTMLTableSectionElement getTHead();
70    public void setTHead(HTMLTableSectionElement tHead);
71
72    /**
73     *  Returns the table's <code>TFOOT</code> , or <code>null</code> if none
74     * exists.
75     */
76    public HTMLTableSectionElement getTFoot();
77    public void setTFoot(HTMLTableSectionElement tFoot);
78
79    /**
80     *  Returns a collection of all the rows in the table, including all in
81     * <code>THEAD</code> , <code>TFOOT</code> , all <code>TBODY</code>
82     * elements.
83     */
84    public HTMLCollection getRows();
85
86    /**
87     *  Returns a collection of the defined table bodies.
88     */
89    public HTMLCollection getTBodies();
90
91    /**
92     *  Specifies the table's position with respect to the rest of the
93     * document. See the  align attribute definition in HTML 4.0. This
94     * attribute is deprecated in HTML 4.0.
95     */
96    public String getAlign();
97    public void setAlign(String align);
98
99    /**
100     *  Cell background color. See the  bgcolor attribute definition in HTML
101     * 4.0. This attribute is deprecated in HTML 4.0.
102     */
103    public String getBgColor();
104    public void setBgColor(String bgColor);
105
106    /**
107     *  The width of the border around the table. See the  border attribute
108     * definition in HTML 4.0.
109     */
110    public String getBorder();
111    public void setBorder(String border);
112
113    /**
114     *  Specifies the horizontal and vertical space between cell content and
115     * cell borders. See the  cellpadding attribute definition in HTML 4.0.
116     */
117    public String getCellPadding();
118    public void setCellPadding(String cellPadding);
119
120    /**
121     *  Specifies the horizontal and vertical separation between cells. See
122     * the  cellspacing attribute definition in HTML 4.0.
123     */
124    public String getCellSpacing();
125    public void setCellSpacing(String cellSpacing);
126
127    /**
128     *  Specifies which external table borders to render. See the  frame
129     * attribute definition in HTML 4.0.
130     */
131    public String getFrame();
132    public void setFrame(String frame);
133
134    /**
135     *  Specifies which internal table borders to render. See the  rules
136     * attribute definition in HTML 4.0.
137     */
138    public String getRules();
139    public void setRules(String rules);
140
141    /**
142     *  Description about the purpose or structure of a table. See the
143     * summary attribute definition in HTML 4.0.
144     */
145    public String getSummary();
146    public void setSummary(String summary);
147
148    /**
149     *  Specifies the desired table width. See the  width attribute definition
150     * in HTML 4.0.
151     */
152    public String getWidth();
153    public void setWidth(String width);
154
155    /**
156     *  Create a table header row or return an existing one.
157     * @return  A new table header element (<code>THEAD</code> ).
158     */
159    public HTMLElement createTHead();
160
161    /**
162     *  Delete the header from the table, if one exists.
163     */
164    public void deleteTHead();
165
166    /**
167     *  Create a table footer row or return an existing one.
168     * @return  A footer element (<code>TFOOT</code> ).
169     */
170    public HTMLElement createTFoot();
171
172    /**
173     *  Delete the footer from the table, if one exists.
174     */
175    public void deleteTFoot();
176
177    /**
178     *  Create a new table caption object or return an existing one.
179     * @return  A <code>CAPTION</code> element.
180     */
181    public HTMLElement createCaption();
182
183    /**
184     *  Delete the table caption, if one exists.
185     */
186    public void deleteCaption();
187
188    /**
189     *  Insert a new empty row in the table. The new row is inserted
190     * immediately before and in the same section as the current
191     * <code>index</code> th row in the table. If <code>index</code> is equal
192     * to the number of rows, the new row is appended. In addition, when the
193     * table is empty the row is inserted into a <code>TBODY</code> which is
194     * created and inserted into the table. Note. A table row cannot be empty
195     * according to HTML 4.0 Recommendation.
196     * @param index  The row number where to insert a new row. This index
197     *   starts from 0 and is relative to all the rows contained inside the
198     *   table, regardless of section parentage.
199     * @return  The newly created row.
200     * @exception DOMException
201     *    INDEX_SIZE_ERR: Raised if the specified index is greater than the
202     *   number of rows or if the index is negative.
203     */
204    public HTMLElement insertRow(int index)
205                                 throws DOMException;
206
207    /**
208     *  Delete a table row.
209     * @param index  The index of the row to be deleted. This index starts
210     *   from 0 and is relative to all the rows contained inside the table,
211     *   regardless of section parentage.
212     * @exception DOMException
213     *    INDEX_SIZE_ERR: Raised if the specified index is greater than or
214     *   equal to the number of rows or if the index is negative.
215     */
216    public void deleteRow(int index)
217                          throws DOMException;
218
219}
220