001 /* AccessibleState.java -- a state of an accessible object
002 Copyright (C) 2002, 2005 Free Software Foundation
003
004 This file is part of GNU Classpath.
005
006 GNU Classpath is free software; you can redistribute it and/or modify
007 it under the terms of the GNU General Public License as published by
008 the Free Software Foundation; either version 2, or (at your option)
009 any later version.
010
011 GNU Classpath is distributed in the hope that it will be useful, but
012 WITHOUT ANY WARRANTY; without even the implied warranty of
013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014 General Public License for more details.
015
016 You should have received a copy of the GNU General Public License
017 along with GNU Classpath; see the file COPYING. If not, write to the
018 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
019 02110-1301 USA.
020
021 Linking this library statically or dynamically with other modules is
022 making a combined work based on this library. Thus, the terms and
023 conditions of the GNU General Public License cover the whole
024 combination.
025
026 As a special exception, the copyright holders of this library give you
027 permission to link this library with independent modules to produce an
028 executable, regardless of the license terms of these independent
029 modules, and to copy and distribute the resulting executable under
030 terms of your choice, provided that you also meet, for each linked
031 independent module, the terms and conditions of the license of that
032 module. An independent module is a module which is not derived from
033 or based on this library. If you modify this library, you may extend
034 this exception to your version of the library, but you are not
035 obligated to do so. If you do not wish to do so, delete this
036 exception statement from your version. */
037
038 package javax.accessibility;
039
040 import java.awt.Dimension;
041 import java.util.Locale;
042
043 /**
044 * A state portion of an accessible object. A combination of states represent
045 * the entire object state, in an AccessibleStateSet. For example, this could
046 * be "active" or "selected". This strongly typed "enumeration" supports
047 * localized strings. If the constants of this class are not adequate, new
048 * ones may be added in a similar matter, while avoiding a public constructor.
049 *
050 * @author Eric Blake (ebb9@email.byu.edu)
051 * @since 1.2
052 * @status updated to 1.4
053 */
054 public class AccessibleState extends AccessibleBundle
055 {
056 /**
057 * Indicates an active window, as well as an active child in a list or other
058 * collection.
059 *
060 * @see AccessibleRole#WINDOW
061 * @see AccessibleRole#FRAME
062 * @see AccessibleRole#DIALOG
063 */
064 public static final AccessibleState ACTIVE
065 = new AccessibleState("active");
066
067 /**
068 * Indicates a pushed button, usually when the mouse has been pressed but
069 * not released.
070 *
071 * @see AccessibleRole#PUSH_BUTTON
072 */
073 public static final AccessibleState PRESSED
074 = new AccessibleState("pressed");
075
076 /**
077 * Indicates an armed object, usually a button which has been pushed and
078 * the mouse has not left the button area.
079 *
080 * @see AccessibleRole#PUSH_BUTTON
081 */
082 public static final AccessibleState ARMED
083 = new AccessibleState("armed");
084
085 /**
086 * Indicates an object is busy, such as a slider, scroll bar, or progress
087 * bar in transition.
088 *
089 * @see AccessibleRole#PROGRESS_BAR
090 * @see AccessibleRole#SCROLL_BAR
091 * @see AccessibleRole#SLIDER
092 */
093 public static final AccessibleState BUSY
094 = new AccessibleState("busy");
095
096 /**
097 * Indicates an object is checked.
098 *
099 * @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 */
345 protected AccessibleState(String key)
346 {
347 this.key = key;
348 }
349 } // class AccessibleState