1 /* AccessibleTable.java -- aids in accessibly manipulating tables
2    Copyright (C) 2002, 2005  Free Software Foundation, Inc.
3 
4 This file is part of GNU Classpath.
5 
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10 
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING.  If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
20 
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library.  Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
25 
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module.  An independent module is a module which is not derived from
33 or based on this library.  If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so.  If you do not wish to do so, delete this
36 exception statement from your version. */
37 
38 
39 package javax.accessibility;
40 
41 /**
42  * Objects which present information in a 2-dimensional table should implement
43  * this interface. Accessibility software can use the implementations of
44  * this interface to navigate and change the attributes of the table.
45  *
46  * <p>The <code>AccessibleContext.getAccessibleTable()</code> method
47  * should return <code>null</code> if an object does not implement this
48  * interface.
49  *
50  * @author Eric Blake (ebb9@email.byu.edu)
51  * @see Accessible
52  * @see AccessibleContext
53  * @see AccessibleContext#getAccessibleTable()
54  * @since 1.2
55  * @status updated to 1.4
56  */
57 public interface AccessibleTable
58 {
59   /**
60    * Return the caption for the table, or null if unknown.
61    *
62    * @return the table caption
63    */
getAccessibleCaption()64   Accessible getAccessibleCaption();
65 
66   /**
67    * Set the table caption.
68    *
69    * @param caption the new caption
70    */
setAccessibleCaption(Accessible caption)71   void setAccessibleCaption(Accessible caption);
72 
73   /**
74    * Return the summary description of the table, or null if unknown.
75    *
76    * @return the summary description
77    */
getAccessibleSummary()78   Accessible getAccessibleSummary();
79 
80   /**
81    * Set the table summary description.
82    *
83    * @param summary the new summary
84    */
setAccessibleSummary(Accessible summary)85   void setAccessibleSummary(Accessible summary);
86 
87   /**
88    * Return the number of rows in the table.
89    *
90    * @return the row count
91    */
getAccessibleRowCount()92   int getAccessibleRowCount();
93 
94   /**
95    * Return the number of columns in the table.
96    *
97    * @return the column count
98    */
getAccessibleColumnCount()99   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    */
getAccessibleAt(int r, int c)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    */
getAccessibleRowExtentAt(int r, int c)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    */
getAccessibleColumnExtentAt(int r, int c)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    */
getAccessibleRowHeader()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?
setAccessibleRowHeader(AccessibleTable header)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    */
getAccessibleColumnHeader()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?
setAccessibleColumnHeader(AccessibleTable header)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    */
getAccessibleRowDescription(int r)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    */
setAccessibleRowDescription(int r, Accessible description)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    */
getAccessibleColumnDescription(int c)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    */
setAccessibleColumnDescription(int c, Accessible description)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    */
isAccessibleSelected(int r, int c)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    */
isAccessibleRowSelected(int r)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    */
isAccessibleColumnSelected(int c)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    */
getSelectedAccessibleRows()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    */
getSelectedAccessibleColumns()235   int[] getSelectedAccessibleColumns();
236 } // interface AccessibleTable
237