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