001 /*
002 * Copyright 1997-2004 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025
026 package javax.accessibility;
027
028 import java.util.Vector;
029 import java.util.Locale;
030 import java.util.MissingResourceException;
031 import java.util.ResourceBundle;
032
033 /**
034 * <P>Class AccessibleState describes a component's particular state. The actual
035 * state of the component is defined as an AccessibleStateSet, which is a
036 * composed set of AccessibleStates.
037 * <p>The toDisplayString method allows you to obtain the localized string
038 * for a locale independent key from a predefined ResourceBundle for the
039 * keys defined in this class.
040 * <p>The constants in this class present a strongly typed enumeration
041 * of common object roles. A public constructor for this class has been
042 * purposely omitted and applications should use one of the constants
043 * from this class. If the constants in this class are not sufficient
044 * to describe the role of an object, a subclass should be generated
045 * from this class and it should provide constants in a similar manner.
046 *
047 * @version 1.45 05/05/07
048 * @author Willie Walker
049 * @author Peter Korn
050 */
051 public class AccessibleState extends AccessibleBundle {
052
053 // If you add or remove anything from here, make sure you
054 // update AccessibleResourceBundle.java.
055
056 /**
057 * Indicates a window is currently the active window. This includes
058 * windows, dialogs, frames, etc. In addition, this state is used
059 * to indicate the currently active child of a component such as a
060 * list, table, or tree. For example, the active child of a list
061 * is the child that is drawn with a rectangle around it.
062 * @see AccessibleRole#WINDOW
063 * @see AccessibleRole#FRAME
064 * @see AccessibleRole#DIALOG
065 */
066 public static final AccessibleState ACTIVE = new AccessibleState(
067 "active");
068
069 /**
070 * Indicates this object is currently pressed. This is usually
071 * associated with buttons and indicates the user has pressed a
072 * mouse button while the pointer was over the button and has
073 * not yet released the mouse button.
074 * @see AccessibleRole#PUSH_BUTTON
075 */
076 public static final AccessibleState PRESSED = new AccessibleState(
077 "pressed");
078
079 /**
080 * Indicates that the object is armed. This is usually used on buttons
081 * that have been pressed but not yet released, and the mouse pointer
082 * is still over the button.
083 * @see AccessibleRole#PUSH_BUTTON
084 */
085 public static final AccessibleState ARMED = new AccessibleState(
086 "armed");
087
088 /**
089 * Indicates the current object is busy. This is usually used on objects
090 * such as progress bars, sliders, or scroll bars to indicate they are
091 * in a state of transition.
092 * @see AccessibleRole#PROGRESS_BAR
093 * @see AccessibleRole#SCROLL_BAR
094 * @see AccessibleRole#SLIDER
095 */
096 public static final AccessibleState BUSY = new AccessibleState(
097 "busy");
098
099 /**
100 * Indicates this object is currently checked. This is usually used on
101 * objects such as toggle buttons, radio buttons, and check boxes.
102 * @see AccessibleRole#TOGGLE_BUTTON
103 * @see AccessibleRole#RADIO_BUTTON
104 * @see AccessibleRole#CHECK_BOX
105 */
106 public static final AccessibleState CHECKED = new AccessibleState(
107 "checked");
108
109 /**
110 * Indicates the user can change the contents of this object. This
111 * is usually used primarily for objects that allow the user to
112 * enter text. Other objects, such as scroll bars and sliders,
113 * are automatically editable if they are enabled.
114 * @see #ENABLED
115 */
116 public static final AccessibleState EDITABLE = new AccessibleState(
117 "editable");
118
119 /**
120 * Indicates this object allows progressive disclosure of its children.
121 * This is usually used with hierarchical objects such as trees and
122 * is often paired with the EXPANDED or COLLAPSED states.
123 * @see #EXPANDED
124 * @see #COLLAPSED
125 * @see AccessibleRole#TREE
126 */
127 public static final AccessibleState EXPANDABLE = new AccessibleState(
128 "expandable");
129
130 /**
131 * Indicates this object is collapsed. This is usually paired with the
132 * EXPANDABLE state and is used on objects that provide progressive
133 * disclosure such as trees.
134 * @see #EXPANDABLE
135 * @see #EXPANDED
136 * @see AccessibleRole#TREE
137 */
138 public static final AccessibleState COLLAPSED = new AccessibleState(
139 "collapsed");
140
141 /**
142 * Indicates this object is expanded. This is usually paired with the
143 * EXPANDABLE state and is used on objects that provide progressive
144 * disclosure such as trees.
145 * @see #EXPANDABLE
146 * @see #COLLAPSED
147 * @see AccessibleRole#TREE
148 */
149 public static final AccessibleState EXPANDED = new AccessibleState(
150 "expanded");
151
152 /**
153 * Indicates this object is enabled. The absence of this state from an
154 * object's state set indicates this object is not enabled. An object
155 * that is not enabled cannot be manipulated by the user. In a graphical
156 * display, it is usually grayed out.
157 */
158 public static final AccessibleState ENABLED = new AccessibleState(
159 "enabled");
160
161 /**
162 * Indicates this object can accept keyboard focus, which means all
163 * events resulting from typing on the keyboard will normally be
164 * passed to it when it has focus.
165 * @see #FOCUSED
166 */
167 public static final AccessibleState FOCUSABLE = new AccessibleState(
168 "focusable");
169
170 /**
171 * Indicates this object currently has the keyboard focus.
172 * @see #FOCUSABLE
173 */
174 public static final AccessibleState FOCUSED = new AccessibleState(
175 "focused");
176
177 /**
178 * Indicates this object is minimized and is represented only by an
179 * icon. This is usually only associated with frames and internal
180 * frames.
181 * @see AccessibleRole#FRAME
182 * @see AccessibleRole#INTERNAL_FRAME
183 */
184 public static final AccessibleState ICONIFIED = new AccessibleState(
185 "iconified");
186
187 /**
188 * Indicates something must be done with this object before the
189 * user can interact with an object in a different window. This
190 * is usually associated only with dialogs.
191 * @see AccessibleRole#DIALOG
192 */
193 public static final AccessibleState MODAL = new AccessibleState(
194 "modal");
195
196 /**
197 * Indicates this object paints every pixel within its
198 * rectangular region. A non-opaque component paints only some of
199 * its pixels, allowing the pixels underneath it to "show through".
200 * A component that does not fully paint its pixels therefore
201 * provides a degree of transparency.
202 * @see Accessible#getAccessibleContext
203 * @see AccessibleContext#getAccessibleComponent
204 * @see AccessibleComponent#getBounds
205 */
206 public static final AccessibleState OPAQUE = new AccessibleState(
207 "opaque");
208
209 /**
210 * Indicates the size of this object is not fixed.
211 * @see Accessible#getAccessibleContext
212 * @see AccessibleContext#getAccessibleComponent
213 * @see AccessibleComponent#getSize
214 * @see AccessibleComponent#setSize
215 */
216 public static final AccessibleState RESIZABLE = new AccessibleState(
217 "resizable");
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 = new AccessibleState(
227 "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 = new AccessibleState(
239 "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 = new AccessibleState(
251 "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 = new AccessibleState(
261 "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 = new AccessibleState(
271 "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 = new AccessibleState(
283 "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 = new AccessibleState(
295 "horizontal");
296
297 /**
298 * Indicates this (text) object can contain only a single line of text
299 */
300 public static final AccessibleState SINGLE_LINE = new AccessibleState(
301 "singleline");
302
303 /**
304 * Indicates this (text) object can contain multiple lines of text
305 */
306 public static final AccessibleState MULTI_LINE = new AccessibleState(
307 "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 = new AccessibleState(
323 "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 = new AccessibleState(
335 "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 = new AccessibleState(
346 "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 = new AccessibleState(
357 "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 }
|