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