KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > accessibility > AccessibleState


1 /*
2  * @(#)AccessibleState.java 1.38 04/04/15
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.accessibility;
9
10 import java.util.Vector JavaDoc;
11 import java.util.Locale JavaDoc;
12 import java.util.MissingResourceException JavaDoc;
13 import java.util.ResourceBundle JavaDoc;
14
15 /**
16  * <P>Class AccessibleState describes a component's particular state. The actual
17  * state of the component is defined as an AccessibleStateSet, which is a
18  * composed set of AccessibleStates.
19  * <p>The toDisplayString method allows you to obtain the localized string
20  * for a locale independent key from a predefined ResourceBundle for the
21  * keys defined in this class.
22  * <p>The constants in this class present a strongly typed enumeration
23  * of common object roles. A public constructor for this class has been
24  * purposely omitted and applications should use one of the constants
25  * from this class. If the constants in this class are not sufficient
26  * to describe the role of an object, a subclass should be generated
27  * from this class and it should provide constants in a similar manner.
28  *
29  * @version 1.38 04/15/04
30  * @author Willie Walker
31  * @author Peter Korn
32  */

33 public class AccessibleState extends AccessibleBundle JavaDoc {
34
35     // If you add or remove anything from here, make sure you
36
// update AccessibleResourceBundle.java.
37

38     /**
39      * Indicates a window is currently the active window. This includes
40      * windows, dialogs, frames, etc. In addition, this state is used
41      * to indicate the currently active child of a component such as a
42      * list, table, or tree. For example, the active child of a list
43      * is the child that is drawn with a rectangle around it.
44      * @see AccessibleRole#WINDOW
45      * @see AccessibleRole#FRAME
46      * @see AccessibleRole#DIALOG
47      */

48     public static final AccessibleState JavaDoc ACTIVE
49             = new AccessibleState JavaDoc("active");
50
51     /**
52      * Indicates this object is currently pressed. This is usually
53      * associated with buttons and indicates the user has pressed a
54      * mouse button while the pointer was over the button and has
55      * not yet released the mouse button.
56      * @see AccessibleRole#PUSH_BUTTON
57      */

58     public static final AccessibleState JavaDoc PRESSED
59             = new AccessibleState JavaDoc("pressed");
60
61     /**
62      * Indicates that the object is armed. This is usually used on buttons
63      * that have been pressed but not yet released, and the mouse pointer
64      * is still over the button.
65      * @see AccessibleRole#PUSH_BUTTON
66      */

67     public static final AccessibleState JavaDoc ARMED
68             = new AccessibleState JavaDoc("armed");
69
70     /**
71      * Indicates the current object is busy. This is usually used on objects
72      * such as progress bars, sliders, or scroll bars to indicate they are
73      * in a state of transition.
74      * @see AccessibleRole#PROGRESS_BAR
75      * @see AccessibleRole#SCROLL_BAR
76      * @see AccessibleRole#SLIDER
77      */

78     public static final AccessibleState JavaDoc BUSY
79             = new AccessibleState JavaDoc("busy");
80
81     /**
82      * Indicates this object is currently checked. This is usually used on
83      * objects such as toggle buttons, radio buttons, and check boxes.
84      * @see AccessibleRole#TOGGLE_BUTTON
85      * @see AccessibleRole#RADIO_BUTTON
86      * @see AccessibleRole#CHECK_BOX
87      */

88     public static final AccessibleState JavaDoc CHECKED
89             = new AccessibleState JavaDoc("checked");
90
91     /**
92      * Indicates the user can change the contents of this object. This
93      * is usually used primarily for objects that allow the user to
94      * enter text. Other objects, such as scroll bars and sliders,
95      * are automatically editable if they are enabled.
96      * @see #ENABLED
97      */

98     public static final AccessibleState JavaDoc EDITABLE
99             = new AccessibleState JavaDoc("editable");
100
101     /**
102      * Indicates this object allows progressive disclosure of its children.
103      * This is usually used with hierarchical objects such as trees and
104      * is often paired with the EXPANDED or COLLAPSED states.
105      * @see #EXPANDED
106      * @see #COLLAPSED
107      * @see AccessibleRole#TREE
108      */

109     public static final AccessibleState JavaDoc EXPANDABLE
110             = new AccessibleState JavaDoc("expandable");
111
112     /**
113      * Indicates this object is collapsed. This is usually paired with the
114      * EXPANDABLE state and is used on objects that provide progressive
115      * disclosure such as trees.
116      * @see #EXPANDABLE
117      * @see #EXPANDED
118      * @see AccessibleRole#TREE
119      */

120     public static final AccessibleState JavaDoc COLLAPSED
121             = new AccessibleState JavaDoc("collapsed");
122
123     /**
124      * Indicates this object is expanded. This is usually paired with the
125      * EXPANDABLE state and is used on objects that provide progressive
126      * disclosure such as trees.
127      * @see #EXPANDABLE
128      * @see #COLLAPSED
129      * @see AccessibleRole#TREE
130      */

131     public static final AccessibleState JavaDoc EXPANDED
132             = new AccessibleState JavaDoc("expanded");
133
134     /**
135      * Indicates this object is enabled. The absence of this state from an
136      * object's state set indicates this object is not enabled. An object
137      * that is not enabled cannot be manipulated by the user. In a graphical
138      * display, it is usually grayed out.
139      */

140     public static final AccessibleState JavaDoc ENABLED
141             = new AccessibleState JavaDoc("enabled");
142
143     /**
144      * Indicates this object can accept keyboard focus, which means all
145      * events resulting from typing on the keyboard will normally be
146      * passed to it when it has focus.
147      * @see #FOCUSED
148      */

149     public static final AccessibleState JavaDoc FOCUSABLE
150             = new AccessibleState JavaDoc("focusable");
151
152     /**
153      * Indicates this object currently has the keyboard focus.
154      * @see #FOCUSABLE
155      */

156     public static final AccessibleState JavaDoc FOCUSED
157             = new AccessibleState JavaDoc("focused");
158
159     /**
160      * Indicates this object is minimized and is represented only by an
161      * icon. This is usually only associated with frames and internal
162      * frames.
163      * @see AccessibleRole#FRAME
164      * @see AccessibleRole#INTERNAL_FRAME
165      */

166     public static final AccessibleState JavaDoc ICONIFIED
167             = new AccessibleState JavaDoc("iconified");
168
169     /**
170      * Indicates something must be done with this object before the
171      * user can interact with an object in a different window. This
172      * is usually associated only with dialogs.
173      * @see AccessibleRole#DIALOG
174      */

175     public static final AccessibleState JavaDoc MODAL
176             = new AccessibleState JavaDoc("modal");
177
178     /**
179      * Indicates this object paints every pixel within its
180      * rectangular region. A non-opaque component paints only some of
181      * its pixels, allowing the pixels underneath it to "show through".
182      * A component that does not fully paint its pixels therefore
183      * provides a degree of transparency.
184      * @see Accessible#getAccessibleContext
185      * @see AccessibleContext#getAccessibleComponent
186      * @see AccessibleComponent#getBounds
187      */

188     public static final AccessibleState JavaDoc OPAQUE
189             = new AccessibleState JavaDoc("opaque");
190
191     /**
192      * Indicates the size of this object is not fixed.
193      * @see Accessible#getAccessibleContext
194      * @see AccessibleContext#getAccessibleComponent
195      * @see AccessibleComponent#getSize
196      * @see AccessibleComponent#setSize
197      */

198     public static final AccessibleState JavaDoc RESIZABLE
199             = new AccessibleState JavaDoc("resizable");
200
201
202     /**
203      * Indicates this object allows more than one of its children to
204      * be selected at the same time.
205      * @see Accessible#getAccessibleContext
206      * @see AccessibleContext#getAccessibleSelection
207      * @see AccessibleSelection
208      */

209     public static final AccessibleState JavaDoc MULTISELECTABLE
210             = new AccessibleState JavaDoc("multiselectable");
211
212     /**
213      * Indicates this object is the child of an object that allows its
214      * children to be selected, and that this child is one of those
215      * children that can be selected.
216      * @see #SELECTED
217      * @see Accessible#getAccessibleContext
218      * @see AccessibleContext#getAccessibleSelection
219      * @see AccessibleSelection
220      */

221     public static final AccessibleState JavaDoc SELECTABLE
222             = new AccessibleState JavaDoc("selectable");
223
224     /**
225      * Indicates this object is the child of an object that allows its
226      * children to be selected, and that this child is one of those
227      * children that has been selected.
228      * @see #SELECTABLE
229      * @see Accessible#getAccessibleContext
230      * @see AccessibleContext#getAccessibleSelection
231      * @see AccessibleSelection
232      */

233     public static final AccessibleState JavaDoc SELECTED
234             = new AccessibleState JavaDoc("selected");
235
236     /**
237      * Indicates this object, the object's parent, the object's parent's
238      * parent, and so on, are all visible. Note that this does not
239      * necessarily mean the object is painted on the screen. It might
240      * be occluded by some other showing object.
241      * @see #VISIBLE
242      */

243     public static final AccessibleState JavaDoc SHOWING
244             = new AccessibleState JavaDoc("showing");
245
246     /**
247      * Indicates this object is visible. Note: this means that the
248      * object intends to be visible; however, it may not in fact be
249      * showing on the screen because one of the objects that this object
250      * is contained by is not visible.
251      * @see #SHOWING
252      */

253     public static final AccessibleState JavaDoc VISIBLE
254             = new AccessibleState JavaDoc("visible");
255
256     /**
257      * Indicates the orientation of this object is vertical. This is
258      * usually associated with objects such as scrollbars, sliders, and
259      * progress bars.
260      * @see #VERTICAL
261      * @see AccessibleRole#SCROLL_BAR
262      * @see AccessibleRole#SLIDER
263      * @see AccessibleRole#PROGRESS_BAR
264      */

265     public static final AccessibleState JavaDoc VERTICAL
266             = new AccessibleState JavaDoc("vertical");
267
268     /**
269      * Indicates the orientation of this object is horizontal. This is
270      * usually associated with objects such as scrollbars, sliders, and
271      * progress bars.
272      * @see #HORIZONTAL
273      * @see AccessibleRole#SCROLL_BAR
274      * @see AccessibleRole#SLIDER
275      * @see AccessibleRole#PROGRESS_BAR
276      */

277     public static final AccessibleState JavaDoc HORIZONTAL
278             = new AccessibleState JavaDoc("horizontal");
279
280     /**
281      * Indicates this (text) object can contain only a single line of text
282      */

283     public static final AccessibleState JavaDoc SINGLE_LINE
284             = new AccessibleState JavaDoc("singleline");
285
286     /**
287      * Indicates this (text) object can contain multiple lines of text
288      */

289     public static final AccessibleState JavaDoc MULTI_LINE
290             = new AccessibleState JavaDoc("multiline");
291
292     /**
293      * Indicates this object is transient. An assistive technology should
294      * not add a PropertyChange listener to an object with transient state,
295      * as that object will never generate any events. Transient objects
296      * are typically created to answer Java Accessibility method queries,
297      * but otherwise do not remain linked to the underlying object (for
298      * example, those objects underneath lists, tables, and trees in Swing,
299      * where only one actual UI Component does shared rendering duty for
300      * all of the data objects underneath the actual list/table/tree elements).
301      *
302      * @since 1.5
303      *
304      */

305     public static final AccessibleState JavaDoc TRANSIENT
306             = new AccessibleState JavaDoc("transient");
307
308     /**
309      * Indicates this object is responsible for managing its
310      * subcomponents. This is typically used for trees and tables
311      * that have a large number of subcomponents and where the
312      * objects are created only when needed and otherwise remain virtual.
313      * The application should not manage the subcomponents directly.
314      *
315      * @since 1.5
316      */

317     public static final AccessibleState JavaDoc MANAGES_DESCENDANTS
318             = new AccessibleState JavaDoc ("managesDescendants");
319  
320     /**
321      * Indicates that the object state is indeterminate. An example
322      * is selected text that is partially bold and partially not
323      * bold. In this case the attributes associated with the selected
324      * text are indeterminate.
325      *
326      * @since 1.5
327      */

328     public static final AccessibleState JavaDoc INDETERMINATE
329            = new AccessibleState JavaDoc ("indeterminate");
330
331     /**
332      * A state indicating that text is truncated by a bounding rectangle
333      * and that some of the text is not displayed on the screen. An example
334      * is text in a spreadsheet cell that is truncated by the bounds of
335      * the cell.
336      *
337      * @since 1.5
338      */

339     static public final AccessibleState JavaDoc TRUNCATED
340            = new AccessibleState JavaDoc("truncated");
341
342     /**
343      * Creates a new AccessibleState using the given locale independent key.
344      * This should not be a public method. Instead, it is used to create
345      * the constants in this file to make it a strongly typed enumeration.
346      * Subclasses of this class should enforce similar policy.
347      * <p>
348      * The key String should be a locale independent key for the state.
349      * It is not intended to be used as the actual String to display
350      * to the user. To get the localized string, use toDisplayString.
351      *
352      * @param key the locale independent name of the state.
353      * @see AccessibleBundle#toDisplayString
354      */

355     protected AccessibleState(String JavaDoc key) {
356         this.key = key;
357     }
358 }
359
Popular Tags