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