1 /* AccessibleState.java -- a state of an accessible object
2    Copyright (C) 2002, 2005 Free Software Foundation
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 package javax.accessibility;
39 
40 import java.awt.Dimension;
41 import java.util.Locale;
42 
43 /**
44  * A state portion of an accessible object. A combination of states represent
45  * the entire object state, in an AccessibleStateSet. For example, this could
46  * be "active" or "selected". This strongly typed "enumeration" supports
47  * localized strings. If the constants of this class are not adequate, new
48  * ones may be added in a similar matter, while avoiding a public constructor.
49  *
50  * @author Eric Blake (ebb9@email.byu.edu)
51  * @since 1.2
52  * @status updated to 1.4
53  */
54 public class AccessibleState extends AccessibleBundle
55 {
56   /**
57    * Indicates an active window, as well as an active child in a list or other
58    * collection.
59    *
60    * @see AccessibleRole#WINDOW
61    * @see AccessibleRole#FRAME
62    * @see AccessibleRole#DIALOG
63    */
64   public static final AccessibleState ACTIVE
65     = new AccessibleState("active");
66 
67   /**
68    * Indicates a pushed button, usually when the mouse has been pressed but
69    * not released.
70    *
71    * @see AccessibleRole#PUSH_BUTTON
72    */
73   public static final AccessibleState PRESSED
74     = new AccessibleState("pressed");
75 
76   /**
77    * Indicates an armed object, usually a button which has been pushed and
78    * the mouse has not left the button area.
79    *
80    * @see AccessibleRole#PUSH_BUTTON
81    */
82   public static final AccessibleState ARMED
83     = new AccessibleState("armed");
84 
85   /**
86    * Indicates an object is busy, such as a slider, scroll bar, or progress
87    * bar in transition.
88    *
89    * @see AccessibleRole#PROGRESS_BAR
90    * @see AccessibleRole#SCROLL_BAR
91    * @see AccessibleRole#SLIDER
92    */
93   public static final AccessibleState BUSY
94     = new AccessibleState("busy");
95 
96   /**
97    * Indicates an object is checked.
98    *
99    * @see AccessibleRole#TOGGLE_BUTTON
100    * @see AccessibleRole#RADIO_BUTTON
101    * @see AccessibleRole#CHECK_BOX
102    */
103   public static final AccessibleState CHECKED
104     = new AccessibleState("checked");
105 
106   /**
107    * Indicates the user can edit the component contents. This is usually for
108    * text, as other objects like scroll bars are automatically editable.
109    *
110    * @see #ENABLED
111    */
112   public static final AccessibleState EDITABLE
113     = new AccessibleState("editable");
114 
115   /**
116    * Indicates the object allows progressive disclosure of its children,
117    * usually in a collapsible tree or other hierachical object.
118    *
119    * @see #EXPANDED
120    * @see #COLLAPSED
121    * @see AccessibleRole#TREE
122    */
123   public static final AccessibleState EXPANDABLE
124     = new AccessibleState("expandable");
125 
126   /**
127    * Indicates that the object is collapsed, usually in a tree.
128    *
129    * @see #EXPANDABLE
130    * @see #EXPANDED
131    * @see AccessibleRole#TREE
132    */
133   public static final AccessibleState COLLAPSED
134     = new AccessibleState("collapsed");
135 
136   /**
137    * Indicates that the object is expanded, usually in a tree.
138    *
139    * @see #EXPANDABLE
140    * @see #COLLAPSED
141    * @see AccessibleRole#TREE
142    */
143   public static final AccessibleState EXPANDED
144     = new AccessibleState("expanded");
145 
146   /**
147    * Indicates that an object is enabled. In the absence of this state,
148    * graphics are often grayed out, and cannot be manipulated.
149    */
150   public static final AccessibleState ENABLED
151     = new AccessibleState("enabled");
152 
153   /**
154    * Indicates that an object can accept focus, which means it will process
155    * keyboard events when focused.
156    *
157    * @see #FOCUSED
158    */
159   public static final AccessibleState FOCUSABLE
160     = new AccessibleState("focusable");
161 
162   /**
163    * Indicates that an object has keyboard focus.
164    *
165    * @see #FOCUSABLE
166    */
167   public static final AccessibleState FOCUSED
168     = new AccessibleState("focused");
169 
170   /**
171    * Indicates that an object is minimized to an icon.
172    *
173    * @see AccessibleRole#FRAME
174    * @see AccessibleRole#INTERNAL_FRAME
175    */
176   public static final AccessibleState ICONIFIED
177     = new AccessibleState("iconified");
178 
179   /**
180    * Indicates that the state of this particular object is
181    * indeterminate.  This commonly occurs when an object is incapable
182    * of representing the state by a single value.
183    *
184    * @since 1.5
185    */
186   public static final AccessibleState INDETERMINATE
187     = new AccessibleState("indeterminate");
188 
189   /**
190    * Indicates that this particular object manages a number of
191    * subcomponents.  This is a common property of structures such as
192    * trees and tables, which have a number of sub-elements such as
193    * rows and columns.  The subcomponents should be left to the
194    * object, and not managed by the application.
195    *
196    * @since 1.5
197    */
198   public static final AccessibleState MANAGES_DESCENDANTS
199     = new AccessibleState("manages descendants");
200 
201   /**
202    * Indicates that something must be done in the current object before
203    * interaction is allowed on other windows, usually for dialogs.
204    *
205    * @see AccessibleRole#DIALOG
206    */
207   public static final AccessibleState MODAL
208     = new AccessibleState("modal");
209 
210   /**
211    * Indicates that all pixels in the object are painted. If this state is not
212    * present, then the object has some degree of transparency, letting lower
213    * panes show through.
214    *
215    * @see Accessible#getAccessibleContext()
216    * @see AccessibleContext#getAccessibleComponent()
217    * @see AccessibleComponent#getBounds()
218    */
219   public static final AccessibleState OPAQUE
220     = new AccessibleState("opaque");
221 
222   /**
223    * Indicates the size of this object is not fixed.
224    *
225    * @see Accessible#getAccessibleContext()
226    * @see AccessibleContext#getAccessibleComponent()
227    * @see AccessibleComponent#getSize()
228    * @see AccessibleComponent#setSize(Dimension)
229    */
230   public static final AccessibleState RESIZABLE
231     = new AccessibleState("resizable");
232 
233   /**
234    * Indicates that multiple children can be selected at once.
235    *
236    * @see Accessible#getAccessibleContext()
237    * @see AccessibleContext#getAccessibleSelection()
238    * @see AccessibleSelection
239    */
240   public static final AccessibleState MULTISELECTABLE
241     = new AccessibleState("multiselectable");
242 
243   /**
244    * Indicates that this child is one which can be selected from its parent.
245    *
246    * @see #SELECTED
247    * @see Accessible#getAccessibleContext()
248    * @see AccessibleContext#getAccessibleSelection()
249    * @see AccessibleSelection
250    */
251   public static final AccessibleState SELECTABLE
252     = new AccessibleState("selectable");
253 
254   /**
255    * Indicates that this child has been selected from its parent.
256    *
257    * @see #SELECTABLE
258    * @see Accessible#getAccessibleContext()
259    * @see AccessibleContext#getAccessibleSelection()
260    * @see AccessibleSelection
261    */
262   public static final AccessibleState SELECTED
263     = new AccessibleState("selected");
264 
265   /**
266    * Indicates that this object and all its parents are visible, so that it
267    * is on the screen. However, something opaque may be on top of it.
268    *
269    * @see #VISIBLE
270    */
271   public static final AccessibleState SHOWING
272     = new AccessibleState("showing");
273 
274   /**
275    * Indicates that this particular object is truncated when displayed
276    * visually.
277    *
278    * @since 1.5
279    */
280   public static final AccessibleState TRUNCATED
281     = new AccessibleState("truncated");
282 
283   /**
284    * Indicates that this object intends to be visible. However, if its
285    * parent is invisible, this object is as well.
286    *
287    * @see #SHOWING
288    */
289   public static final AccessibleState VISIBLE
290     = new AccessibleState("visible");
291 
292   /**
293    * Indicates that an object has vertical orientation.
294    *
295    * @see #HORIZONTAL
296    * @see AccessibleRole#SCROLL_BAR
297    * @see AccessibleRole#SLIDER
298    * @see AccessibleRole#PROGRESS_BAR
299    */
300   public static final AccessibleState VERTICAL
301     = new AccessibleState("vertical");
302 
303   /**
304    * Indicates that an object has horizontal orientation.
305    *
306    * @see #VERTICAL
307    * @see AccessibleRole#SCROLL_BAR
308    * @see AccessibleRole#SLIDER
309    * @see AccessibleRole#PROGRESS_BAR
310    */
311   public static final AccessibleState HORIZONTAL
312     = new AccessibleState("horizontal");
313 
314   /**
315    * Indicates that this text object can only hold a single line.
316    *
317    * @see #MULTI_LINE
318    */
319   public static final AccessibleState SINGLE_LINE
320     = new AccessibleState("single line");
321 
322   /**
323    * Indicates that this text object can hold multiple lines.
324    *
325    * @see #SINGLE_LINE
326    */
327   public static final AccessibleState MULTI_LINE
328     = new AccessibleState("multiple line");
329 
330   /**
331    * Indicates that this object is transient. This means the object is
332    * generated for method queries, but will never generate events, because
333    * its container (such as a tree, list, or table) does all the work.
334    */
335   public static final AccessibleState TRANSIENT
336     = new AccessibleState("transient");
337 
338   /**
339    * Create a new constant with a locale independent key. Follow the example,
340    * keep the constructor private and make public constants instead.
341    *
342    * @param key the name of the state
343    * @see #toDisplayString(String, Locale)
344    */
AccessibleState(String key)345   protected AccessibleState(String key)
346   {
347     this.key = key;
348   }
349 } // class AccessibleState
350