AccessibleTable.java 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. /* AccessibleTable.java -- aids in accessibly manipulating tables
  2. Copyright (C) 2002, 2005 Free Software Foundation, Inc.
  3. This file is part of GNU Classpath.
  4. GNU Classpath is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. GNU Classpath is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Classpath; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  15. 02110-1301 USA.
  16. Linking this library statically or dynamically with other modules is
  17. making a combined work based on this library. Thus, the terms and
  18. conditions of the GNU General Public License cover the whole
  19. combination.
  20. As a special exception, the copyright holders of this library give you
  21. permission to link this library with independent modules to produce an
  22. executable, regardless of the license terms of these independent
  23. modules, and to copy and distribute the resulting executable under
  24. terms of your choice, provided that you also meet, for each linked
  25. independent module, the terms and conditions of the license of that
  26. module. An independent module is a module which is not derived from
  27. or based on this library. If you modify this library, you may extend
  28. this exception to your version of the library, but you are not
  29. obligated to do so. If you do not wish to do so, delete this
  30. exception statement from your version. */
  31. package javax.accessibility;
  32. /**
  33. * Objects which present information in a 2-dimensional table should implement
  34. * this interface. Accessibility software can use the implementations of
  35. * this interface to navigate and change the attributes of the table.
  36. *
  37. * <p>The <code>AccessibleContext.getAccessibleTable()</code> method
  38. * should return <code>null</code> if an object does not implement this
  39. * interface.
  40. *
  41. * @author Eric Blake (ebb9@email.byu.edu)
  42. * @see Accessible
  43. * @see AccessibleContext
  44. * @see AccessibleContext#getAccessibleTable()
  45. * @since 1.2
  46. * @status updated to 1.4
  47. */
  48. public interface AccessibleTable
  49. {
  50. /**
  51. * Return the caption for the table, or null if unknown.
  52. *
  53. * @return the table caption
  54. */
  55. Accessible getAccessibleCaption();
  56. /**
  57. * Set the table caption.
  58. *
  59. * @param caption the new caption
  60. */
  61. void setAccessibleCaption(Accessible caption);
  62. /**
  63. * Return the summary description of the table, or null if unknown.
  64. *
  65. * @return the summary description
  66. */
  67. Accessible getAccessibleSummary();
  68. /**
  69. * Set the table summary description.
  70. *
  71. * @param summary the new summary
  72. */
  73. void setAccessibleSummary(Accessible summary);
  74. /**
  75. * Return the number of rows in the table.
  76. *
  77. * @return the row count
  78. */
  79. int getAccessibleRowCount();
  80. /**
  81. * Return the number of columns in the table.
  82. *
  83. * @return the column count
  84. */
  85. int getAccessibleColumnCount();
  86. /**
  87. * Return the cell at the specified row and column, or null if out of bounds.
  88. *
  89. * @param r the 0-based row index
  90. * @param c the 0-based column index
  91. * @return the cell at (r,c)
  92. */
  93. Accessible getAccessibleAt(int r, int c);
  94. /**
  95. * Returns the number of merged rows occupied at the specified row and
  96. * column, or 0 if out of bounds.
  97. *
  98. * @param r the 0-based row index
  99. * @param c the 0-based column index
  100. * @return the row extent at (r,c)
  101. */
  102. int getAccessibleRowExtentAt(int r, int c);
  103. /**
  104. * Returns the number of merged columns occupied at the specified row and
  105. * column, or 0 if out of bounds.
  106. *
  107. * @param r the 0-based row index
  108. * @param c the 0-based column index
  109. * @return the column extent at (r,c)
  110. */
  111. int getAccessibleColumnExtentAt(int r, int c);
  112. /**
  113. * Return the row headers as a table.
  114. *
  115. * @return the row headers, or null if there are none
  116. */
  117. AccessibleTable getAccessibleRowHeader();
  118. /**
  119. * Set the row headers.
  120. *
  121. * @param header the new row header
  122. */
  123. // XXX What happens if header is incompatible size?
  124. void setAccessibleRowHeader(AccessibleTable header);
  125. /**
  126. * Return the column headers as a table.
  127. *
  128. * @return the column headers, or null if there are none
  129. */
  130. AccessibleTable getAccessibleColumnHeader();
  131. /**
  132. * Set the column headers.
  133. *
  134. * @param header the new column header
  135. */
  136. // XXX What happens if header is incompatible size?
  137. void setAccessibleColumnHeader(AccessibleTable header);
  138. /**
  139. * Return the description of a row, or null if there is none or the index
  140. * is out of bounds.
  141. *
  142. * @param r the 0-based row index
  143. * @return the description
  144. */
  145. Accessible getAccessibleRowDescription(int r);
  146. /**
  147. * Set the description of a row. Does nothing if the index is invalid.
  148. *
  149. * @param r the 0-based row index
  150. * @param description the new description
  151. */
  152. void setAccessibleRowDescription(int r, Accessible description);
  153. /**
  154. * Return the description of a column, or null if there is none or the index
  155. * is out of bounds.
  156. *
  157. * @param c the 0-based column index
  158. * @return the description
  159. */
  160. Accessible getAccessibleColumnDescription(int c);
  161. /**
  162. * Set the description of a column. Does nothing if the index is invalid.
  163. *
  164. * @param c the 0-based column index
  165. * @param description the new description
  166. */
  167. void setAccessibleColumnDescription(int c, Accessible description);
  168. /**
  169. * Return whether the cell at the specified location is selected. Returns
  170. * false if the index is out of bounds.
  171. *
  172. * @param r the 0-based row index
  173. * @param c the 0-based column index
  174. * @return true if that cell is selected
  175. */
  176. boolean isAccessibleSelected(int r, int c);
  177. /**
  178. * Return whether the specified row is selected. Returns false if the
  179. * index is out of bounds.
  180. *
  181. * @param r the 0-based row index
  182. * @return true if that row is selected
  183. */
  184. boolean isAccessibleRowSelected(int r);
  185. /**
  186. * Return whether the specified column is selected. Returns false if the
  187. * index is out of bounds.
  188. *
  189. * @param c the 0-based column index
  190. * @return true if that column is selected
  191. */
  192. boolean isAccessibleColumnSelected(int c);
  193. /**
  194. * Return the selected rows. May be null or empty if there is no selection.
  195. *
  196. * @return the indices of selected rows
  197. */
  198. int[] getSelectedAccessibleRows();
  199. /**
  200. * Return the selected columns. May be null or empty if there is no
  201. * selection.
  202. *
  203. * @return the indices of selected columns
  204. */
  205. int[] getSelectedAccessibleColumns();
  206. } // interface AccessibleTable