blob: a597bb883ffc3dfa626885689c817260ea73d6f9 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1997-2004 Sun Microsystems, Inc. All Rights Reserved.
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
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
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 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26package javax.accessibility;
27
28import java.util.Vector;
29import java.util.Locale;
30import java.util.MissingResourceException;
31import java.util.ResourceBundle;
32
33/**
34 * <P>Class AccessibleState describes a component's particular state. The actual
35 * state of the component is defined as an AccessibleStateSet, which is a
36 * composed set of AccessibleStates.
37 * <p>The toDisplayString method allows you to obtain the localized string
38 * for a locale independent key from a predefined ResourceBundle for the
39 * keys defined in this class.
40 * <p>The constants in this class present a strongly typed enumeration
41 * of common object roles. A public constructor for this class has been
42 * purposely omitted and applications should use one of the constants
43 * from this class. If the constants in this class are not sufficient
44 * to describe the role of an object, a subclass should be generated
45 * from this class and it should provide constants in a similar manner.
46 *
47 * @author Willie Walker
48 * @author Peter Korn
49 */
50public class AccessibleState extends AccessibleBundle {
51
52 // If you add or remove anything from here, make sure you
53 // update AccessibleResourceBundle.java.
54
55 /**
56 * Indicates a window is currently the active window. This includes
57 * windows, dialogs, frames, etc. In addition, this state is used
58 * to indicate the currently active child of a component such as a
59 * list, table, or tree. For example, the active child of a list
60 * is the child that is drawn with a rectangle around it.
61 * @see AccessibleRole#WINDOW
62 * @see AccessibleRole#FRAME
63 * @see AccessibleRole#DIALOG
64 */
65 public static final AccessibleState ACTIVE
66 = new AccessibleState("active");
67
68 /**
69 * Indicates this object is currently pressed. This is usually
70 * associated with buttons and indicates the user has pressed a
71 * mouse button while the pointer was over the button and has
72 * not yet released the mouse button.
73 * @see AccessibleRole#PUSH_BUTTON
74 */
75 public static final AccessibleState PRESSED
76 = new AccessibleState("pressed");
77
78 /**
79 * Indicates that the object is armed. This is usually used on buttons
80 * that have been pressed but not yet released, and the mouse pointer
81 * is still over the button.
82 * @see AccessibleRole#PUSH_BUTTON
83 */
84 public static final AccessibleState ARMED
85 = new AccessibleState("armed");
86
87 /**
88 * Indicates the current object is busy. This is usually used on objects
89 * such as progress bars, sliders, or scroll bars to indicate they are
90 * in a state of transition.
91 * @see AccessibleRole#PROGRESS_BAR
92 * @see AccessibleRole#SCROLL_BAR
93 * @see AccessibleRole#SLIDER
94 */
95 public static final AccessibleState BUSY
96 = new AccessibleState("busy");
97
98 /**
99 * Indicates this object is currently checked. This is usually used on
100 * objects such as toggle buttons, radio buttons, and check boxes.
101 * @see AccessibleRole#TOGGLE_BUTTON
102 * @see AccessibleRole#RADIO_BUTTON
103 * @see AccessibleRole#CHECK_BOX
104 */
105 public static final AccessibleState CHECKED
106 = new AccessibleState("checked");
107
108 /**
109 * Indicates the user can change the contents of this object. This
110 * is usually used primarily for objects that allow the user to
111 * enter text. Other objects, such as scroll bars and sliders,
112 * are automatically editable if they are enabled.
113 * @see #ENABLED
114 */
115 public static final AccessibleState EDITABLE
116 = new AccessibleState("editable");
117
118 /**
119 * Indicates this object allows progressive disclosure of its children.
120 * This is usually used with hierarchical objects such as trees and
121 * is often paired with the EXPANDED or COLLAPSED states.
122 * @see #EXPANDED
123 * @see #COLLAPSED
124 * @see AccessibleRole#TREE
125 */
126 public static final AccessibleState EXPANDABLE
127 = new AccessibleState("expandable");
128
129 /**
130 * Indicates this object is collapsed. This is usually paired with the
131 * EXPANDABLE state and is used on objects that provide progressive
132 * disclosure such as trees.
133 * @see #EXPANDABLE
134 * @see #EXPANDED
135 * @see AccessibleRole#TREE
136 */
137 public static final AccessibleState COLLAPSED
138 = new AccessibleState("collapsed");
139
140 /**
141 * Indicates this object is expanded. This is usually paired with the
142 * EXPANDABLE state and is used on objects that provide progressive
143 * disclosure such as trees.
144 * @see #EXPANDABLE
145 * @see #COLLAPSED
146 * @see AccessibleRole#TREE
147 */
148 public static final AccessibleState EXPANDED
149 = new AccessibleState("expanded");
150
151 /**
152 * Indicates this object is enabled. The absence of this state from an
153 * object's state set indicates this object is not enabled. An object
154 * that is not enabled cannot be manipulated by the user. In a graphical
155 * display, it is usually grayed out.
156 */
157 public static final AccessibleState ENABLED
158 = new AccessibleState("enabled");
159
160 /**
161 * Indicates this object can accept keyboard focus, which means all
162 * events resulting from typing on the keyboard will normally be
163 * passed to it when it has focus.
164 * @see #FOCUSED
165 */
166 public static final AccessibleState FOCUSABLE
167 = new AccessibleState("focusable");
168
169 /**
170 * Indicates this object currently has the keyboard focus.
171 * @see #FOCUSABLE
172 */
173 public static final AccessibleState FOCUSED
174 = new AccessibleState("focused");
175
176 /**
177 * Indicates this object is minimized and is represented only by an
178 * icon. This is usually only associated with frames and internal
179 * frames.
180 * @see AccessibleRole#FRAME
181 * @see AccessibleRole#INTERNAL_FRAME
182 */
183 public static final AccessibleState ICONIFIED
184 = new AccessibleState("iconified");
185
186 /**
187 * Indicates something must be done with this object before the
188 * user can interact with an object in a different window. This
189 * is usually associated only with dialogs.
190 * @see AccessibleRole#DIALOG
191 */
192 public static final AccessibleState MODAL
193 = new AccessibleState("modal");
194
195 /**
196 * Indicates this object paints every pixel within its
197 * rectangular region. A non-opaque component paints only some of
198 * its pixels, allowing the pixels underneath it to "show through".
199 * A component that does not fully paint its pixels therefore
200 * provides a degree of transparency.
201 * @see Accessible#getAccessibleContext
202 * @see AccessibleContext#getAccessibleComponent
203 * @see AccessibleComponent#getBounds
204 */
205 public static final AccessibleState OPAQUE
206 = new AccessibleState("opaque");
207
208 /**
209 * Indicates the size of this object is not fixed.
210 * @see Accessible#getAccessibleContext
211 * @see AccessibleContext#getAccessibleComponent
212 * @see AccessibleComponent#getSize
213 * @see AccessibleComponent#setSize
214 */
215 public static final AccessibleState RESIZABLE
216 = new AccessibleState("resizable");
217
218
219 /**
220 * Indicates this object allows more than one of its children to
221 * be selected at the same time.
222 * @see Accessible#getAccessibleContext
223 * @see AccessibleContext#getAccessibleSelection
224 * @see AccessibleSelection
225 */
226 public static final AccessibleState MULTISELECTABLE
227 = new AccessibleState("multiselectable");
228
229 /**
230 * Indicates this object is the child of an object that allows its
231 * children to be selected, and that this child is one of those
232 * children that can be selected.
233 * @see #SELECTED
234 * @see Accessible#getAccessibleContext
235 * @see AccessibleContext#getAccessibleSelection
236 * @see AccessibleSelection
237 */
238 public static final AccessibleState SELECTABLE
239 = new AccessibleState("selectable");
240
241 /**
242 * Indicates this object is the child of an object that allows its
243 * children to be selected, and that this child is one of those
244 * children that has been selected.
245 * @see #SELECTABLE
246 * @see Accessible#getAccessibleContext
247 * @see AccessibleContext#getAccessibleSelection
248 * @see AccessibleSelection
249 */
250 public static final AccessibleState SELECTED
251 = new AccessibleState("selected");
252
253 /**
254 * Indicates this object, the object's parent, the object's parent's
255 * parent, and so on, are all visible. Note that this does not
256 * necessarily mean the object is painted on the screen. It might
257 * be occluded by some other showing object.
258 * @see #VISIBLE
259 */
260 public static final AccessibleState SHOWING
261 = new AccessibleState("showing");
262
263 /**
264 * Indicates this object is visible. Note: this means that the
265 * object intends to be visible; however, it may not in fact be
266 * showing on the screen because one of the objects that this object
267 * is contained by is not visible.
268 * @see #SHOWING
269 */
270 public static final AccessibleState VISIBLE
271 = new AccessibleState("visible");
272
273 /**
274 * Indicates the orientation of this object is vertical. This is
275 * usually associated with objects such as scrollbars, sliders, and
276 * progress bars.
277 * @see #VERTICAL
278 * @see AccessibleRole#SCROLL_BAR
279 * @see AccessibleRole#SLIDER
280 * @see AccessibleRole#PROGRESS_BAR
281 */
282 public static final AccessibleState VERTICAL
283 = new AccessibleState("vertical");
284
285 /**
286 * Indicates the orientation of this object is horizontal. This is
287 * usually associated with objects such as scrollbars, sliders, and
288 * progress bars.
289 * @see #HORIZONTAL
290 * @see AccessibleRole#SCROLL_BAR
291 * @see AccessibleRole#SLIDER
292 * @see AccessibleRole#PROGRESS_BAR
293 */
294 public static final AccessibleState HORIZONTAL
295 = new AccessibleState("horizontal");
296
297 /**
298 * Indicates this (text) object can contain only a single line of text
299 */
300 public static final AccessibleState SINGLE_LINE
301 = new AccessibleState("singleline");
302
303 /**
304 * Indicates this (text) object can contain multiple lines of text
305 */
306 public static final AccessibleState MULTI_LINE
307 = new AccessibleState("multiline");
308
309 /**
310 * Indicates this object is transient. An assistive technology should
311 * not add a PropertyChange listener to an object with transient state,
312 * as that object will never generate any events. Transient objects
313 * are typically created to answer Java Accessibility method queries,
314 * but otherwise do not remain linked to the underlying object (for
315 * example, those objects underneath lists, tables, and trees in Swing,
316 * where only one actual UI Component does shared rendering duty for
317 * all of the data objects underneath the actual list/table/tree elements).
318 *
319 * @since 1.5
320 *
321 */
322 public static final AccessibleState TRANSIENT
323 = new AccessibleState("transient");
324
325 /**
326 * Indicates this object is responsible for managing its
327 * subcomponents. This is typically used for trees and tables
328 * that have a large number of subcomponents and where the
329 * objects are created only when needed and otherwise remain virtual.
330 * The application should not manage the subcomponents directly.
331 *
332 * @since 1.5
333 */
334 public static final AccessibleState MANAGES_DESCENDANTS
335 = new AccessibleState ("managesDescendants");
336
337 /**
338 * Indicates that the object state is indeterminate. An example
339 * is selected text that is partially bold and partially not
340 * bold. In this case the attributes associated with the selected
341 * text are indeterminate.
342 *
343 * @since 1.5
344 */
345 public static final AccessibleState INDETERMINATE
346 = new AccessibleState ("indeterminate");
347
348 /**
349 * A state indicating that text is truncated by a bounding rectangle
350 * and that some of the text is not displayed on the screen. An example
351 * is text in a spreadsheet cell that is truncated by the bounds of
352 * the cell.
353 *
354 * @since 1.5
355 */
356 static public final AccessibleState TRUNCATED
357 = new AccessibleState("truncated");
358
359 /**
360 * Creates a new AccessibleState using the given locale independent key.
361 * This should not be a public method. Instead, it is used to create
362 * the constants in this file to make it a strongly typed enumeration.
363 * Subclasses of this class should enforce similar policy.
364 * <p>
365 * The key String should be a locale independent key for the state.
366 * It is not intended to be used as the actual String to display
367 * to the user. To get the localized string, use toDisplayString.
368 *
369 * @param key the locale independent name of the state.
370 * @see AccessibleBundle#toDisplayString
371 */
372 protected AccessibleState(String key) {
373 this.key = key;
374 }
375}