1. /*
  2. * @(#)AccessibleState.java 1.33 03/01/27
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.accessibility;
  8. import java.util.Vector;
  9. import java.util.Locale;
  10. import java.util.MissingResourceException;
  11. import java.util.ResourceBundle;
  12. /**
  13. * <P>Class AccessibleState describes a component's particular state. The actual
  14. * state of the component is defined as an AccessibleStateSet, which is a
  15. * composed set of AccessibleStates.
  16. * <p>The toDisplayString method allows you to obtain the localized string
  17. * for a locale independent key from a predefined ResourceBundle for the
  18. * keys defined in this class.
  19. * <p>The constants in this class present a strongly typed enumeration
  20. * of common object roles. A public constructor for this class has been
  21. * purposely omitted and applications should use one of the constants
  22. * from this class. If the constants in this class are not sufficient
  23. * to describe the role of an object, a subclass should be generated
  24. * from this class and it should provide constants in a similar manner.
  25. *
  26. * @version 1.27 10/12/99 14:48:59
  27. * @author Willie Walker
  28. * @author Peter Korn
  29. */
  30. public class AccessibleState extends AccessibleBundle {
  31. // If you add or remove anything from here, make sure you
  32. // update AccessibleResourceBundle.java.
  33. /**
  34. * Indicates a window is currently the active window. This includes
  35. * windows, dialogs, frames, etc. In addition, this state is used
  36. * to indicate the currently active child of a component such as a
  37. * list, table, or tree. For example, the active child of a list
  38. * is the child that is drawn with a rectangle around it.
  39. * @see AccessibleRole#WINDOW
  40. * @see AccessibleRole#FRAME
  41. * @see AccessibleRole#DIALOG
  42. */
  43. public static final AccessibleState ACTIVE
  44. = new AccessibleState("active");
  45. /**
  46. * Indicates this object is currently pressed. This is usually
  47. * associated with buttons and indicates the user has pressed a
  48. * mouse button while the pointer was over the button and has
  49. * not yet released the mouse button.
  50. * @see AccessibleRole#PUSH_BUTTON
  51. */
  52. public static final AccessibleState PRESSED
  53. = new AccessibleState("pressed");
  54. /**
  55. * Indicates that the object is armed. This is usually used on buttons
  56. * that have been pressed but not yet released, and the mouse pointer
  57. * is still over the button.
  58. * @see AccessibleRole#PUSH_BUTTON
  59. */
  60. public static final AccessibleState ARMED
  61. = new AccessibleState("armed");
  62. /**
  63. * Indicates the current object is busy. This is usually used on objects
  64. * such as progress bars, sliders, or scroll bars to indicate they are
  65. * in a state of transition.
  66. * @see AccessibleRole#PROGRESS_BAR
  67. * @see AccessibleRole#SCROLL_BAR
  68. * @see AccessibleRole#SLIDER
  69. */
  70. public static final AccessibleState BUSY
  71. = new AccessibleState("busy");
  72. /**
  73. * Indicates this object is currently checked. This is usually used on
  74. * objects such as toggle buttons, radio buttons, and check boxes.
  75. * @see AccessibleRole#TOGGLE_BUTTON
  76. * @see AccessibleRole#RADIO_BUTTON
  77. * @see AccessibleRole#CHECK_BOX
  78. */
  79. public static final AccessibleState CHECKED
  80. = new AccessibleState("checked");
  81. /**
  82. * Indicates the user can change the contents of this object. This
  83. * is usually used primarily for objects that allow the user to
  84. * enter text. Other objects, such as scroll bars and sliders,
  85. * are automatically editable if they are enabled.
  86. * @see #ENABLED
  87. */
  88. public static final AccessibleState EDITABLE
  89. = new AccessibleState("editable");
  90. /**
  91. * Indicates this object allows progressive disclosure of its children.
  92. * This is usually used with hierarchical objects such as trees and
  93. * is often paired with the EXPANDED or COLLAPSED states.
  94. * @see #EXPANDED
  95. * @see #COLLAPSED
  96. * @see AccessibleRole#TREE
  97. */
  98. public static final AccessibleState EXPANDABLE
  99. = new AccessibleState("expandable");
  100. /**
  101. * Indicates this object is collapsed. This is usually paired with the
  102. * EXPANDABLE state and is used on objects that provide progressive
  103. * disclosure such as trees.
  104. * @see #EXPANDABLE
  105. * @see #EXPANDED
  106. * @see AccessibleRole#TREE
  107. */
  108. public static final AccessibleState COLLAPSED
  109. = new AccessibleState("collapsed");
  110. /**
  111. * Indicates this object is expanded. This is usually paired with the
  112. * EXPANDABLE state and is used on objects that provide progressive
  113. * disclosure such as trees.
  114. * @see #EXPANDABLE
  115. * @see #COLLAPSED
  116. * @see AccessibleRole#TREE
  117. */
  118. public static final AccessibleState EXPANDED
  119. = new AccessibleState("expanded");
  120. /**
  121. * Indicates this object is enabled. The absence of this state from an
  122. * object's state set indicates this object is not enabled. An object
  123. * that is not enabled cannot be manipulated by the user. In a graphical
  124. * display, it is usually grayed out.
  125. */
  126. public static final AccessibleState ENABLED
  127. = new AccessibleState("enabled");
  128. /**
  129. * Indicates this object can accept keyboard focus, which means all
  130. * events resulting from typing on the keyboard will normally be
  131. * passed to it when it has focus.
  132. * @see #FOCUSED
  133. */
  134. public static final AccessibleState FOCUSABLE
  135. = new AccessibleState("focusable");
  136. /**
  137. * Indicates this object currently has the keyboard focus.
  138. * @see #FOCUSABLE
  139. */
  140. public static final AccessibleState FOCUSED
  141. = new AccessibleState("focused");
  142. /**
  143. * Indicates this object is minimized and is represented only by an
  144. * icon. This is usually only associated with frames and internal
  145. * frames.
  146. * @see AccessibleRole#FRAME
  147. * @see AccessibleRole#INTERNAL_FRAME
  148. */
  149. public static final AccessibleState ICONIFIED
  150. = new AccessibleState("iconified");
  151. /**
  152. * Indicates something must be done with this object before the
  153. * user can interact with an object in a different window. This
  154. * is usually associated only with dialogs.
  155. * @see AccessibleRole#DIALOG
  156. */
  157. public static final AccessibleState MODAL
  158. = new AccessibleState("modal");
  159. /**
  160. * Indicates this object paints every pixel within its
  161. * rectangular region. A non-opaque component paints only some of
  162. * its pixels, allowing the pixels underneath it to "show through".
  163. * A component that does not fully paint its pixels therefore
  164. * provides a degree of transparency.
  165. * @see Accessible#getAccessibleContext
  166. * @see AccessibleContext#getAccessibleComponent
  167. * @see AccessibleComponent#getBounds
  168. */
  169. public static final AccessibleState OPAQUE
  170. = new AccessibleState("opaque");
  171. /**
  172. * Indicates the size of this object is not fixed.
  173. * @see Accessible#getAccessibleContext
  174. * @see AccessibleContext#getAccessibleComponent
  175. * @see AccessibleComponent#getSize
  176. * @see AccessibleComponent#setSize
  177. */
  178. public static final AccessibleState RESIZABLE
  179. = new AccessibleState("resizable");
  180. /**
  181. * Indicates this object allows more than one of its children to
  182. * be selected at the same time.
  183. * @see Accessible#getAccessibleContext
  184. * @see AccessibleContext#getAccessibleSelection
  185. * @see AccessibleSelection
  186. */
  187. public static final AccessibleState MULTISELECTABLE
  188. = new AccessibleState("multiselectable");
  189. /**
  190. * Indicates this object is the child of an object that allows its
  191. * children to be selected, and that this child is one of those
  192. * children that can be selected.
  193. * @see #SELECTED
  194. * @see Accessible#getAccessibleContext
  195. * @see AccessibleContext#getAccessibleSelection
  196. * @see AccessibleSelection
  197. */
  198. public static final AccessibleState SELECTABLE
  199. = new AccessibleState("selectable");
  200. /**
  201. * Indicates this object is the child of an object that allows its
  202. * children to be selected, and that this child is one of those
  203. * children that has been selected.
  204. * @see #SELECTABLE
  205. * @see Accessible#getAccessibleContext
  206. * @see AccessibleContext#getAccessibleSelection
  207. * @see AccessibleSelection
  208. */
  209. public static final AccessibleState SELECTED
  210. = new AccessibleState("selected");
  211. /**
  212. * Indicates this object, the object's parent, the object's parent's
  213. * parent, and so on, are all visible. Note that this does not
  214. * necessarily mean the object is painted on the screen. It might
  215. * be occluded by some other showing object.
  216. * @see #VISIBLE
  217. */
  218. public static final AccessibleState SHOWING
  219. = new AccessibleState("showing");
  220. /**
  221. * Indicates this object is visible. Note: this means that the
  222. * object intends to be visible; however, it may not in fact be
  223. * showing on the screen because one of the objects that this object
  224. * is contained by is not visible.
  225. * @see #SHOWING
  226. */
  227. public static final AccessibleState VISIBLE
  228. = new AccessibleState("visible");
  229. /**
  230. * Indicates the orientation of this object is vertical. This is
  231. * usually associated with objects such as scrollbars, sliders, and
  232. * progress bars.
  233. * @see #VERTICAL
  234. * @see AccessibleRole#SCROLL_BAR
  235. * @see AccessibleRole#SLIDER
  236. * @see AccessibleRole#PROGRESS_BAR
  237. */
  238. public static final AccessibleState VERTICAL
  239. = new AccessibleState("vertical");
  240. /**
  241. * Indicates the orientation of this object is horizontal. This is
  242. * usually associated with objects such as scrollbars, sliders, and
  243. * progress bars.
  244. * @see #HORIZONTAL
  245. * @see AccessibleRole#SCROLL_BAR
  246. * @see AccessibleRole#SLIDER
  247. * @see AccessibleRole#PROGRESS_BAR
  248. */
  249. public static final AccessibleState HORIZONTAL
  250. = new AccessibleState("horizontal");
  251. /**
  252. * Indicates this (text) object can contain only a single line of text
  253. */
  254. public static final AccessibleState SINGLE_LINE
  255. = new AccessibleState("singleline");
  256. /**
  257. * Indicates this (text) object can contain multiple lines of text
  258. */
  259. public static final AccessibleState MULTI_LINE
  260. = new AccessibleState("multiline");
  261. /**
  262. * Indicates this object is transient. An assistive technology should
  263. * not add a PropertyChange listener to an object with transient state,
  264. * as that object will never generate any events. Transient objects
  265. * are typically created to answer Java Accessibility method queries,
  266. * but otherwise do not remain linked to the underlying object (for
  267. * example, those objects underneath lists, tables, and trees in Swing,
  268. * where only one actual UI Component does shared rendering duty for
  269. * all of the data objects underneath the actual list/table/tree elements).
  270. *
  271. */
  272. public static final AccessibleState TRANSIENT
  273. = new AccessibleState("transient");
  274. /**
  275. * Creates a new AccessibleState using the given locale independent key.
  276. * This should not be a public method. Instead, it is used to create
  277. * the constants in this file to make it a strongly typed enumeration.
  278. * Subclasses of this class should enforce similar policy.
  279. * <p>
  280. * The key String should be a locale independent key for the state.
  281. * It is not intended to be used as the actual String to display
  282. * to the user. To get the localized string, use toDisplayString.
  283. *
  284. * @param key the locale independent name of the state.
  285. * @see AccessibleBundle#toDisplayString
  286. */
  287. protected AccessibleState(String key) {
  288. this.key = key;
  289. }
  290. }