blob: 6cc04b79bd2296e91008a297e19c232d6451288d [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26package javax.accessibility;
27
28import java.util.Locale;
29import java.util.MissingResourceException;
30import java.util.ResourceBundle;
31
32/**
33 * <P>Class AccessibleRole determines the role of a component. The role of a
34 * component describes its generic function. (E.G.,
35* "push button," "table," or "list.")
36 * <p>The toDisplayString method allows you to obtain the localized string
37 * for a locale independent key from a predefined ResourceBundle for the
38 * keys defined in this class.
39 * <p>The constants in this class present a strongly typed enumeration
40 * of common object roles. A public constructor for this class has been
41 * purposely omitted and applications should use one of the constants
42 * from this class. If the constants in this class are not sufficient
43 * to describe the role of an object, a subclass should be generated
44 * from this class and it should provide constants in a similar manner.
45 *
46 * @author Willie Walker
47 * @author Peter Korn
48 * @author Lynn Monsanto
49 */
50public class AccessibleRole extends AccessibleBundle {
51
52// If you add or remove anything from here, make sure you
53// update AccessibleResourceBundle.java.
54
55 /**
56 * Object is used to alert the user about something.
57 */
58 public static final AccessibleRole ALERT
59 = new AccessibleRole("alert");
60
61 /**
62 * The header for a column of data.
63 */
64 public static final AccessibleRole COLUMN_HEADER
65 = new AccessibleRole("columnheader");
66
67 /**
68 * Object that can be drawn into and is used to trap
69 * events.
70 * @see #FRAME
71 * @see #GLASS_PANE
72 * @see #LAYERED_PANE
73 */
74 public static final AccessibleRole CANVAS
75 = new AccessibleRole("canvas");
76
77 /**
78 * A list of choices the user can select from. Also optionally
79 * allows the user to enter a choice of their own.
80 */
81 public static final AccessibleRole COMBO_BOX
82 = new AccessibleRole("combobox");
83
84 /**
85 * An iconified internal frame in a DESKTOP_PANE.
86 * @see #DESKTOP_PANE
87 * @see #INTERNAL_FRAME
88 */
89 public static final AccessibleRole DESKTOP_ICON
90 = new AccessibleRole("desktopicon");
91
92 /**
93 * An object containing a collection of <code>Accessibles</code> that
94 * together represents <code>HTML</code> content. The child
95 * <code>Accessibles</code> would include objects implementing
96 * <code>AccessibleText</code>, <code>AccessibleHypertext</code>,
97 * <code>AccessibleIcon</code>, and other interfaces.
98 * @see #HYPERLINK
99 * @see AccessibleText
100 * @see AccessibleHypertext
101 * @see AccessibleHyperlink
102 * @see AccessibleIcon
103 * @since 1.6
104 */
105 public static final AccessibleRole HTML_CONTAINER
106 = new AccessibleRole("htmlcontainer");
107
108 /**
109 * A frame-like object that is clipped by a desktop pane. The
110 * desktop pane, internal frame, and desktop icon objects are
111 * often used to create multiple document interfaces within an
112 * application.
113 * @see #DESKTOP_ICON
114 * @see #DESKTOP_PANE
115 * @see #FRAME
116 */
117 public static final AccessibleRole INTERNAL_FRAME
118 = new AccessibleRole("internalframe");
119
120 /**
121 * A pane that supports internal frames and
122 * iconified versions of those internal frames.
123 * @see #DESKTOP_ICON
124 * @see #INTERNAL_FRAME
125 */
126 public static final AccessibleRole DESKTOP_PANE
127 = new AccessibleRole("desktoppane");
128
129 /**
130 * A specialized pane whose primary use is inside a DIALOG
131 * @see #DIALOG
132 */
133 public static final AccessibleRole OPTION_PANE
134 = new AccessibleRole("optionpane");
135
136 /**
137 * A top level window with no title or border.
138 * @see #FRAME
139 * @see #DIALOG
140 */
141 public static final AccessibleRole WINDOW
142 = new AccessibleRole("window");
143
144 /**
145 * A top level window with a title bar, border, menu bar, etc. It is
146 * often used as the primary window for an application.
147 * @see #DIALOG
148 * @see #CANVAS
149 * @see #WINDOW
150 */
151 public static final AccessibleRole FRAME
152 = new AccessibleRole("frame");
153
154 /**
155 * A top level window with title bar and a border. A dialog is similar
156 * to a frame, but it has fewer properties and is often used as a
157 * secondary window for an application.
158 * @see #FRAME
159 * @see #WINDOW
160 */
161 public static final AccessibleRole DIALOG
162 = new AccessibleRole("dialog");
163
164 /**
165 * A specialized pane that lets the user choose a color.
166 */
167 public static final AccessibleRole COLOR_CHOOSER
168 = new AccessibleRole("colorchooser");
169
170
171 /**
172 * A pane that allows the user to navigate through
173 * and select the contents of a directory. May be used
174 * by a file chooser.
175 * @see #FILE_CHOOSER
176 */
177 public static final AccessibleRole DIRECTORY_PANE
178 = new AccessibleRole("directorypane");
179
180 /**
181 * A specialized dialog that displays the files in the directory
182 * and lets the user select a file, browse a different directory,
183 * or specify a filename. May use the directory pane to show the
184 * contents of a directory.
185 * @see #DIRECTORY_PANE
186 */
187 public static final AccessibleRole FILE_CHOOSER
188 = new AccessibleRole("filechooser");
189
190 /**
191 * An object that fills up space in a user interface. It is often
192 * used in interfaces to tweak the spacing between components,
193 * but serves no other purpose.
194 */
195 public static final AccessibleRole FILLER
196 = new AccessibleRole("filler");
197
198 /**
199 * A hypertext anchor
200 */
201 public static final AccessibleRole HYPERLINK
202 = new AccessibleRole("hyperlink");
203
204 /**
205 * A small fixed size picture, typically used to decorate components.
206 */
207 public static final AccessibleRole ICON
208 = new AccessibleRole("icon");
209
210 /**
211 * An object used to present an icon or short string in an interface.
212 */
213 public static final AccessibleRole LABEL
214 = new AccessibleRole("label");
215
216 /**
217 * A specialized pane that has a glass pane and a layered pane as its
218 * children.
219 * @see #GLASS_PANE
220 * @see #LAYERED_PANE
221 */
222 public static final AccessibleRole ROOT_PANE
223 = new AccessibleRole("rootpane");
224
225 /**
226 * A pane that is guaranteed to be painted on top
227 * of all panes beneath it.
228 * @see #ROOT_PANE
229 * @see #CANVAS
230 */
231 public static final AccessibleRole GLASS_PANE
232 = new AccessibleRole("glasspane");
233
234 /**
235 * A specialized pane that allows its children to be drawn in layers,
236 * providing a form of stacking order. This is usually the pane that
237 * holds the menu bar as well as the pane that contains most of the
238 * visual components in a window.
239 * @see #GLASS_PANE
240 * @see #ROOT_PANE
241 */
242 public static final AccessibleRole LAYERED_PANE
243 = new AccessibleRole("layeredpane");
244
245 /**
246 * An object that presents a list of objects to the user and allows the
247 * user to select one or more of them. A list is usually contained
248 * within a scroll pane.
249 * @see #SCROLL_PANE
250 * @see #LIST_ITEM
251 */
252 public static final AccessibleRole LIST
253 = new AccessibleRole("list");
254
255 /**
256 * An object that presents an element in a list. A list is usually
257 * contained within a scroll pane.
258 * @see #SCROLL_PANE
259 * @see #LIST
260 */
261 public static final AccessibleRole LIST_ITEM
262 = new AccessibleRole("listitem");
263
264 /**
265 * An object usually drawn at the top of the primary dialog box of
266 * an application that contains a list of menus the user can choose
267 * from. For example, a menu bar might contain menus for "File,"
268 * "Edit," and "Help."
269 * @see #MENU
270 * @see #POPUP_MENU
271 * @see #LAYERED_PANE
272 */
273 public static final AccessibleRole MENU_BAR
274 = new AccessibleRole("menubar");
275
276 /**
277 * A temporary window that is usually used to offer the user a
278 * list of choices, and then hides when the user selects one of
279 * those choices.
280 * @see #MENU
281 * @see #MENU_ITEM
282 */
283 public static final AccessibleRole POPUP_MENU
284 = new AccessibleRole("popupmenu");
285
286 /**
287 * An object usually found inside a menu bar that contains a list
288 * of actions the user can choose from. A menu can have any object
289 * as its children, but most often they are menu items, other menus,
290 * or rudimentary objects such as radio buttons, check boxes, or
291 * separators. For example, an application may have an "Edit" menu
292 * that contains menu items for "Cut" and "Paste."
293 * @see #MENU_BAR
294 * @see #MENU_ITEM
295 * @see #SEPARATOR
296 * @see #RADIO_BUTTON
297 * @see #CHECK_BOX
298 * @see #POPUP_MENU
299 */
300 public static final AccessibleRole MENU
301 = new AccessibleRole("menu");
302
303 /**
304 * An object usually contained in a menu that presents an action
305 * the user can choose. For example, the "Cut" menu item in an
306 * "Edit" menu would be an action the user can select to cut the
307 * selected area of text in a document.
308 * @see #MENU_BAR
309 * @see #SEPARATOR
310 * @see #POPUP_MENU
311 */
312 public static final AccessibleRole MENU_ITEM
313 = new AccessibleRole("menuitem");
314
315 /**
316 * An object usually contained in a menu to provide a visual
317 * and logical separation of the contents in a menu. For example,
318 * the "File" menu of an application might contain menu items for
319 * "Open," "Close," and "Exit," and will place a separator between
320 * "Close" and "Exit" menu items.
321 * @see #MENU
322 * @see #MENU_ITEM
323 */
324 public static final AccessibleRole SEPARATOR
325 = new AccessibleRole("separator");
326
327 /**
328 * An object that presents a series of panels (or page tabs), one at a
329 * time, through some mechanism provided by the object. The most common
330 * mechanism is a list of tabs at the top of the panel. The children of
331 * a page tab list are all page tabs.
332 * @see #PAGE_TAB
333 */
334 public static final AccessibleRole PAGE_TAB_LIST
335 = new AccessibleRole("pagetablist");
336
337 /**
338 * An object that is a child of a page tab list. Its sole child is
339 * the panel that is to be presented to the user when the user
340 * selects the page tab from the list of tabs in the page tab list.
341 * @see #PAGE_TAB_LIST
342 */
343 public static final AccessibleRole PAGE_TAB
344 = new AccessibleRole("pagetab");
345
346 /**
347 * A generic container that is often used to group objects.
348 */
349 public static final AccessibleRole PANEL
350 = new AccessibleRole("panel");
351
352 /**
353 * An object used to indicate how much of a task has been completed.
354 */
355 public static final AccessibleRole PROGRESS_BAR
356 = new AccessibleRole("progressbar");
357
358 /**
359 * A text object used for passwords, or other places where the
360 * text contents is not shown visibly to the user
361 */
362 public static final AccessibleRole PASSWORD_TEXT
363 = new AccessibleRole("passwordtext");
364
365 /**
366 * An object the user can manipulate to tell the application to do
367 * something.
368 * @see #CHECK_BOX
369 * @see #TOGGLE_BUTTON
370 * @see #RADIO_BUTTON
371 */
372 public static final AccessibleRole PUSH_BUTTON
373 = new AccessibleRole("pushbutton");
374
375 /**
376 * A specialized push button that can be checked or unchecked, but
377 * does not provide a separate indicator for the current state.
378 * @see #PUSH_BUTTON
379 * @see #CHECK_BOX
380 * @see #RADIO_BUTTON
381 */
382 public static final AccessibleRole TOGGLE_BUTTON
383 = new AccessibleRole("togglebutton");
384
385 /**
386 * A choice that can be checked or unchecked and provides a
387 * separate indicator for the current state.
388 * @see #PUSH_BUTTON
389 * @see #TOGGLE_BUTTON
390 * @see #RADIO_BUTTON
391 */
392 public static final AccessibleRole CHECK_BOX
393 = new AccessibleRole("checkbox");
394
395 /**
396 * A specialized check box that will cause other radio buttons in the
397 * same group to become unchecked when this one is checked.
398 * @see #PUSH_BUTTON
399 * @see #TOGGLE_BUTTON
400 * @see #CHECK_BOX
401 */
402 public static final AccessibleRole RADIO_BUTTON
403 = new AccessibleRole("radiobutton");
404
405 /**
406 * The header for a row of data.
407 */
408 public static final AccessibleRole ROW_HEADER
409 = new AccessibleRole("rowheader");
410
411 /**
412 * An object that allows a user to incrementally view a large amount
413 * of information. Its children can include scroll bars and a viewport.
414 * @see #SCROLL_BAR
415 * @see #VIEWPORT
416 */
417 public static final AccessibleRole SCROLL_PANE
418 = new AccessibleRole("scrollpane");
419
420 /**
421 * An object usually used to allow a user to incrementally view a
422 * large amount of data. Usually used only by a scroll pane.
423 * @see #SCROLL_PANE
424 */
425 public static final AccessibleRole SCROLL_BAR
426 = new AccessibleRole("scrollbar");
427
428 /**
429 * An object usually used in a scroll pane. It represents the portion
430 * of the entire data that the user can see. As the user manipulates
431 * the scroll bars, the contents of the viewport can change.
432 * @see #SCROLL_PANE
433 */
434 public static final AccessibleRole VIEWPORT
435 = new AccessibleRole("viewport");
436
437 /**
438 * An object that allows the user to select from a bounded range. For
439 * example, a slider might be used to select a number between 0 and 100.
440 */
441 public static final AccessibleRole SLIDER
442 = new AccessibleRole("slider");
443
444 /**
445 * A specialized panel that presents two other panels at the same time.
446 * Between the two panels is a divider the user can manipulate to make
447 * one panel larger and the other panel smaller.
448 */
449 public static final AccessibleRole SPLIT_PANE
450 = new AccessibleRole("splitpane");
451
452 /**
453 * An object used to present information in terms of rows and columns.
454 * An example might include a spreadsheet application.
455 */
456 public static final AccessibleRole TABLE
457 = new AccessibleRole("table");
458
459 /**
460 * An object that presents text to the user. The text is usually
461 * editable by the user as opposed to a label.
462 * @see #LABEL
463 */
464 public static final AccessibleRole TEXT
465 = new AccessibleRole("text");
466
467 /**
468 * An object used to present hierarchical information to the user.
469 * The individual nodes in the tree can be collapsed and expanded
470 * to provide selective disclosure of the tree's contents.
471 */
472 public static final AccessibleRole TREE
473 = new AccessibleRole("tree");
474
475 /**
476 * A bar or palette usually composed of push buttons or toggle buttons.
477 * It is often used to provide the most frequently used functions for an
478 * application.
479 */
480 public static final AccessibleRole TOOL_BAR
481 = new AccessibleRole("toolbar");
482
483 /**
484 * An object that provides information about another object. The
485 * accessibleDescription property of the tool tip is often displayed
486 * to the user in a small "help bubble" when the user causes the
487 * mouse to hover over the object associated with the tool tip.
488 */
489 public static final AccessibleRole TOOL_TIP
490 = new AccessibleRole("tooltip");
491
492 /**
493 * An AWT component, but nothing else is known about it.
494 * @see #SWING_COMPONENT
495 * @see #UNKNOWN
496 */
497 public static final AccessibleRole AWT_COMPONENT
498 = new AccessibleRole("awtcomponent");
499
500 /**
501 * A Swing component, but nothing else is known about it.
502 * @see #AWT_COMPONENT
503 * @see #UNKNOWN
504 */
505 public static final AccessibleRole SWING_COMPONENT
506 = new AccessibleRole("swingcomponent");
507
508 /**
509 * The object contains some Accessible information, but its role is
510 * not known.
511 * @see #AWT_COMPONENT
512 * @see #SWING_COMPONENT
513 */
514 public static final AccessibleRole UNKNOWN
515 = new AccessibleRole("unknown");
516
517 /**
518 * A STATUS_BAR is an simple component that can contain
519 * multiple labels of status information to the user.
520 */
521 public static final AccessibleRole STATUS_BAR
522 = new AccessibleRole("statusbar");
523
524 /**
525 * A DATE_EDITOR is a component that allows users to edit
526 * java.util.Date and java.util.Time objects
527 */
528 public static final AccessibleRole DATE_EDITOR
529 = new AccessibleRole("dateeditor");
530
531 /**
532 * A SPIN_BOX is a simple spinner component and its main use
533 * is for simple numbers.
534 */
535 public static final AccessibleRole SPIN_BOX
536 = new AccessibleRole("spinbox");
537
538 /**
539 * A FONT_CHOOSER is a component that lets the user pick various
540 * attributes for fonts.
541 */
542 public static final AccessibleRole FONT_CHOOSER
543 = new AccessibleRole("fontchooser");
544
545 /**
546 * A GROUP_BOX is a simple container that contains a border
547 * around it and contains components inside it.
548 */
549 public static final AccessibleRole GROUP_BOX
550 = new AccessibleRole("groupbox");
551
552 /**
553 * A text header
554 *
555 * @since 1.5
556 */
557 public static final AccessibleRole HEADER =
558 new AccessibleRole("header");
559
560 /**
561 * A text footer
562 *
563 * @since 1.5
564 */
565 public static final AccessibleRole FOOTER =
566 new AccessibleRole("footer");
567
568 /**
569 * A text paragraph
570 *
571 * @since 1.5
572 */
573 public static final AccessibleRole PARAGRAPH =
574 new AccessibleRole("paragraph");
575
576 /**
577 * A ruler is an object used to measure distance
578 *
579 * @since 1.5
580 */
581 public static final AccessibleRole RULER =
582 new AccessibleRole("ruler");
583
584 /**
585 * A role indicating the object acts as a formula for
586 * calculating a value. An example is a formula in
587 * a spreadsheet cell.
588 *
589 * @since 1.5
590 */
591 static public final AccessibleRole EDITBAR =
592 new AccessibleRole("editbar");
593
594 /**
595 * A role indicating the object monitors the progress
596 * of some operation.
597 *
598 * @since 1.5
599 */
600 static public final AccessibleRole PROGRESS_MONITOR =
601 new AccessibleRole("progressMonitor");
602
603
604// The following are all under consideration for potential future use.
605
606// public static final AccessibleRole APPLICATION
607// = new AccessibleRole("application");
608
609// public static final AccessibleRole BORDER
610// = new AccessibleRole("border");
611
612// public static final AccessibleRole CHECK_BOX_MENU_ITEM
613// = new AccessibleRole("checkboxmenuitem");
614
615// public static final AccessibleRole CHOICE
616// = new AccessibleRole("choice");
617
618// public static final AccessibleRole COLUMN
619// = new AccessibleRole("column");
620
621// public static final AccessibleRole CURSOR
622// = new AccessibleRole("cursor");
623
624// public static final AccessibleRole DOCUMENT
625// = new AccessibleRole("document");
626
627// public static final AccessibleRole IMAGE
628// = new AccessibleRole("Image");
629
630// public static final AccessibleRole INDICATOR
631// = new AccessibleRole("indicator");
632
633// public static final AccessibleRole RADIO_BUTTON_MENU_ITEM
634// = new AccessibleRole("radiobuttonmenuitem");
635
636// public static final AccessibleRole ROW
637// = new AccessibleRole("row");
638
639// public static final AccessibleRole TABLE_CELL
640// = new AccessibleRole("tablecell");
641
642// public static final AccessibleRole TREE_NODE
643// = new AccessibleRole("treenode");
644
645 /**
646 * Creates a new AccessibleRole using the given locale independent key.
647 * This should not be a public method. Instead, it is used to create
648 * the constants in this file to make it a strongly typed enumeration.
649 * Subclasses of this class should enforce similar policy.
650 * <p>
651 * The key String should be a locale independent key for the role.
652 * It is not intended to be used as the actual String to display
653 * to the user. To get the localized string, use toDisplayString.
654 *
655 * @param key the locale independent name of the role.
656 * @see AccessibleBundle#toDisplayString
657 */
658 protected AccessibleRole(String key) {
659 this.key = key;
660 }
661}