AccessibleState.java 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. /* AccessibleState.java -- a state of an accessible object
  2. Copyright (C) 2002, 2005 Free Software Foundation
  3. This file is part of GNU Classpath.
  4. GNU Classpath is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. GNU Classpath is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Classpath; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  15. 02110-1301 USA.
  16. Linking this library statically or dynamically with other modules is
  17. making a combined work based on this library. Thus, the terms and
  18. conditions of the GNU General Public License cover the whole
  19. combination.
  20. As a special exception, the copyright holders of this library give you
  21. permission to link this library with independent modules to produce an
  22. executable, regardless of the license terms of these independent
  23. modules, and to copy and distribute the resulting executable under
  24. terms of your choice, provided that you also meet, for each linked
  25. independent module, the terms and conditions of the license of that
  26. module. An independent module is a module which is not derived from
  27. or based on this library. If you modify this library, you may extend
  28. this exception to your version of the library, but you are not
  29. obligated to do so. If you do not wish to do so, delete this
  30. exception statement from your version. */
  31. package javax.accessibility;
  32. import java.awt.Dimension;
  33. import java.util.Locale;
  34. /**
  35. * A state portion of an accessible object. A combination of states represent
  36. * the entire object state, in an AccessibleStateSet. For example, this could
  37. * be "active" or "selected". This strongly typed "enumeration" supports
  38. * localized strings. If the constants of this class are not adequate, new
  39. * ones may be added in a similar matter, while avoiding a public constructor.
  40. *
  41. * @author Eric Blake (ebb9@email.byu.edu)
  42. * @since 1.2
  43. * @status updated to 1.4
  44. */
  45. public class AccessibleState extends AccessibleBundle
  46. {
  47. /**
  48. * Indicates an active window, as well as an active child in a list or other
  49. * collection.
  50. *
  51. * @see AccessibleRole#WINDOW
  52. * @see AccessibleRole#FRAME
  53. * @see AccessibleRole#DIALOG
  54. */
  55. public static final AccessibleState ACTIVE
  56. = new AccessibleState("active");
  57. /**
  58. * Indicates a pushed button, usually when the mouse has been pressed but
  59. * not released.
  60. *
  61. * @see AccessibleRole#PUSH_BUTTON
  62. */
  63. public static final AccessibleState PRESSED
  64. = new AccessibleState("pressed");
  65. /**
  66. * Indicates an armed object, usually a button which has been pushed and
  67. * the mouse has not left the button area.
  68. *
  69. * @see AccessibleRole#PUSH_BUTTON
  70. */
  71. public static final AccessibleState ARMED
  72. = new AccessibleState("armed");
  73. /**
  74. * Indicates an object is busy, such as a slider, scroll bar, or progress
  75. * bar in transition.
  76. *
  77. * @see AccessibleRole#PROGRESS_BAR
  78. * @see AccessibleRole#SCROLL_BAR
  79. * @see AccessibleRole#SLIDER
  80. */
  81. public static final AccessibleState BUSY
  82. = new AccessibleState("busy");
  83. /**
  84. * Indicates an object is checked.
  85. *
  86. * @see AccessibleRole#TOGGLE_BUTTON
  87. * @see AccessibleRole#RADIO_BUTTON
  88. * @see AccessibleRole#CHECK_BOX
  89. */
  90. public static final AccessibleState CHECKED
  91. = new AccessibleState("checked");
  92. /**
  93. * Indicates the user can edit the component contents. This is usually for
  94. * text, as other objects like scroll bars are automatically editable.
  95. *
  96. * @see #ENABLED
  97. */
  98. public static final AccessibleState EDITABLE
  99. = new AccessibleState("editable");
  100. /**
  101. * Indicates the object allows progressive disclosure of its children,
  102. * usually in a collapsible tree or other hierachical object.
  103. *
  104. * @see #EXPANDED
  105. * @see #COLLAPSED
  106. * @see AccessibleRole#TREE
  107. */
  108. public static final AccessibleState EXPANDABLE
  109. = new AccessibleState("expandable");
  110. /**
  111. * Indicates that the object is collapsed, usually in a tree.
  112. *
  113. * @see #EXPANDABLE
  114. * @see #EXPANDED
  115. * @see AccessibleRole#TREE
  116. */
  117. public static final AccessibleState COLLAPSED
  118. = new AccessibleState("collapsed");
  119. /**
  120. * Indicates that the object is expanded, usually in a tree.
  121. *
  122. * @see #EXPANDABLE
  123. * @see #COLLAPSED
  124. * @see AccessibleRole#TREE
  125. */
  126. public static final AccessibleState EXPANDED
  127. = new AccessibleState("expanded");
  128. /**
  129. * Indicates that an object is enabled. In the absence of this state,
  130. * graphics are often grayed out, and cannot be manipulated.
  131. */
  132. public static final AccessibleState ENABLED
  133. = new AccessibleState("enabled");
  134. /**
  135. * Indicates that an object can accept focus, which means it will process
  136. * keyboard events when focused.
  137. *
  138. * @see #FOCUSED
  139. */
  140. public static final AccessibleState FOCUSABLE
  141. = new AccessibleState("focusable");
  142. /**
  143. * Indicates that an object has keyboard focus.
  144. *
  145. * @see #FOCUSABLE
  146. */
  147. public static final AccessibleState FOCUSED
  148. = new AccessibleState("focused");
  149. /**
  150. * Indicates that an object is minimized to an icon.
  151. *
  152. * @see AccessibleRole#FRAME
  153. * @see AccessibleRole#INTERNAL_FRAME
  154. */
  155. public static final AccessibleState ICONIFIED
  156. = new AccessibleState("iconified");
  157. /**
  158. * Indicates that the state of this particular object is
  159. * indeterminate. This commonly occurs when an object is incapable
  160. * of representing the state by a single value.
  161. *
  162. * @since 1.5
  163. */
  164. public static final AccessibleState INDETERMINATE
  165. = new AccessibleState("indeterminate");
  166. /**
  167. * Indicates that this particular object manages a number of
  168. * subcomponents. This is a common property of structures such as
  169. * trees and tables, which have a number of sub-elements such as
  170. * rows and columns. The subcomponents should be left to the
  171. * object, and not managed by the application.
  172. *
  173. * @since 1.5
  174. */
  175. public static final AccessibleState MANAGES_DESCENDANTS
  176. = new AccessibleState("manages descendants");
  177. /**
  178. * Indicates that something must be done in the current object before
  179. * interaction is allowed on other windows, usually for dialogs.
  180. *
  181. * @see AccessibleRole#DIALOG
  182. */
  183. public static final AccessibleState MODAL
  184. = new AccessibleState("modal");
  185. /**
  186. * Indicates that all pixels in the object are painted. If this state is not
  187. * present, then the object has some degree of transparency, letting lower
  188. * panes show through.
  189. *
  190. * @see Accessible#getAccessibleContext()
  191. * @see AccessibleContext#getAccessibleComponent()
  192. * @see AccessibleComponent#getBounds()
  193. */
  194. public static final AccessibleState OPAQUE
  195. = new AccessibleState("opaque");
  196. /**
  197. * Indicates the size of this object is not fixed.
  198. *
  199. * @see Accessible#getAccessibleContext()
  200. * @see AccessibleContext#getAccessibleComponent()
  201. * @see AccessibleComponent#getSize()
  202. * @see AccessibleComponent#setSize(Dimension)
  203. */
  204. public static final AccessibleState RESIZABLE
  205. = new AccessibleState("resizable");
  206. /**
  207. * Indicates that multiple children can be selected at once.
  208. *
  209. * @see Accessible#getAccessibleContext()
  210. * @see AccessibleContext#getAccessibleSelection()
  211. * @see AccessibleSelection
  212. */
  213. public static final AccessibleState MULTISELECTABLE
  214. = new AccessibleState("multiselectable");
  215. /**
  216. * Indicates that this child is one which can be selected from its parent.
  217. *
  218. * @see #SELECTED
  219. * @see Accessible#getAccessibleContext()
  220. * @see AccessibleContext#getAccessibleSelection()
  221. * @see AccessibleSelection
  222. */
  223. public static final AccessibleState SELECTABLE
  224. = new AccessibleState("selectable");
  225. /**
  226. * Indicates that this child has been selected from its parent.
  227. *
  228. * @see #SELECTABLE
  229. * @see Accessible#getAccessibleContext()
  230. * @see AccessibleContext#getAccessibleSelection()
  231. * @see AccessibleSelection
  232. */
  233. public static final AccessibleState SELECTED
  234. = new AccessibleState("selected");
  235. /**
  236. * Indicates that this object and all its parents are visible, so that it
  237. * is on the screen. However, something opaque may be on top of it.
  238. *
  239. * @see #VISIBLE
  240. */
  241. public static final AccessibleState SHOWING
  242. = new AccessibleState("showing");
  243. /**
  244. * Indicates that this particular object is truncated when displayed
  245. * visually.
  246. *
  247. * @since 1.5
  248. */
  249. public static final AccessibleState TRUNCATED
  250. = new AccessibleState("truncated");
  251. /**
  252. * Indicates that this object intends to be visible. However, if its
  253. * parent is invisible, this object is as well.
  254. *
  255. * @see #SHOWING
  256. */
  257. public static final AccessibleState VISIBLE
  258. = new AccessibleState("visible");
  259. /**
  260. * Indicates that an object has vertical orientation.
  261. *
  262. * @see #HORIZONTAL
  263. * @see AccessibleRole#SCROLL_BAR
  264. * @see AccessibleRole#SLIDER
  265. * @see AccessibleRole#PROGRESS_BAR
  266. */
  267. public static final AccessibleState VERTICAL
  268. = new AccessibleState("vertical");
  269. /**
  270. * Indicates that an object has horizontal orientation.
  271. *
  272. * @see #VERTICAL
  273. * @see AccessibleRole#SCROLL_BAR
  274. * @see AccessibleRole#SLIDER
  275. * @see AccessibleRole#PROGRESS_BAR
  276. */
  277. public static final AccessibleState HORIZONTAL
  278. = new AccessibleState("horizontal");
  279. /**
  280. * Indicates that this text object can only hold a single line.
  281. *
  282. * @see #MULTI_LINE
  283. */
  284. public static final AccessibleState SINGLE_LINE
  285. = new AccessibleState("single line");
  286. /**
  287. * Indicates that this text object can hold multiple lines.
  288. *
  289. * @see #SINGLE_LINE
  290. */
  291. public static final AccessibleState MULTI_LINE
  292. = new AccessibleState("multiple line");
  293. /**
  294. * Indicates that this object is transient. This means the object is
  295. * generated for method queries, but will never generate events, because
  296. * its container (such as a tree, list, or table) does all the work.
  297. */
  298. public static final AccessibleState TRANSIENT
  299. = new AccessibleState("transient");
  300. /**
  301. * Create a new constant with a locale independent key. Follow the example,
  302. * keep the constructor private and make public constants instead.
  303. *
  304. * @param key the name of the state
  305. * @see #toDisplayString(String, Locale)
  306. */
  307. protected AccessibleState(String key)
  308. {
  309. this.key = key;
  310. }
  311. } // class AccessibleState