001/* AccessibleTable.java -- aids in accessibly manipulating tables
002   Copyright (C) 2002, 2005  Free Software Foundation, Inc.
003
004This file is part of GNU Classpath.
005
006GNU Classpath is free software; you can redistribute it and/or modify
007it under the terms of the GNU General Public License as published by
008the Free Software Foundation; either version 2, or (at your option)
009any later version.
010
011GNU Classpath is distributed in the hope that it will be useful, but
012WITHOUT ANY WARRANTY; without even the implied warranty of
013MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014General Public License for more details.
015
016You should have received a copy of the GNU General Public License
017along with GNU Classpath; see the file COPYING.  If not, write to the
018Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
01902110-1301 USA.
020
021Linking this library statically or dynamically with other modules is
022making a combined work based on this library.  Thus, the terms and
023conditions of the GNU General Public License cover the whole
024combination.
025
026As a special exception, the copyright holders of this library give you
027permission to link this library with independent modules to produce an
028executable, regardless of the license terms of these independent
029modules, and to copy and distribute the resulting executable under
030terms of your choice, provided that you also meet, for each linked
031independent module, the terms and conditions of the license of that
032module.  An independent module is a module which is not derived from
033or based on this library.  If you modify this library, you may extend
034this exception to your version of the library, but you are not
035obligated to do so.  If you do not wish to do so, delete this
036exception statement from your version. */
037
038
039package javax.accessibility;
040
041/**
042 * Objects which present information in a 2-dimensional table should implement
043 * this interface. Accessibility software can use the implementations of
044 * this interface to navigate and change the attributes of the table.
045 *
046 * <p>The <code>AccessibleContext.getAccessibleTable()</code> method
047 * should return <code>null</code> if an object does not implement this
048 * interface.
049 *
050 * @author Eric Blake (ebb9@email.byu.edu)
051 * @see Accessible
052 * @see AccessibleContext
053 * @see AccessibleContext#getAccessibleTable()
054 * @since 1.2
055 * @status updated to 1.4
056 */
057public interface AccessibleTable
058{
059  /**
060   * Return the caption for the table, or null if unknown.
061   *
062   * @return the table caption
063   */
064  Accessible getAccessibleCaption();
065
066  /**
067   * Set the table caption.
068   *
069   * @param caption the new caption
070   */
071  void setAccessibleCaption(Accessible caption);
072
073  /**
074   * Return the summary description of the table, or null if unknown.
075   *
076   * @return the summary description
077   */
078  Accessible getAccessibleSummary();
079
080  /**
081   * Set the table summary description.
082   *
083   * @param summary the new summary
084   */
085  void setAccessibleSummary(Accessible summary);
086
087  /**
088   * Return the number of rows in the table.
089   *
090   * @return the row count
091   */
092  int getAccessibleRowCount();
093
094  /**
095   * Return the number of columns in the table.
096   *
097   * @return the column count
098   */
099  int getAccessibleColumnCount();
100
101  /**
102   * Return the cell at the specified row and column, or null if out of bounds.
103   *
104   * @param r the 0-based row index
105   * @param c the 0-based column index
106   * @return the cell at (r,c)
107   */
108  Accessible getAccessibleAt(int r, int c);
109
110  /**
111   * Returns the number of merged rows occupied at the specified row and
112   * column, or 0 if out of bounds.
113   *
114   * @param r the 0-based row index
115   * @param c the 0-based column index
116   * @return the row extent at (r,c)
117   */
118  int getAccessibleRowExtentAt(int r, int c);
119
120  /**
121   * Returns the number of merged columns occupied at the specified row and
122   * column, or 0 if out of bounds.
123   *
124   * @param r the 0-based row index
125   * @param c the 0-based column index
126   * @return the column extent at (r,c)
127   */
128  int getAccessibleColumnExtentAt(int r, int c);
129
130  /**
131   * Return the row headers as a table.
132   *
133   * @return the row headers, or null if there are none
134   */
135  AccessibleTable getAccessibleRowHeader();
136
137  /**
138   * Set the row headers.
139   *
140   * @param header the new row header
141   */
142  // XXX What happens if header is incompatible size?
143  void setAccessibleRowHeader(AccessibleTable header);
144
145  /**
146   * Return the column headers as a table.
147   *
148   * @return the column headers, or null if there are none
149   */
150  AccessibleTable getAccessibleColumnHeader();
151
152  /**
153   * Set the column headers.
154   *
155   * @param header the new column header
156   */
157  // XXX What happens if header is incompatible size?
158  void setAccessibleColumnHeader(AccessibleTable header);
159
160  /**
161   * Return the description of a row, or null if there is none or the index
162   * is out of bounds.
163   *
164   * @param r the 0-based row index
165   * @return the description
166   */
167  Accessible getAccessibleRowDescription(int r);
168
169  /**
170   * Set the description of a row. Does nothing if the index is invalid.
171   *
172   * @param r the 0-based row index
173   * @param description the new description
174   */
175  void setAccessibleRowDescription(int r, Accessible description);
176
177  /**
178   * Return the description of a column, or null if there is none or the index
179   * is out of bounds.
180   *
181   * @param c the 0-based column index
182   * @return the description
183   */
184  Accessible getAccessibleColumnDescription(int c);
185
186  /**
187   * Set the description of a column. Does nothing if the index is invalid.
188   *
189   * @param c the 0-based column index
190   * @param description the new description
191   */
192  void setAccessibleColumnDescription(int c, Accessible description);
193
194  /**
195   * Return whether the cell at the specified location is selected. Returns
196   * false if the index is out of bounds.
197   *
198   * @param r the 0-based row index
199   * @param c the 0-based column index
200   * @return true if that cell is selected
201   */
202  boolean isAccessibleSelected(int r, int c);
203
204  /**
205   * Return whether the specified row is selected. Returns false if the
206   * index is out of bounds.
207   *
208   * @param r the 0-based row index
209   * @return true if that row is selected
210   */
211  boolean isAccessibleRowSelected(int r);
212
213  /**
214   * Return whether the specified column is selected. Returns false if the
215   * index is out of bounds.
216   *
217   * @param c the 0-based column index
218   * @return true if that column is selected
219   */
220  boolean isAccessibleColumnSelected(int c);
221
222  /**
223   * Return the selected rows. May be null or empty if there is no selection.
224   *
225   * @return the indices of selected rows
226   */
227  int[] getSelectedAccessibleRows();
228
229  /**
230   * Return the selected columns. May be null or empty if there is no
231   * selection.
232   *
233   * @return the indices of selected columns
234   */
235  int[] getSelectedAccessibleColumns();
236} // interface AccessibleTable