1. /*
  2. * @(#)AccessibleRole.java 1.29 01/11/29
  3. *
  4. * Copyright 2002 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.Locale;
  9. import java.util.MissingResourceException;
  10. import java.util.ResourceBundle;
  11. /**
  12. * <P>Class AccessibleRole determines the role of a component. The role of a
  13. * component describes the components generic function, such as
  14. * "push button," "table," or "list."
  15. * <p>The toDisplayString method allows you to obtain the localized string
  16. * for a locale independent key from a predefined ResourceBundle for the
  17. * keys defined in this class.
  18. * <p>The constants in this class present a strongly typed enumeration
  19. * of common object roles. A public constructor for this class has been
  20. * purposely omitted and applications should use one of the constants
  21. * from this class. If the constants in this class are not sufficient
  22. * to describe the role of an object, a subclass should be generated
  23. * from this class and it should provide constants in a similar manner.
  24. *
  25. * @version 1.18 12/03/97 14:49:26
  26. * @author Willie Walker
  27. * @author Peter Korn
  28. */
  29. public class AccessibleRole extends AccessibleBundle {
  30. // If you add or remove anything from here, make sure you
  31. // update AccessibleResourceBundle.java.
  32. /**
  33. * Object is used to alert the user about something.
  34. */
  35. public static final AccessibleRole ALERT
  36. = new AccessibleRole("alert");
  37. /**
  38. * The header for a column of data.
  39. */
  40. public static final AccessibleRole COLUMN_HEADER
  41. = new AccessibleRole("columnheader");
  42. /**
  43. * A list of choices the user can select from. Also optionally
  44. * allows the user to enter a choice of their own.
  45. */
  46. public static final AccessibleRole COMBO_BOX
  47. = new AccessibleRole("combobox");
  48. /**
  49. * An iconified internal frame in a DESKTOP_PANE.
  50. * @see #DESKTOP_PANE
  51. * @see #INTERNAL_FRAME
  52. */
  53. public static final AccessibleRole DESKTOP_ICON
  54. = new AccessibleRole("desktopicon");
  55. /**
  56. * A frame-like object that is clipped by a desktop pane. The
  57. * desktop pane, internal frame, and desktop icon objects are
  58. * often used to create multiple document interfaces within an
  59. * application.
  60. * @see #DESKTOP_ICON
  61. * @see #DESKTOP_PANE
  62. * @see #FRAME
  63. */
  64. public static final AccessibleRole INTERNAL_FRAME
  65. = new AccessibleRole("internalframe");
  66. /**
  67. * A pane that supports internal frames and
  68. * iconified versions of those internal frames.
  69. * @see #DESKTOP_ICON
  70. * @see #INTERNAL_FRAME
  71. */
  72. public static final AccessibleRole DESKTOP_PANE
  73. = new AccessibleRole("desktoppane");
  74. /**
  75. * A specialized pane whose primary use is inside a DIALOG
  76. * @see #DIALOG
  77. */
  78. public static final AccessibleRole OPTION_PANE
  79. = new AccessibleRole("optionpane");
  80. /**
  81. * A top level window with no title or border.
  82. * @see #FRAME
  83. * @see #DIALOG
  84. */
  85. public static final AccessibleRole WINDOW
  86. = new AccessibleRole("window");
  87. /**
  88. * A top level window with a title bar, border, menu bar, etc. It is
  89. * often used as the primary window for an application.
  90. * @see #DIALOG
  91. * @see #WINDOW
  92. */
  93. public static final AccessibleRole FRAME
  94. = new AccessibleRole("frame");
  95. /**
  96. * A top level window with title bar and a border. A dialog is similar
  97. * to a frame, but it has fewer properties and is often used as a
  98. * secondary window for an application.
  99. * @see #FRAME
  100. * @see #WINDOW
  101. */
  102. public static final AccessibleRole DIALOG
  103. = new AccessibleRole("dialog");
  104. /**
  105. * A specialized dialog that lets the user choose a color.
  106. */
  107. public static final AccessibleRole COLOR_CHOOSER
  108. = new AccessibleRole("colorchooser");
  109. /**
  110. * A pane that allows the user to navigate through
  111. * and select the contents of a directory. May be used
  112. * by a file chooser.
  113. * @see #FILE_CHOOSER
  114. */
  115. public static final AccessibleRole DIRECTORY_PANE
  116. = new AccessibleRole("directorypane");
  117. /**
  118. * A specialized dialog that displays the files in the directory
  119. * and lets the user select a file, browse a different directory,
  120. * or specify a filename. May use the directory pane to show the
  121. * contents of a directory.
  122. * @see #DIRECTORY_PANE
  123. */
  124. public static final AccessibleRole FILE_CHOOSER
  125. = new AccessibleRole("filechooser");
  126. /**
  127. * An object that fills up space in a user interface. It is often
  128. * used in interfaces to tweak the spacing between components,
  129. * but serves no other purpose.
  130. */
  131. public static final AccessibleRole FILLER
  132. = new AccessibleRole("filler");
  133. /**
  134. * An object used to present an icon or short string in an interface.
  135. */
  136. public static final AccessibleRole LABEL
  137. = new AccessibleRole("label");
  138. /**
  139. * A specialized pane that has a glass pane and a layered pane as its
  140. * children.
  141. * @see #GLASS_PANE
  142. * @see #LAYERED_PANE
  143. */
  144. public static final AccessibleRole ROOT_PANE
  145. = new AccessibleRole("rootpane");
  146. /**
  147. * A pane that is guaranteed to be painted on top
  148. * of all panes beneath it.
  149. * @see #ROOT_PANE
  150. */
  151. public static final AccessibleRole GLASS_PANE
  152. = new AccessibleRole("glasspane");
  153. /**
  154. * A specialized pane that allows its children to be drawn in layers,
  155. * providing a form of stacking order. This is usually the pane that
  156. * holds the menu bar as well as the pane that contains most of the
  157. * visual components in a window.
  158. * @see #GLASS_PANE
  159. * @see #ROOT_PANE
  160. */
  161. public static final AccessibleRole LAYERED_PANE
  162. = new AccessibleRole("layeredpane");
  163. /**
  164. * An object that presents a list of objects to user and allows the
  165. * user to select one or more of them. A list is usually contained
  166. * within a scroll pane.
  167. * @see #SCROLL_PANE
  168. */
  169. public static final AccessibleRole LIST
  170. = new AccessibleRole("list");
  171. /**
  172. * An object usually drawn at the top of the primary dialog box of
  173. * an application that contains a list of menus the user can choose
  174. * from. For example, a menu bar might contain menus for "File,"
  175. * "Edit," and "Help."
  176. * @see #MENU
  177. * @see #POPUP_MENU
  178. * @see #LAYERED_PANE
  179. */
  180. public static final AccessibleRole MENU_BAR
  181. = new AccessibleRole("menubar");
  182. /**
  183. * A temporary window that is usually used to offer the user a
  184. * list of choices, and then hides when the user selects one of
  185. * those choices.
  186. * @see #MENU
  187. * @see #MENU_ITEM
  188. */
  189. public static final AccessibleRole POPUP_MENU
  190. = new AccessibleRole("popupmenu");
  191. /**
  192. * An object usually contained in a menu bar that contains a list
  193. * of actions the user can choose from. A menu can have any object
  194. * as its children, but most often they are menu items, other menus,
  195. * or rudimentary objects such as radio buttons, check boxes, or
  196. * separators. For example, an application may have an "Edit" menu
  197. * that contains menu items for "Cut" and "Paste."
  198. * @see #MENU_BAR
  199. * @see #MENU_ITEM
  200. * @see #SEPARATOR
  201. * @see #RADIO_BUTTON
  202. * @see #CHECK_BOX
  203. * @see #POPUP_MENU
  204. */
  205. public static final AccessibleRole MENU
  206. = new AccessibleRole("menu");
  207. /**
  208. * An object usually contained in a menu that presents an action
  209. * the user can choose. For example, the "Cut" menu item in an
  210. * "Edit" menu would be an action the user can select to cut the
  211. * selected area of text in a document.
  212. * @see #MENU_BAR
  213. * @see #SEPARATOR
  214. * @see #POPUP_MENU
  215. */
  216. public static final AccessibleRole MENU_ITEM
  217. = new AccessibleRole("menuitem");
  218. /**
  219. * An object usually contained in a menu to provide a visual
  220. * and logical separation of the contents in a menu. For example,
  221. * the "File" menu of an application might contain menu items for
  222. * "Open," "Close," and "Exit," and will place a separator between
  223. * "Close" and "Exit" menu items.
  224. * @see #MENU
  225. * @see #MENU_ITEM
  226. */
  227. public static final AccessibleRole SEPARATOR
  228. = new AccessibleRole("separator");
  229. /**
  230. * An object that presents a series of panels (or page tabs), one at a
  231. * time, through some mechanism provided by the object. The most common
  232. * mechanism is a list of tabs at the top of the panel. The children of
  233. * a page tab list are all page tabs.
  234. * @see #PAGE_TAB
  235. */
  236. public static final AccessibleRole PAGE_TAB_LIST
  237. = new AccessibleRole("pagetablist");
  238. /**
  239. * An object that is a child of a page tab list. Its sole child is
  240. * the panel that is to be presented to the user when the user
  241. * selects the page tab from the list of tabs in the page tab list.
  242. * @see #PAGE_TAB_LIST
  243. */
  244. public static final AccessibleRole PAGE_TAB
  245. = new AccessibleRole("pagetab");
  246. /**
  247. * A generic container that is often used to group objects.
  248. */
  249. public static final AccessibleRole PANEL
  250. = new AccessibleRole("panel");
  251. /**
  252. * An object used to indicate how much of a task has been completed.
  253. */
  254. public static final AccessibleRole PROGRESS_BAR
  255. = new AccessibleRole("progressbar");
  256. /**
  257. * A text object used for passwords, or other places where the
  258. * text contents is not shown visibly to the user
  259. */
  260. public static final AccessibleRole PASSWORD_TEXT
  261. = new AccessibleRole("passwordtext");
  262. /**
  263. * An object the user can manipulate to tell the application to do
  264. * something.
  265. * @see #CHECK_BOX
  266. * @see #TOGGLE_BUTTON
  267. * @see #RADIO_BUTTON
  268. */
  269. public static final AccessibleRole PUSH_BUTTON
  270. = new AccessibleRole("pushbutton");
  271. /**
  272. * A specialized push button that can be checked or unchecked, but
  273. * does not provide a separate indicator indicating the current state.
  274. * @see #PUSH_BUTTON
  275. * @see #CHECK_BOX
  276. * @see #RADIO_BUTTON
  277. */
  278. public static final AccessibleRole TOGGLE_BUTTON
  279. = new AccessibleRole("togglebutton");
  280. /**
  281. * A choice that can be checked or unchecked and provides a
  282. * separate indicator indicating the current state.
  283. * @see #PUSH_BUTTON
  284. * @see #TOGGLE_BUTTON
  285. * @see #RADIO_BUTTON
  286. */
  287. public static final AccessibleRole CHECK_BOX
  288. = new AccessibleRole("checkbox");
  289. /**
  290. * A specialized check box that will cause other radio buttons in the
  291. * same group to become unchecked when this one is checked.
  292. * @see #PUSH_BUTTON
  293. * @see #TOGGLE_BUTTON
  294. * @see #CHECK_BOX
  295. */
  296. public static final AccessibleRole RADIO_BUTTON
  297. = new AccessibleRole("radiobutton");
  298. /**
  299. * The header for a row of data.
  300. */
  301. public static final AccessibleRole ROW_HEADER
  302. = new AccessibleRole("rowheader");
  303. /**
  304. * An object that allows a user to incrementally view a large amount
  305. * of information. Its children can include scroll bars and a viewport.
  306. * @see #SCROLL_BAR
  307. * @see #VIEWPORT
  308. */
  309. public static final AccessibleRole SCROLL_PANE
  310. = new AccessibleRole("scrollpane");
  311. /**
  312. * An object usually used to allow a user to incrementally view a
  313. * large amount of data. Usually used only by a scroll pane.
  314. * @see #SCROLL_PANE
  315. */
  316. public static final AccessibleRole SCROLL_BAR
  317. = new AccessibleRole("scrollbar");
  318. /**
  319. * An object usually used in a scroll pane. It represents the portion
  320. * of the entire data that the user can see. As the user manipulates
  321. * the scroll bars, the contents of the viewport can change.
  322. * @see #SCROLL_PANE
  323. */
  324. public static final AccessibleRole VIEWPORT
  325. = new AccessibleRole("viewport");
  326. /**
  327. * An object that allows the user to select from a bounded range. For
  328. * example, a slider might be used to select a number between 0 and 100.
  329. */
  330. public static final AccessibleRole SLIDER
  331. = new AccessibleRole("slider");
  332. /**
  333. * A specialized panel that presents two other panels at the same time.
  334. * Between the two panels is a divider the user can manipulate to make
  335. * one panel larger and the other panel smaller.
  336. */
  337. public static final AccessibleRole SPLIT_PANE
  338. = new AccessibleRole("splitpane");
  339. /**
  340. * An object used to present information in terms of rows and columns.
  341. * An example might include a spreadsheet application.
  342. */
  343. public static final AccessibleRole TABLE
  344. = new AccessibleRole("table");
  345. /**
  346. * An object that presents text to the user. The text is usually
  347. * editable by the user as opposed to a label.
  348. * @see #LABEL
  349. */
  350. public static final AccessibleRole TEXT
  351. = new AccessibleRole("text");
  352. /**
  353. * An object used to present hierarchical information to the user.
  354. * The individual nodes in the tree can be collapsed and expanded
  355. * to provide selective disclosure of the tree's contents.
  356. */
  357. public static final AccessibleRole TREE
  358. = new AccessibleRole("tree");
  359. /**
  360. * A bar or palette usually composed of push buttons or toggle buttons.
  361. * It is often used to provide the most often used functions for an
  362. * application.
  363. */
  364. public static final AccessibleRole TOOL_BAR
  365. = new AccessibleRole("toolbar");
  366. /**
  367. * An object that provides information about another object. The
  368. * accessibleDescription property of the tool tip is often displayed
  369. * to the user in a small "help bubble" when the user causes the
  370. * mouse to hover over the object associated with the tool tip.
  371. */
  372. public static final AccessibleRole TOOL_TIP
  373. = new AccessibleRole("tooltip");
  374. /**
  375. * An AWT component, but nothing else is known about it.
  376. * @see #SWING_COMPONENT
  377. * @see #UNKNOWN
  378. */
  379. public static final AccessibleRole AWT_COMPONENT
  380. = new AccessibleRole("awtcomponent");
  381. /**
  382. * A Swing component, but nothing else is known about it.
  383. * @see #AWT_COMPONENT
  384. * @see #UNKNOWN
  385. */
  386. public static final AccessibleRole SWING_COMPONENT
  387. = new AccessibleRole("swingcomponent");
  388. /**
  389. * The object contains some Accessible information, but its role is
  390. * not known.
  391. * @see #AWT_COMPONENT
  392. * @see #SWING_COMPONENT
  393. */
  394. public static final AccessibleRole UNKNOWN
  395. = new AccessibleRole("unknown");
  396. // The following are all under consideration for potential future use.
  397. // public static final AccessibleRole APPLICATION
  398. // = new AccessibleRole("application");
  399. // public static final AccessibleRole BORDER
  400. // = new AccessibleRole("border");
  401. // public static final AccessibleRole CHECK_BOX_MENU_ITEM
  402. // = new AccessibleRole("checkboxmenuitem");
  403. // public static final AccessibleRole CHOICE
  404. // = new AccessibleRole("choice");
  405. // public static final AccessibleRole COLUMN
  406. // = new AccessibleRole("column");
  407. // public static final AccessibleRole CURSOR
  408. // = new AccessibleRole("cursor");
  409. // public static final AccessibleRole DOCUMENT
  410. // = new AccessibleRole("document");
  411. // public static final AccessibleRole GROUPING
  412. // = new AccessibleRole("grouping");
  413. // public static final AccessibleRole IMAGE
  414. // = new AccessibleRole("image");
  415. // public static final AccessibleRole INDICATOR
  416. // = new AccessibleRole("indicator");
  417. // public static final AccessibleRole LIST_ITEM
  418. // = new AccessibleRole("listitem");
  419. // public static final AccessibleRole RADIO_BUTTON_MENU_ITEM
  420. // = new AccessibleRole("radiobuttonmenuitem");
  421. // public static final AccessibleRole ROW
  422. // = new AccessibleRole("row");
  423. // public static final AccessibleRole TABLE_CELL
  424. // = new AccessibleRole("tablecell");
  425. // public static final AccessibleRole TREE_NODE
  426. // = new AccessibleRole("treenode");
  427. /**
  428. * Create a new AccessibleRole using the given locale independent key.
  429. * This should not be a public method. Instead, it is used to create
  430. * the constants in this file to make it a strongly typed enumeration.
  431. * Subclasses of this class should enforce similar policy.
  432. * @param key the locale independent name of the role.
  433. * @note The String should be a locale independent key for the role.
  434. * It is not intended to be used as the actual String to display
  435. * to the user. To get the localized string, use toDisplayString.
  436. * @see AccessibleBundle#toDisplayString
  437. */
  438. protected AccessibleRole(String key) {
  439. this.key = key;
  440. }
  441. }