1. /*
  2. * Copyright (c) 2000 World Wide Web Consortium,
  3. * (Massachusetts Institute of Technology, Institut National de
  4. * Recherche en Informatique et en Automatique, Keio University). All
  5. * Rights Reserved. This program is distributed under the W3C's Software
  6. * Intellectual Property License. This program is distributed in the
  7. * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
  8. * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  9. * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
  10. * details.
  11. */
  12. package org.w3c.dom.html;
  13. import org.w3c.dom.DOMException;
  14. /**
  15. * The create* and delete* methods on the table allow authors to construct
  16. * and modify tables. HTML 4.0 specifies that only one of each of the
  17. * <code>CAPTION</code> , <code>THEAD</code> , and <code>TFOOT</code>
  18. * elements may exist in a table. Therefore, if one exists, and the
  19. * createTHead() or createTFoot() method is called, the method returns the
  20. * existing THead or TFoot element. See the TABLE element definition in HTML
  21. * 4.0.
  22. * <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>.
  23. */
  24. public interface HTMLTableElement extends HTMLElement {
  25. /**
  26. * Returns the table's <code>CAPTION</code> , or void if none exists.
  27. */
  28. public HTMLTableCaptionElement getCaption();
  29. public void setCaption(HTMLTableCaptionElement caption);
  30. /**
  31. * Returns the table's <code>THEAD</code> , or <code>null</code> if none
  32. * exists.
  33. */
  34. public HTMLTableSectionElement getTHead();
  35. public void setTHead(HTMLTableSectionElement tHead);
  36. /**
  37. * Returns the table's <code>TFOOT</code> , or <code>null</code> if none
  38. * exists.
  39. */
  40. public HTMLTableSectionElement getTFoot();
  41. public void setTFoot(HTMLTableSectionElement tFoot);
  42. /**
  43. * Returns a collection of all the rows in the table, including all in
  44. * <code>THEAD</code> , <code>TFOOT</code> , all <code>TBODY</code>
  45. * elements.
  46. */
  47. public HTMLCollection getRows();
  48. /**
  49. * Returns a collection of the defined table bodies.
  50. */
  51. public HTMLCollection getTBodies();
  52. /**
  53. * Specifies the table's position with respect to the rest of the
  54. * document. See the align attribute definition in HTML 4.0. This
  55. * attribute is deprecated in HTML 4.0.
  56. */
  57. public String getAlign();
  58. public void setAlign(String align);
  59. /**
  60. * Cell background color. See the bgcolor attribute definition in HTML
  61. * 4.0. This attribute is deprecated in HTML 4.0.
  62. */
  63. public String getBgColor();
  64. public void setBgColor(String bgColor);
  65. /**
  66. * The width of the border around the table. See the border attribute
  67. * definition in HTML 4.0.
  68. */
  69. public String getBorder();
  70. public void setBorder(String border);
  71. /**
  72. * Specifies the horizontal and vertical space between cell content and
  73. * cell borders. See the cellpadding attribute definition in HTML 4.0.
  74. */
  75. public String getCellPadding();
  76. public void setCellPadding(String cellPadding);
  77. /**
  78. * Specifies the horizontal and vertical separation between cells. See
  79. * the cellspacing attribute definition in HTML 4.0.
  80. */
  81. public String getCellSpacing();
  82. public void setCellSpacing(String cellSpacing);
  83. /**
  84. * Specifies which external table borders to render. See the frame
  85. * attribute definition in HTML 4.0.
  86. */
  87. public String getFrame();
  88. public void setFrame(String frame);
  89. /**
  90. * Specifies which internal table borders to render. See the rules
  91. * attribute definition in HTML 4.0.
  92. */
  93. public String getRules();
  94. public void setRules(String rules);
  95. /**
  96. * Description about the purpose or structure of a table. See the
  97. * summary attribute definition in HTML 4.0.
  98. */
  99. public String getSummary();
  100. public void setSummary(String summary);
  101. /**
  102. * Specifies the desired table width. See the width attribute definition
  103. * in HTML 4.0.
  104. */
  105. public String getWidth();
  106. public void setWidth(String width);
  107. /**
  108. * Create a table header row or return an existing one.
  109. * @return A new table header element (<code>THEAD</code> ).
  110. */
  111. public HTMLElement createTHead();
  112. /**
  113. * Delete the header from the table, if one exists.
  114. */
  115. public void deleteTHead();
  116. /**
  117. * Create a table footer row or return an existing one.
  118. * @return A footer element (<code>TFOOT</code> ).
  119. */
  120. public HTMLElement createTFoot();
  121. /**
  122. * Delete the footer from the table, if one exists.
  123. */
  124. public void deleteTFoot();
  125. /**
  126. * Create a new table caption object or return an existing one.
  127. * @return A <code>CAPTION</code> element.
  128. */
  129. public HTMLElement createCaption();
  130. /**
  131. * Delete the table caption, if one exists.
  132. */
  133. public void deleteCaption();
  134. /**
  135. * Insert a new empty row in the table. The new row is inserted
  136. * immediately before and in the same section as the current
  137. * <code>index</code> th row in the table. If <code>index</code> is equal
  138. * to the number of rows, the new row is appended. In addition, when the
  139. * table is empty the row is inserted into a <code>TBODY</code> which is
  140. * created and inserted into the table. Note. A table row cannot be empty
  141. * according to HTML 4.0 Recommendation.
  142. * @param index The row number where to insert a new row. This index
  143. * starts from 0 and is relative to all the rows contained inside the
  144. * table, regardless of section parentage.
  145. * @return The newly created row.
  146. * @exception DOMException
  147. * INDEX_SIZE_ERR: Raised if the specified index is greater than the
  148. * number of rows or if the index is negative.
  149. */
  150. public HTMLElement insertRow(int index)
  151. throws DOMException;
  152. /**
  153. * Delete a table row.
  154. * @param index The index of the row to be deleted. This index starts
  155. * from 0 and is relative to all the rows contained inside the table,
  156. * regardless of section parentage.
  157. * @exception DOMException
  158. * INDEX_SIZE_ERR: Raised if the specified index is greater than or
  159. * equal to the number of rows or if the index is negative.
  160. */
  161. public void deleteRow(int index)
  162. throws DOMException;
  163. }