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 
  42 package org.w3c.dom.html;
  43 
  44 import 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 public interface HTMLTableElement extends HTMLElement {
  57     /**
  58      *  Returns the table's <code>CAPTION</code> , or void if none exists.
  59      */
  60     public HTMLTableCaptionElement getCaption();
  61     public void setCaption(HTMLTableCaptionElement caption);
  62 
  63     /**
  64      *  Returns the table's <code>THEAD</code> , or <code>null</code> if none
  65      * exists.
  66      */
  67     public HTMLTableSectionElement getTHead();
  68     public void setTHead(HTMLTableSectionElement tHead);
  69 
  70     /**
  71      *  Returns the table's <code>TFOOT</code> , or <code>null</code> if none
  72      * exists.
  73      */
  74     public HTMLTableSectionElement getTFoot();
  75     public void setTFoot(HTMLTableSectionElement tFoot);
  76 
  77     /**
  78      *  Returns a collection of all the rows in the table, including all in
  79      * <code>THEAD</code> , <code>TFOOT</code> , all <code>TBODY</code>
  80      * elements.
  81      */
  82     public HTMLCollection getRows();
  83 
  84     /**
  85      *  Returns a collection of the defined table bodies.
  86      */
  87     public HTMLCollection getTBodies();
  88 
  89     /**
  90      *  Specifies the table's position with respect to the rest of the
  91      * document. See the  align attribute definition in HTML 4.0. This
  92      * attribute is deprecated in HTML 4.0.
  93      */
  94     public String getAlign();
  95     public void setAlign(String align);
  96 
  97     /**
  98      *  Cell background color. See the  bgcolor attribute definition in HTML
  99      * 4.0. This attribute is deprecated in HTML 4.0.
 100      */
 101     public String getBgColor();
 102     public void setBgColor(String bgColor);
 103 
 104     /**
 105      *  The width of the border around the table. See the  border attribute
 106      * definition in HTML 4.0.
 107      */
 108     public String getBorder();
 109     public void setBorder(String border);
 110 
 111     /**
 112      *  Specifies the horizontal and vertical space between cell content and
 113      * cell borders. See the  cellpadding attribute definition in HTML 4.0.
 114      */
 115     public String getCellPadding();
 116     public void setCellPadding(String cellPadding);
 117 
 118     /**
 119      *  Specifies the horizontal and vertical separation between cells. See
 120      * the  cellspacing attribute definition in HTML 4.0.
 121      */
 122     public String getCellSpacing();
 123     public void setCellSpacing(String cellSpacing);
 124 
 125     /**
 126      *  Specifies which external table borders to render. See the  frame
 127      * attribute definition in HTML 4.0.
 128      */
 129     public String getFrame();
 130     public void setFrame(String frame);
 131 
 132     /**
 133      *  Specifies which internal table borders to render. See the  rules
 134      * attribute definition in HTML 4.0.
 135      */
 136     public String getRules();
 137     public void setRules(String rules);
 138 
 139     /**
 140      *  Description about the purpose or structure of a table. See the
 141      * summary attribute definition in HTML 4.0.
 142      */
 143     public String getSummary();
 144     public void setSummary(String summary);
 145 
 146     /**
 147      *  Specifies the desired table width. See the  width attribute definition
 148      * in HTML 4.0.
 149      */
 150     public String getWidth();
 151     public void setWidth(String width);
 152 
 153     /**
 154      *  Create a table header row or return an existing one.
 155      * @return  A new table header element (<code>THEAD</code> ).
 156      */
 157     public HTMLElement createTHead();
 158 
 159     /**
 160      *  Delete the header from the table, if one exists.
 161      */
 162     public void deleteTHead();
 163 
 164     /**
 165      *  Create a table footer row or return an existing one.
 166      * @return  A footer element (<code>TFOOT</code> ).
 167      */
 168     public HTMLElement createTFoot();
 169 
 170     /**
 171      *  Delete the footer from the table, if one exists.
 172      */
 173     public void deleteTFoot();
 174 
 175     /**
 176      *  Create a new table caption object or return an existing one.
 177      * @return  A <code>CAPTION</code> element.
 178      */
 179     public HTMLElement createCaption();
 180 
 181     /**
 182      *  Delete the table caption, if one exists.
 183      */
 184     public void deleteCaption();
 185 
 186     /**
 187      *  Insert a new empty row in the table. The new row is inserted
 188      * immediately before and in the same section as the current
 189      * <code>index</code> th row in the table. If <code>index</code> is equal
 190      * to the number of rows, the new row is appended. In addition, when the
 191      * table is empty the row is inserted into a <code>TBODY</code> which is
 192      * created and inserted into the table. Note. A table row cannot be empty
 193      * according to HTML 4.0 Recommendation.
 194      * @param index  The row number where to insert a new row. This index
 195      *   starts from 0 and is relative to all the rows contained inside the
 196      *   table, regardless of section parentage.
 197      * @return  The newly created row.
 198      * @exception DOMException
 199      *    INDEX_SIZE_ERR: Raised if the specified index is greater than the
 200      *   number of rows or if the index is negative.
 201      */
 202     public HTMLElement insertRow(int index)
 203                                  throws DOMException;
 204 
 205     /**
 206      *  Delete a table row.
 207      * @param index  The index of the row to be deleted. This index starts
 208      *   from 0 and is relative to all the rows contained inside the table,
 209      *   regardless of section parentage.
 210      * @exception DOMException
 211      *    INDEX_SIZE_ERR: Raised if the specified index is greater than or
 212      *   equal to the number of rows or if the index is negative.
 213      */
 214     public void deleteRow(int index)
 215                           throws DOMException;
 216 
 217 }