Path: blob/master/src/java.desktop/share/classes/javax/accessibility/AccessibleState.java
41153 views
/*1* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.accessibility;2627/**28* Class {@code AccessibleState} describes a component's particular state. The29* actual state of the component is defined as an {@code AccessibleStateSet},30* which is a composed set of {@code AccessibleStates}.31* <p>32* The {@link #toDisplayString()} method allows you to obtain the localized33* string for a locale independent key from a predefined {@code ResourceBundle}34* for the keys defined in this class.35* <p>36* The constants in this class present a strongly typed enumeration of common37* object roles. A public constructor for this class has been purposely omitted38* and applications should use one of the constants from this class. If the39* constants in this class are not sufficient to describe the role of an object,40* a subclass should be generated from this class and it should provide41* constants in a similar manner.42*43* @author Willie Walker44* @author Peter Korn45*/46public class AccessibleState extends AccessibleBundle {4748// If you add or remove anything from here, make sure you49// update AccessibleResourceBundle.java.5051/**52* Indicates a window is currently the active window. This includes windows,53* dialogs, frames, etc. In addition, this state is used to indicate the54* currently active child of a component such as a list, table, or tree. For55* example, the active child of a list is the child that is drawn with a56* rectangle around it.57*58* @see AccessibleRole#WINDOW59* @see AccessibleRole#FRAME60* @see AccessibleRole#DIALOG61*/62public static final AccessibleState ACTIVE63= new AccessibleState("active");6465/**66* Indicates this object is currently pressed. This is usually associated67* with buttons and indicates the user has pressed a mouse button while the68* pointer was over the button and has not yet released the mouse button.69*70* @see AccessibleRole#PUSH_BUTTON71*/72public static final AccessibleState PRESSED73= new AccessibleState("pressed");7475/**76* Indicates that the object is armed. This is usually used on buttons that77* have been pressed but not yet released, and the mouse pointer is still78* over the button.79*80* @see AccessibleRole#PUSH_BUTTON81*/82public static final AccessibleState ARMED83= new AccessibleState("armed");8485/**86* Indicates the current object is busy. This is usually used on objects87* such as progress bars, sliders, or scroll bars to indicate they are in a88* state of transition.89*90* @see AccessibleRole#PROGRESS_BAR91* @see AccessibleRole#SCROLL_BAR92* @see AccessibleRole#SLIDER93*/94public static final AccessibleState BUSY95= new AccessibleState("busy");9697/**98* Indicates this object is currently checked. This is usually used on99* objects such as toggle buttons, radio buttons, and check boxes.100*101* @see AccessibleRole#TOGGLE_BUTTON102* @see AccessibleRole#RADIO_BUTTON103* @see AccessibleRole#CHECK_BOX104*/105public static final AccessibleState CHECKED106= new AccessibleState("checked");107108/**109* Indicates the user can change the contents of this object. This is110* usually used primarily for objects that allow the user to enter text.111* Other objects, such as scroll bars and sliders, are automatically112* editable if they are enabled.113*114* @see #ENABLED115*/116public static final AccessibleState EDITABLE117= new AccessibleState("editable");118119/**120* Indicates this object allows progressive disclosure of its children. This121* is usually used with hierarchical objects such as trees and is often122* paired with the {@code EXPANDED} or {@code COLLAPSED} states.123*124* @see #EXPANDED125* @see #COLLAPSED126* @see AccessibleRole#TREE127*/128public static final AccessibleState EXPANDABLE129= new AccessibleState("expandable");130131/**132* Indicates this object is collapsed. This is usually paired with the133* {@code EXPANDABLE} state and is used on objects that provide progressive134* disclosure such as trees.135*136* @see #EXPANDABLE137* @see #EXPANDED138* @see AccessibleRole#TREE139*/140public static final AccessibleState COLLAPSED141= new AccessibleState("collapsed");142143/**144* Indicates this object is expanded. This is usually paired with the145* {@code EXPANDABLE} state and is used on objects that provide progressive146* disclosure such as trees.147*148* @see #EXPANDABLE149* @see #COLLAPSED150* @see AccessibleRole#TREE151*/152public static final AccessibleState EXPANDED153= new AccessibleState("expanded");154155/**156* Indicates this object is enabled. The absence of this state from an157* object's state set indicates this object is not enabled. An object that158* is not enabled cannot be manipulated by the user. In a graphical display,159* it is usually grayed out.160*/161public static final AccessibleState ENABLED162= new AccessibleState("enabled");163164/**165* Indicates this object can accept keyboard focus, which means all events166* resulting from typing on the keyboard will normally be passed to it when167* it has focus.168*169* @see #FOCUSED170*/171public static final AccessibleState FOCUSABLE172= new AccessibleState("focusable");173174/**175* Indicates this object currently has the keyboard focus.176*177* @see #FOCUSABLE178*/179public static final AccessibleState FOCUSED180= new AccessibleState("focused");181182/**183* Indicates this object is minimized and is represented only by an icon.184* This is usually only associated with frames and internal frames.185*186* @see AccessibleRole#FRAME187* @see AccessibleRole#INTERNAL_FRAME188*/189public static final AccessibleState ICONIFIED190= new AccessibleState("iconified");191192/**193* Indicates something must be done with this object before the user can194* interact with an object in a different window. This is usually associated195* only with dialogs.196*197* @see AccessibleRole#DIALOG198*/199public static final AccessibleState MODAL200= new AccessibleState("modal");201202/**203* Indicates this object paints every pixel within its rectangular region. A204* non-opaque component paints only some of its pixels, allowing the pixels205* underneath it to "show through". A component that does not fully paint206* its pixels therefore provides a degree of transparency.207*208* @see Accessible#getAccessibleContext209* @see AccessibleContext#getAccessibleComponent210* @see AccessibleComponent#getBounds211*/212public static final AccessibleState OPAQUE213= new AccessibleState("opaque");214215/**216* Indicates the size of this object is not fixed.217*218* @see Accessible#getAccessibleContext219* @see AccessibleContext#getAccessibleComponent220* @see AccessibleComponent#getSize221* @see AccessibleComponent#setSize222*/223public static final AccessibleState RESIZABLE224= new AccessibleState("resizable");225226227/**228* Indicates this object allows more than one of its children to be selected229* at the same time.230*231* @see Accessible#getAccessibleContext232* @see AccessibleContext#getAccessibleSelection233* @see AccessibleSelection234*/235public static final AccessibleState MULTISELECTABLE236= new AccessibleState("multiselectable");237238/**239* Indicates this object is the child of an object that allows its children240* to be selected, and that this child is one of those children that can be241* selected.242*243* @see #SELECTED244* @see Accessible#getAccessibleContext245* @see AccessibleContext#getAccessibleSelection246* @see AccessibleSelection247*/248public static final AccessibleState SELECTABLE249= new AccessibleState("selectable");250251/**252* Indicates this object is the child of an object that allows its children253* to be selected, and that this child is one of those children that has254* been selected.255*256* @see #SELECTABLE257* @see Accessible#getAccessibleContext258* @see AccessibleContext#getAccessibleSelection259* @see AccessibleSelection260*/261public static final AccessibleState SELECTED262= new AccessibleState("selected");263264/**265* Indicates this object, the object's parent, the object's parent's parent,266* and so on, are all visible. Note that this does not necessarily mean the267* object is painted on the screen. It might be occluded by some other268* showing object.269*270* @see #VISIBLE271*/272public static final AccessibleState SHOWING273= new AccessibleState("showing");274275/**276* Indicates this object is visible. Note: this means that the object277* intends to be visible; however, it may not in fact be showing on the278* screen because one of the objects that this object is contained by is not279* visible.280*281* @see #SHOWING282*/283public static final AccessibleState VISIBLE284= new AccessibleState("visible");285286/**287* Indicates the orientation of this object is vertical. This is usually288* associated with objects such as scrollbars, sliders, and progress bars.289*290* @see #VERTICAL291* @see AccessibleRole#SCROLL_BAR292* @see AccessibleRole#SLIDER293* @see AccessibleRole#PROGRESS_BAR294*/295public static final AccessibleState VERTICAL296= new AccessibleState("vertical");297298/**299* Indicates the orientation of this object is horizontal. This is usually300* associated with objects such as scrollbars, sliders, and progress bars.301*302* @see #HORIZONTAL303* @see AccessibleRole#SCROLL_BAR304* @see AccessibleRole#SLIDER305* @see AccessibleRole#PROGRESS_BAR306*/307public static final AccessibleState HORIZONTAL308= new AccessibleState("horizontal");309310/**311* Indicates this (text) object can contain only a single line of text.312*/313public static final AccessibleState SINGLE_LINE314= new AccessibleState("singleline");315316/**317* Indicates this (text) object can contain multiple lines of text.318*/319public static final AccessibleState MULTI_LINE320= new AccessibleState("multiline");321322/**323* Indicates this object is transient. An assistive technology should not324* add a {@code PropertyChange} listener to an object with transient state,325* as that object will never generate any events. Transient objects are326* typically created to answer Java Accessibility method queries, but327* otherwise do not remain linked to the underlying object (for example,328* those objects underneath lists, tables, and trees in Swing, where only329* one actual {@code UI Component} does shared rendering duty for all of the330* data objects underneath the actual list/table/tree elements).331*332* @since 1.5333*/334public static final AccessibleState TRANSIENT335= new AccessibleState("transient");336337/**338* Indicates this object is responsible for managing its subcomponents. This339* is typically used for trees and tables that have a large number of340* subcomponents and where the objects are created only when needed and341* otherwise remain virtual. The application should not manage the342* subcomponents directly.343*344* @since 1.5345*/346public static final AccessibleState MANAGES_DESCENDANTS347= new AccessibleState ("managesDescendants");348349/**350* Indicates that the object state is indeterminate. An example is selected351* text that is partially bold and partially not bold. In this case the352* attributes associated with the selected text are indeterminate.353*354* @since 1.5355*/356public static final AccessibleState INDETERMINATE357= new AccessibleState ("indeterminate");358359/**360* A state indicating that text is truncated by a bounding rectangle and361* that some of the text is not displayed on the screen. An example is text362* in a spreadsheet cell that is truncated by the bounds of the cell.363*364* @since 1.5365*/366public static final AccessibleState TRUNCATED367= new AccessibleState("truncated");368369/**370* Creates a new {@code AccessibleState} using the given locale independent371* key. This should not be a public method. Instead, it is used to create372* the constants in this file to make it a strongly typed enumeration.373* Subclasses of this class should enforce similar policy.374* <p>375* The key {@code String} should be a locale independent key for the state.376* It is not intended to be used as the actual {@code String} to display to377* the user. To get the localized string, use {@link #toDisplayString()}.378*379* @param key the locale independent name of the state380* @see AccessibleBundle#toDisplayString381*/382protected AccessibleState(String key) {383this.key = key;384}385}386387388