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