author | ohair |
Tue, 25 May 2010 15:58:33 -0700 | |
changeset 5506 | 202f599c92aa |
parent 4511 | ae1aa33f5de4 |
child 12047 | 320a714614e9 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
5506 | 2 |
* Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package javax.accessibility; |
|
27 |
||
28 |
import java.util.Locale; |
|
29 |
import java.beans.PropertyChangeListener; |
|
30 |
import java.beans.PropertyChangeSupport; |
|
31 |
import java.beans.PropertyChangeEvent; |
|
32 |
import java.awt.IllegalComponentStateException; |
|
33 |
||
34 |
/** |
|
35 |
* AccessibleContext represents the minimum information all accessible objects |
|
36 |
* return. This information includes the accessible name, description, role, |
|
37 |
* and state of the object, as well as information about its parent and |
|
38 |
* children. AccessibleContext also contains methods for |
|
39 |
* obtaining more specific accessibility information about a component. |
|
40 |
* If the component supports them, these methods will return an object that |
|
41 |
* implements one or more of the following interfaces: |
|
42 |
* <P><ul> |
|
43 |
* <li>{@link AccessibleAction} - the object can perform one or more actions. |
|
44 |
* This interface provides the standard mechanism for an assistive |
|
45 |
* technology to determine what those actions are and tell the object |
|
46 |
* to perform them. Any object that can be manipulated should |
|
47 |
* support this interface. |
|
48 |
* <li>{@link AccessibleComponent} - the object has a graphical representation. |
|
49 |
* This interface provides the standard mechanism for an assistive |
|
50 |
* technology to determine and set the graphical representation of the |
|
51 |
* object. Any object that is rendered on the screen should support |
|
52 |
* this interface. |
|
53 |
* <li>{@link AccessibleSelection} - the object allows its children to be |
|
54 |
* selected. This interface provides the standard mechanism for an |
|
55 |
* assistive technology to determine the currently selected children of the object |
|
56 |
* as well as modify its selection set. Any object that has children |
|
57 |
* that can be selected should support this interface. |
|
58 |
* <li>{@link AccessibleText} - the object presents editable textual information |
|
59 |
* on the display. This interface provides the standard mechanism for |
|
60 |
* an assistive technology to access that text via its content, attributes, |
|
61 |
* and spatial location. Any object that contains editable text should |
|
62 |
* support this interface. |
|
63 |
* <li>{@link AccessibleValue} - the object supports a numerical value. This |
|
64 |
* interface provides the standard mechanism for an assistive technology |
|
65 |
* to determine and set the current value of the object, as well as obtain its |
|
66 |
* minimum and maximum values. Any object that supports a numerical value |
|
67 |
* should support this interface.</ul> |
|
68 |
* |
|
69 |
* |
|
70 |
* @beaninfo |
|
71 |
* attribute: isContainer false |
|
72 |
* description: Minimal information that all accessible objects return |
|
73 |
* |
|
74 |
||
75 |
* @author Peter Korn |
|
76 |
* @author Hans Muller |
|
77 |
* @author Willie Walker |
|
78 |
* @author Lynn Monsanto |
|
79 |
*/ |
|
80 |
public abstract class AccessibleContext { |
|
81 |
||
82 |
/** |
|
83 |
* Constant used to determine when the accessibleName property has |
|
84 |
* changed. The old value in the PropertyChangeEvent will be the old |
|
85 |
* accessibleName and the new value will be the new accessibleName. |
|
86 |
* |
|
87 |
* @see #getAccessibleName |
|
88 |
* @see #addPropertyChangeListener |
|
89 |
*/ |
|
90 |
public static final String ACCESSIBLE_NAME_PROPERTY = "AccessibleName"; |
|
91 |
||
92 |
/** |
|
93 |
* Constant used to determine when the accessibleDescription property has |
|
94 |
* changed. The old value in the PropertyChangeEvent will be the |
|
95 |
* old accessibleDescription and the new value will be the new |
|
96 |
* accessibleDescription. |
|
97 |
* |
|
98 |
* @see #getAccessibleDescription |
|
99 |
* @see #addPropertyChangeListener |
|
100 |
*/ |
|
101 |
public static final String ACCESSIBLE_DESCRIPTION_PROPERTY = "AccessibleDescription"; |
|
102 |
||
103 |
/** |
|
104 |
* Constant used to determine when the accessibleStateSet property has |
|
105 |
* changed. The old value will be the old AccessibleState and the new |
|
106 |
* value will be the new AccessibleState in the accessibleStateSet. |
|
107 |
* For example, if a component that supports the vertical and horizontal |
|
108 |
* states changes its orientation from vertical to horizontal, the old |
|
109 |
* value will be AccessibleState.VERTICAL and the new value will be |
|
110 |
* AccessibleState.HORIZONTAL. Please note that either value can also |
|
111 |
* be null. For example, when a component changes from being enabled |
|
112 |
* to disabled, the old value will be AccessibleState.ENABLED |
|
113 |
* and the new value will be null. |
|
114 |
* |
|
115 |
* @see #getAccessibleStateSet |
|
116 |
* @see AccessibleState |
|
117 |
* @see AccessibleStateSet |
|
118 |
* @see #addPropertyChangeListener |
|
119 |
*/ |
|
120 |
public static final String ACCESSIBLE_STATE_PROPERTY = "AccessibleState"; |
|
121 |
||
122 |
/** |
|
123 |
* Constant used to determine when the accessibleValue property has |
|
124 |
* changed. The old value in the PropertyChangeEvent will be a Number |
|
125 |
* representing the old value and the new value will be a Number |
|
126 |
* representing the new value |
|
127 |
* |
|
128 |
* @see #getAccessibleValue |
|
129 |
* @see #addPropertyChangeListener |
|
130 |
*/ |
|
131 |
public static final String ACCESSIBLE_VALUE_PROPERTY = "AccessibleValue"; |
|
132 |
||
133 |
/** |
|
134 |
* Constant used to determine when the accessibleSelection has changed. |
|
135 |
* The old and new values in the PropertyChangeEvent are currently |
|
136 |
* reserved for future use. |
|
137 |
* |
|
138 |
* @see #getAccessibleSelection |
|
139 |
* @see #addPropertyChangeListener |
|
140 |
*/ |
|
141 |
public static final String ACCESSIBLE_SELECTION_PROPERTY = "AccessibleSelection"; |
|
142 |
||
143 |
/** |
|
144 |
* Constant used to determine when the accessibleText caret has changed. |
|
145 |
* The old value in the PropertyChangeEvent will be an |
|
146 |
* integer representing the old caret position, and the new value will |
|
147 |
* be an integer representing the new/current caret position. |
|
148 |
* |
|
149 |
* @see #addPropertyChangeListener |
|
150 |
*/ |
|
151 |
public static final String ACCESSIBLE_CARET_PROPERTY = "AccessibleCaret"; |
|
152 |
||
153 |
/** |
|
154 |
* Constant used to determine when the visual appearance of the object |
|
155 |
* has changed. The old and new values in the PropertyChangeEvent are |
|
156 |
* currently reserved for future use. |
|
157 |
* |
|
158 |
* @see #addPropertyChangeListener |
|
159 |
*/ |
|
160 |
public static final String ACCESSIBLE_VISIBLE_DATA_PROPERTY = "AccessibleVisibleData"; |
|
161 |
||
162 |
/** |
|
163 |
* Constant used to determine when Accessible children are added/removed |
|
164 |
* from the object. If an Accessible child is being added, the old |
|
165 |
* value will be null and the new value will be the Accessible child. If an |
|
166 |
* Accessible child is being removed, the old value will be the Accessible |
|
167 |
* child, and the new value will be null. |
|
168 |
* |
|
169 |
* @see #addPropertyChangeListener |
|
170 |
*/ |
|
171 |
public static final String ACCESSIBLE_CHILD_PROPERTY = "AccessibleChild"; |
|
172 |
||
173 |
/** |
|
174 |
* Constant used to determine when the active descendant of a component |
|
175 |
* has changed. The active descendant is used for objects such as |
|
176 |
* list, tree, and table, which may have transient children. When the |
|
177 |
* active descendant has changed, the old value of the property change |
|
178 |
* event will be the Accessible representing the previous active child, and |
|
179 |
* the new value will be the Accessible representing the current active |
|
180 |
* child. |
|
181 |
* |
|
182 |
* @see #addPropertyChangeListener |
|
183 |
*/ |
|
184 |
public static final String ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY = "AccessibleActiveDescendant"; |
|
185 |
||
186 |
/** |
|
187 |
* Constant used to indicate that the table caption has changed |
|
188 |
* The old value in the PropertyChangeEvent will be an Accessible |
|
189 |
* representing the previous table caption and the new value will |
|
190 |
* be an Accessible representing the new table caption. |
|
191 |
* @see Accessible |
|
192 |
* @see AccessibleTable |
|
193 |
*/ |
|
194 |
public static final String ACCESSIBLE_TABLE_CAPTION_CHANGED = |
|
195 |
"accessibleTableCaptionChanged"; |
|
196 |
||
197 |
/** |
|
198 |
* Constant used to indicate that the table summary has changed |
|
199 |
* The old value in the PropertyChangeEvent will be an Accessible |
|
200 |
* representing the previous table summary and the new value will |
|
201 |
* be an Accessible representing the new table summary. |
|
202 |
* @see Accessible |
|
203 |
* @see AccessibleTable |
|
204 |
*/ |
|
205 |
public static final String ACCESSIBLE_TABLE_SUMMARY_CHANGED = |
|
206 |
"accessibleTableSummaryChanged"; |
|
207 |
||
208 |
/** |
|
209 |
* Constant used to indicate that table data has changed. |
|
210 |
* The old value in the PropertyChangeEvent will be null and the |
|
211 |
* new value will be an AccessibleTableModelChange representing |
|
212 |
* the table change. |
|
213 |
* @see AccessibleTable |
|
214 |
* @see AccessibleTableModelChange |
|
215 |
*/ |
|
216 |
public static final String ACCESSIBLE_TABLE_MODEL_CHANGED = |
|
217 |
"accessibleTableModelChanged"; |
|
218 |
||
219 |
/** |
|
220 |
* Constant used to indicate that the row header has changed |
|
221 |
* The old value in the PropertyChangeEvent will be null and the |
|
222 |
* new value will be an AccessibleTableModelChange representing |
|
223 |
* the header change. |
|
224 |
* @see AccessibleTable |
|
225 |
* @see AccessibleTableModelChange |
|
226 |
*/ |
|
227 |
public static final String ACCESSIBLE_TABLE_ROW_HEADER_CHANGED = |
|
228 |
"accessibleTableRowHeaderChanged"; |
|
229 |
||
230 |
/** |
|
231 |
* Constant used to indicate that the row description has changed |
|
232 |
* The old value in the PropertyChangeEvent will be null and the |
|
233 |
* new value will be an Integer representing the row index. |
|
234 |
* @see AccessibleTable |
|
235 |
*/ |
|
236 |
public static final String ACCESSIBLE_TABLE_ROW_DESCRIPTION_CHANGED = |
|
237 |
"accessibleTableRowDescriptionChanged"; |
|
238 |
||
239 |
/** |
|
240 |
* Constant used to indicate that the column header has changed |
|
241 |
* The old value in the PropertyChangeEvent will be null and the |
|
242 |
* new value will be an AccessibleTableModelChange representing |
|
243 |
* the header change. |
|
244 |
* @see AccessibleTable |
|
245 |
* @see AccessibleTableModelChange |
|
246 |
*/ |
|
247 |
public static final String ACCESSIBLE_TABLE_COLUMN_HEADER_CHANGED = |
|
248 |
"accessibleTableColumnHeaderChanged"; |
|
249 |
||
250 |
/** |
|
251 |
* Constant used to indicate that the column description has changed |
|
252 |
* The old value in the PropertyChangeEvent will be null and the |
|
253 |
* new value will be an Integer representing the column index. |
|
254 |
* @see AccessibleTable |
|
255 |
*/ |
|
256 |
public static final String ACCESSIBLE_TABLE_COLUMN_DESCRIPTION_CHANGED = |
|
257 |
"accessibleTableColumnDescriptionChanged"; |
|
258 |
||
259 |
/** |
|
260 |
* Constant used to indicate that the supported set of actions |
|
261 |
* has changed. The old value in the PropertyChangeEvent will |
|
262 |
* be an Integer representing the old number of actions supported |
|
263 |
* and the new value will be an Integer representing the new |
|
264 |
* number of actions supported. |
|
265 |
* @see AccessibleAction |
|
266 |
*/ |
|
267 |
public static final String ACCESSIBLE_ACTION_PROPERTY = |
|
268 |
"accessibleActionProperty"; |
|
269 |
||
270 |
/** |
|
271 |
* Constant used to indicate that a hypertext element has received focus. |
|
272 |
* The old value in the PropertyChangeEvent will be an Integer |
|
273 |
* representing the start index in the document of the previous element |
|
274 |
* that had focus and the new value will be an Integer representing |
|
275 |
* the start index in the document of the current element that has |
|
276 |
* focus. A value of -1 indicates that an element does not or did |
|
277 |
* not have focus. |
|
278 |
* @see AccessibleHyperlink |
|
279 |
*/ |
|
280 |
public static final String ACCESSIBLE_HYPERTEXT_OFFSET = |
|
281 |
"AccessibleHypertextOffset"; |
|
282 |
||
283 |
/** |
|
284 |
* PropertyChangeEvent which indicates that text has changed. |
|
285 |
* <br> |
|
286 |
* For text insertion, the oldValue is null and the newValue |
|
287 |
* is an AccessibleTextSequence specifying the text that was |
|
288 |
* inserted. |
|
289 |
* <br> |
|
290 |
* For text deletion, the oldValue is an AccessibleTextSequence |
|
291 |
* specifying the text that was deleted and the newValue is null. |
|
292 |
* <br> |
|
293 |
* For text replacement, the oldValue is an AccessibleTextSequence |
|
294 |
* specifying the old text and the newValue is an AccessibleTextSequence |
|
295 |
* specifying the new text. |
|
296 |
* |
|
297 |
* @see #getAccessibleText |
|
298 |
* @see #addPropertyChangeListener |
|
4511
ae1aa33f5de4
4891262: API spec, javax/accessibility: few invalid javadoc tags
darcy
parents:
2
diff
changeset
|
299 |
* @see AccessibleTextSequence |
2 | 300 |
*/ |
301 |
public static final String ACCESSIBLE_TEXT_PROPERTY |
|
302 |
= "AccessibleText"; |
|
303 |
||
304 |
/** |
|
305 |
* PropertyChangeEvent which indicates that a significant change |
|
306 |
* has occurred to the children of a component like a tree or text. |
|
307 |
* This change notifies the event listener that it needs to |
|
308 |
* reacquire the state of the subcomponents. The oldValue is |
|
309 |
* null and the newValue is the component whose children have |
|
310 |
* become invalid. |
|
311 |
* |
|
312 |
* @see #getAccessibleText |
|
313 |
* @see #addPropertyChangeListener |
|
4511
ae1aa33f5de4
4891262: API spec, javax/accessibility: few invalid javadoc tags
darcy
parents:
2
diff
changeset
|
314 |
* @see AccessibleTextSequence |
2 | 315 |
* |
316 |
* @since 1.5 |
|
317 |
*/ |
|
318 |
public static final String ACCESSIBLE_INVALIDATE_CHILDREN = |
|
319 |
"accessibleInvalidateChildren"; |
|
320 |
||
321 |
/** |
|
322 |
* PropertyChangeEvent which indicates that text attributes have changed. |
|
323 |
* <br> |
|
324 |
* For attribute insertion, the oldValue is null and the newValue |
|
325 |
* is an AccessibleAttributeSequence specifying the attributes that were |
|
326 |
* inserted. |
|
327 |
* <br> |
|
328 |
* For attribute deletion, the oldValue is an AccessibleAttributeSequence |
|
329 |
* specifying the attributes that were deleted and the newValue is null. |
|
330 |
* <br> |
|
331 |
* For attribute replacement, the oldValue is an AccessibleAttributeSequence |
|
332 |
* specifying the old attributes and the newValue is an |
|
333 |
* AccessibleAttributeSequence specifying the new attributes. |
|
334 |
* |
|
335 |
* @see #getAccessibleText |
|
336 |
* @see #addPropertyChangeListener |
|
4511
ae1aa33f5de4
4891262: API spec, javax/accessibility: few invalid javadoc tags
darcy
parents:
2
diff
changeset
|
337 |
* @see AccessibleAttributeSequence |
2 | 338 |
* |
339 |
* @since 1.5 |
|
340 |
*/ |
|
341 |
public static final String ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED = |
|
342 |
"accessibleTextAttributesChanged"; |
|
343 |
||
344 |
/** |
|
345 |
* PropertyChangeEvent which indicates that a change has occurred |
|
346 |
* in a component's bounds. |
|
347 |
* The oldValue is the old component bounds and the newValue is |
|
348 |
* the new component bounds. |
|
349 |
* |
|
350 |
* @see #addPropertyChangeListener |
|
351 |
* |
|
352 |
* @since 1.5 |
|
353 |
*/ |
|
354 |
public static final String ACCESSIBLE_COMPONENT_BOUNDS_CHANGED = |
|
355 |
"accessibleComponentBoundsChanged"; |
|
356 |
||
357 |
/** |
|
358 |
* The accessible parent of this object. |
|
359 |
* |
|
360 |
* @see #getAccessibleParent |
|
361 |
* @see #setAccessibleParent |
|
362 |
*/ |
|
363 |
protected Accessible accessibleParent = null; |
|
364 |
||
365 |
/** |
|
366 |
* A localized String containing the name of the object. |
|
367 |
* |
|
368 |
* @see #getAccessibleName |
|
369 |
* @see #setAccessibleName |
|
370 |
*/ |
|
371 |
protected String accessibleName = null; |
|
372 |
||
373 |
/** |
|
374 |
* A localized String containing the description of the object. |
|
375 |
* |
|
376 |
* @see #getAccessibleDescription |
|
377 |
* @see #setAccessibleDescription |
|
378 |
*/ |
|
379 |
protected String accessibleDescription = null; |
|
380 |
||
381 |
/** |
|
382 |
* Used to handle the listener list for property change events. |
|
383 |
* |
|
384 |
* @see #addPropertyChangeListener |
|
385 |
* @see #removePropertyChangeListener |
|
386 |
* @see #firePropertyChangeListener |
|
387 |
*/ |
|
388 |
private PropertyChangeSupport accessibleChangeSupport = null; |
|
389 |
||
390 |
/** |
|
391 |
* Used to represent the context's relation set |
|
392 |
* @see #getAccessibleRelationSet |
|
393 |
*/ |
|
394 |
private AccessibleRelationSet relationSet |
|
395 |
= new AccessibleRelationSet(); |
|
396 |
||
397 |
/** |
|
398 |
* Gets the accessibleName property of this object. The accessibleName |
|
399 |
* property of an object is a localized String that designates the purpose |
|
400 |
* of the object. For example, the accessibleName property of a label |
|
401 |
* or button might be the text of the label or button itself. In the |
|
402 |
* case of an object that doesn't display its name, the accessibleName |
|
403 |
* should still be set. For example, in the case of a text field used |
|
404 |
* to enter the name of a city, the accessibleName for the en_US locale |
|
405 |
* could be 'city.' |
|
406 |
* |
|
407 |
* @return the localized name of the object; null if this |
|
408 |
* object does not have a name |
|
409 |
* |
|
410 |
* @see #setAccessibleName |
|
411 |
*/ |
|
412 |
public String getAccessibleName() { |
|
413 |
return accessibleName; |
|
414 |
} |
|
415 |
||
416 |
/** |
|
417 |
* Sets the localized accessible name of this object. Changing the |
|
418 |
* name will cause a PropertyChangeEvent to be fired for the |
|
419 |
* ACCESSIBLE_NAME_PROPERTY property. |
|
420 |
* |
|
421 |
* @param s the new localized name of the object. |
|
422 |
* |
|
423 |
* @see #getAccessibleName |
|
424 |
* @see #addPropertyChangeListener |
|
425 |
* |
|
426 |
* @beaninfo |
|
427 |
* preferred: true |
|
428 |
* description: Sets the accessible name for the component. |
|
429 |
*/ |
|
430 |
public void setAccessibleName(String s) { |
|
431 |
String oldName = accessibleName; |
|
432 |
accessibleName = s; |
|
433 |
firePropertyChange(ACCESSIBLE_NAME_PROPERTY,oldName,accessibleName); |
|
434 |
} |
|
435 |
||
436 |
/** |
|
437 |
* Gets the accessibleDescription property of this object. The |
|
438 |
* accessibleDescription property of this object is a short localized |
|
439 |
* phrase describing the purpose of the object. For example, in the |
|
440 |
* case of a 'Cancel' button, the accessibleDescription could be |
|
441 |
* 'Ignore changes and close dialog box.' |
|
442 |
* |
|
443 |
* @return the localized description of the object; null if |
|
444 |
* this object does not have a description |
|
445 |
* |
|
446 |
* @see #setAccessibleDescription |
|
447 |
*/ |
|
448 |
public String getAccessibleDescription() { |
|
449 |
return accessibleDescription; |
|
450 |
} |
|
451 |
||
452 |
/** |
|
453 |
* Sets the accessible description of this object. Changing the |
|
454 |
* name will cause a PropertyChangeEvent to be fired for the |
|
455 |
* ACCESSIBLE_DESCRIPTION_PROPERTY property. |
|
456 |
* |
|
457 |
* @param s the new localized description of the object |
|
458 |
* |
|
459 |
* @see #setAccessibleName |
|
460 |
* @see #addPropertyChangeListener |
|
461 |
* |
|
462 |
* @beaninfo |
|
463 |
* preferred: true |
|
464 |
* description: Sets the accessible description for the component. |
|
465 |
*/ |
|
466 |
public void setAccessibleDescription(String s) { |
|
467 |
String oldDescription = accessibleDescription; |
|
468 |
accessibleDescription = s; |
|
469 |
firePropertyChange(ACCESSIBLE_DESCRIPTION_PROPERTY, |
|
470 |
oldDescription,accessibleDescription); |
|
471 |
} |
|
472 |
||
473 |
/** |
|
474 |
* Gets the role of this object. The role of the object is the generic |
|
475 |
* purpose or use of the class of this object. For example, the role |
|
476 |
* of a push button is AccessibleRole.PUSH_BUTTON. The roles in |
|
477 |
* AccessibleRole are provided so component developers can pick from |
|
478 |
* a set of predefined roles. This enables assistive technologies to |
|
479 |
* provide a consistent interface to various tweaked subclasses of |
|
480 |
* components (e.g., use AccessibleRole.PUSH_BUTTON for all components |
|
481 |
* that act like a push button) as well as distinguish between sublasses |
|
482 |
* that behave differently (e.g., AccessibleRole.CHECK_BOX for check boxes |
|
483 |
* and AccessibleRole.RADIO_BUTTON for radio buttons). |
|
484 |
* <p>Note that the AccessibleRole class is also extensible, so |
|
485 |
* custom component developers can define their own AccessibleRole's |
|
486 |
* if the set of predefined roles is inadequate. |
|
487 |
* |
|
488 |
* @return an instance of AccessibleRole describing the role of the object |
|
489 |
* @see AccessibleRole |
|
490 |
*/ |
|
491 |
public abstract AccessibleRole getAccessibleRole(); |
|
492 |
||
493 |
/** |
|
494 |
* Gets the state set of this object. The AccessibleStateSet of an object |
|
495 |
* is composed of a set of unique AccessibleStates. A change in the |
|
496 |
* AccessibleStateSet of an object will cause a PropertyChangeEvent to |
|
497 |
* be fired for the ACCESSIBLE_STATE_PROPERTY property. |
|
498 |
* |
|
499 |
* @return an instance of AccessibleStateSet containing the |
|
500 |
* current state set of the object |
|
501 |
* @see AccessibleStateSet |
|
502 |
* @see AccessibleState |
|
503 |
* @see #addPropertyChangeListener |
|
504 |
*/ |
|
505 |
public abstract AccessibleStateSet getAccessibleStateSet(); |
|
506 |
||
507 |
/** |
|
508 |
* Gets the Accessible parent of this object. |
|
509 |
* |
|
510 |
* @return the Accessible parent of this object; null if this |
|
511 |
* object does not have an Accessible parent |
|
512 |
*/ |
|
513 |
public Accessible getAccessibleParent() { |
|
514 |
return accessibleParent; |
|
515 |
} |
|
516 |
||
517 |
/** |
|
518 |
* Sets the Accessible parent of this object. This is meant to be used |
|
519 |
* only in the situations where the actual component's parent should |
|
520 |
* not be treated as the component's accessible parent and is a method |
|
521 |
* that should only be called by the parent of the accessible child. |
|
522 |
* |
|
523 |
* @param a - Accessible to be set as the parent |
|
524 |
*/ |
|
525 |
public void setAccessibleParent(Accessible a) { |
|
526 |
accessibleParent = a; |
|
527 |
} |
|
528 |
||
529 |
/** |
|
530 |
* Gets the 0-based index of this object in its accessible parent. |
|
531 |
* |
|
532 |
* @return the 0-based index of this object in its parent; -1 if this |
|
533 |
* object does not have an accessible parent. |
|
534 |
* |
|
535 |
* @see #getAccessibleParent |
|
536 |
* @see #getAccessibleChildrenCount |
|
537 |
* @see #getAccessibleChild |
|
538 |
*/ |
|
539 |
public abstract int getAccessibleIndexInParent(); |
|
540 |
||
541 |
/** |
|
542 |
* Returns the number of accessible children of the object. |
|
543 |
* |
|
544 |
* @return the number of accessible children of the object. |
|
545 |
*/ |
|
546 |
public abstract int getAccessibleChildrenCount(); |
|
547 |
||
548 |
/** |
|
549 |
* Returns the specified Accessible child of the object. The Accessible |
|
550 |
* children of an Accessible object are zero-based, so the first child |
|
551 |
* of an Accessible child is at index 0, the second child is at index 1, |
|
552 |
* and so on. |
|
553 |
* |
|
554 |
* @param i zero-based index of child |
|
555 |
* @return the Accessible child of the object |
|
556 |
* @see #getAccessibleChildrenCount |
|
557 |
*/ |
|
558 |
public abstract Accessible getAccessibleChild(int i); |
|
559 |
||
560 |
/** |
|
561 |
* Gets the locale of the component. If the component does not have a |
|
562 |
* locale, then the locale of its parent is returned. |
|
563 |
* |
|
564 |
* @return this component's locale. If this component does not have |
|
565 |
* a locale, the locale of its parent is returned. |
|
566 |
* |
|
567 |
* @exception IllegalComponentStateException |
|
568 |
* If the Component does not have its own locale and has not yet been |
|
569 |
* added to a containment hierarchy such that the locale can be |
|
570 |
* determined from the containing parent. |
|
571 |
*/ |
|
572 |
public abstract Locale getLocale() throws IllegalComponentStateException; |
|
573 |
||
574 |
/** |
|
575 |
* Adds a PropertyChangeListener to the listener list. |
|
576 |
* The listener is registered for all Accessible properties and will |
|
577 |
* be called when those properties change. |
|
578 |
* |
|
579 |
* @see #ACCESSIBLE_NAME_PROPERTY |
|
580 |
* @see #ACCESSIBLE_DESCRIPTION_PROPERTY |
|
581 |
* @see #ACCESSIBLE_STATE_PROPERTY |
|
582 |
* @see #ACCESSIBLE_VALUE_PROPERTY |
|
583 |
* @see #ACCESSIBLE_SELECTION_PROPERTY |
|
584 |
* @see #ACCESSIBLE_TEXT_PROPERTY |
|
585 |
* @see #ACCESSIBLE_VISIBLE_DATA_PROPERTY |
|
586 |
* |
|
587 |
* @param listener The PropertyChangeListener to be added |
|
588 |
*/ |
|
589 |
public void addPropertyChangeListener(PropertyChangeListener listener) { |
|
590 |
if (accessibleChangeSupport == null) { |
|
591 |
accessibleChangeSupport = new PropertyChangeSupport(this); |
|
592 |
} |
|
593 |
accessibleChangeSupport.addPropertyChangeListener(listener); |
|
594 |
} |
|
595 |
||
596 |
/** |
|
597 |
* Removes a PropertyChangeListener from the listener list. |
|
598 |
* This removes a PropertyChangeListener that was registered |
|
599 |
* for all properties. |
|
600 |
* |
|
601 |
* @param listener The PropertyChangeListener to be removed |
|
602 |
*/ |
|
603 |
public void removePropertyChangeListener(PropertyChangeListener listener) { |
|
604 |
if (accessibleChangeSupport != null) { |
|
605 |
accessibleChangeSupport.removePropertyChangeListener(listener); |
|
606 |
} |
|
607 |
} |
|
608 |
||
609 |
/** |
|
610 |
* Gets the AccessibleAction associated with this object that supports |
|
611 |
* one or more actions. |
|
612 |
* |
|
613 |
* @return AccessibleAction if supported by object; else return null |
|
614 |
* @see AccessibleAction |
|
615 |
*/ |
|
616 |
public AccessibleAction getAccessibleAction() { |
|
617 |
return null; |
|
618 |
} |
|
619 |
||
620 |
/** |
|
621 |
* Gets the AccessibleComponent associated with this object that has a |
|
622 |
* graphical representation. |
|
623 |
* |
|
624 |
* @return AccessibleComponent if supported by object; else return null |
|
625 |
* @see AccessibleComponent |
|
626 |
*/ |
|
627 |
public AccessibleComponent getAccessibleComponent() { |
|
628 |
return null; |
|
629 |
} |
|
630 |
||
631 |
/** |
|
632 |
* Gets the AccessibleSelection associated with this object which allows its |
|
633 |
* Accessible children to be selected. |
|
634 |
* |
|
635 |
* @return AccessibleSelection if supported by object; else return null |
|
636 |
* @see AccessibleSelection |
|
637 |
*/ |
|
638 |
public AccessibleSelection getAccessibleSelection() { |
|
639 |
return null; |
|
640 |
} |
|
641 |
||
642 |
/** |
|
643 |
* Gets the AccessibleText associated with this object presenting |
|
644 |
* text on the display. |
|
645 |
* |
|
646 |
* @return AccessibleText if supported by object; else return null |
|
647 |
* @see AccessibleText |
|
648 |
*/ |
|
649 |
public AccessibleText getAccessibleText() { |
|
650 |
return null; |
|
651 |
} |
|
652 |
||
653 |
/** |
|
654 |
* Gets the AccessibleEditableText associated with this object |
|
655 |
* presenting editable text on the display. |
|
656 |
* |
|
657 |
* @return AccessibleEditableText if supported by object; else return null |
|
658 |
* @see AccessibleEditableText |
|
659 |
* @since 1.4 |
|
660 |
*/ |
|
661 |
public AccessibleEditableText getAccessibleEditableText() { |
|
662 |
return null; |
|
663 |
} |
|
664 |
||
665 |
||
666 |
/** |
|
667 |
* Gets the AccessibleValue associated with this object that supports a |
|
668 |
* Numerical value. |
|
669 |
* |
|
670 |
* @return AccessibleValue if supported by object; else return null |
|
671 |
* @see AccessibleValue |
|
672 |
*/ |
|
673 |
public AccessibleValue getAccessibleValue() { |
|
674 |
return null; |
|
675 |
} |
|
676 |
||
677 |
/** |
|
678 |
* Gets the AccessibleIcons associated with an object that has |
|
679 |
* one or more associated icons |
|
680 |
* |
|
681 |
* @return an array of AccessibleIcon if supported by object; |
|
682 |
* otherwise return null |
|
683 |
* @see AccessibleIcon |
|
684 |
* @since 1.3 |
|
685 |
*/ |
|
686 |
public AccessibleIcon [] getAccessibleIcon() { |
|
687 |
return null; |
|
688 |
} |
|
689 |
||
690 |
/** |
|
691 |
* Gets the AccessibleRelationSet associated with an object |
|
692 |
* |
|
693 |
* @return an AccessibleRelationSet if supported by object; |
|
694 |
* otherwise return null |
|
695 |
* @see AccessibleRelationSet |
|
696 |
* @since 1.3 |
|
697 |
*/ |
|
698 |
public AccessibleRelationSet getAccessibleRelationSet() { |
|
699 |
return relationSet; |
|
700 |
} |
|
701 |
||
702 |
/** |
|
703 |
* Gets the AccessibleTable associated with an object |
|
704 |
* |
|
705 |
* @return an AccessibleTable if supported by object; |
|
706 |
* otherwise return null |
|
707 |
* @see AccessibleTable |
|
708 |
* @since 1.3 |
|
709 |
*/ |
|
710 |
public AccessibleTable getAccessibleTable() { |
|
711 |
return null; |
|
712 |
} |
|
713 |
||
714 |
/** |
|
715 |
* Support for reporting bound property changes. If oldValue and |
|
716 |
* newValue are not equal and the PropertyChangeEvent listener list |
|
717 |
* is not empty, then fire a PropertyChange event to each listener. |
|
718 |
* In general, this is for use by the Accessible objects themselves |
|
719 |
* and should not be called by an application program. |
|
720 |
* @param propertyName The programmatic name of the property that |
|
721 |
* was changed. |
|
722 |
* @param oldValue The old value of the property. |
|
723 |
* @param newValue The new value of the property. |
|
724 |
* @see java.beans.PropertyChangeSupport |
|
725 |
* @see #addPropertyChangeListener |
|
726 |
* @see #removePropertyChangeListener |
|
727 |
* @see #ACCESSIBLE_NAME_PROPERTY |
|
728 |
* @see #ACCESSIBLE_DESCRIPTION_PROPERTY |
|
729 |
* @see #ACCESSIBLE_STATE_PROPERTY |
|
730 |
* @see #ACCESSIBLE_VALUE_PROPERTY |
|
731 |
* @see #ACCESSIBLE_SELECTION_PROPERTY |
|
732 |
* @see #ACCESSIBLE_TEXT_PROPERTY |
|
733 |
* @see #ACCESSIBLE_VISIBLE_DATA_PROPERTY |
|
734 |
*/ |
|
735 |
public void firePropertyChange(String propertyName, |
|
736 |
Object oldValue, |
|
737 |
Object newValue) { |
|
738 |
if (accessibleChangeSupport != null) { |
|
739 |
if (newValue instanceof PropertyChangeEvent) { |
|
740 |
PropertyChangeEvent pce = (PropertyChangeEvent)newValue; |
|
741 |
accessibleChangeSupport.firePropertyChange(pce); |
|
742 |
} else { |
|
743 |
accessibleChangeSupport.firePropertyChange(propertyName, |
|
744 |
oldValue, |
|
745 |
newValue); |
|
746 |
} |
|
747 |
} |
|
748 |
} |
|
749 |
} |