Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/accessibility/AccessibleState.java
38829 views
/*1* Copyright (c) 1997, 2004, 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;2627import java.util.Vector;28import java.util.Locale;29import java.util.MissingResourceException;30import java.util.ResourceBundle;3132/**33* <P>Class AccessibleState describes a component's particular state. The actual34* state of the component is defined as an AccessibleStateSet, which is a35* composed set of AccessibleStates.36* <p>The toDisplayString method allows you to obtain the localized string37* for a locale independent key from a predefined ResourceBundle for the38* keys defined in this class.39* <p>The constants in this class present a strongly typed enumeration40* of common object roles. A public constructor for this class has been41* purposely omitted and applications should use one of the constants42* from this class. If the constants in this class are not sufficient43* to describe the role of an object, a subclass should be generated44* from this class and it should provide constants in a similar manner.45*46* @author Willie Walker47* @author Peter Korn48*/49public class AccessibleState extends AccessibleBundle {5051// If you add or remove anything from here, make sure you52// update AccessibleResourceBundle.java.5354/**55* Indicates a window is currently the active window. This includes56* windows, dialogs, frames, etc. In addition, this state is used57* to indicate the currently active child of a component such as a58* list, table, or tree. For example, the active child of a list59* is the child that is drawn with a rectangle around it.60* @see AccessibleRole#WINDOW61* @see AccessibleRole#FRAME62* @see AccessibleRole#DIALOG63*/64public static final AccessibleState ACTIVE65= new AccessibleState("active");6667/**68* Indicates this object is currently pressed. This is usually69* associated with buttons and indicates the user has pressed a70* mouse button while the pointer was over the button and has71* not yet released the mouse button.72* @see AccessibleRole#PUSH_BUTTON73*/74public static final AccessibleState PRESSED75= new AccessibleState("pressed");7677/**78* Indicates that the object is armed. This is usually used on buttons79* that have been pressed but not yet released, and the mouse pointer80* is still over the button.81* @see AccessibleRole#PUSH_BUTTON82*/83public static final AccessibleState ARMED84= new AccessibleState("armed");8586/**87* Indicates the current object is busy. This is usually used on objects88* such as progress bars, sliders, or scroll bars to indicate they are89* in a state of transition.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* @see AccessibleRole#TOGGLE_BUTTON101* @see AccessibleRole#RADIO_BUTTON102* @see AccessibleRole#CHECK_BOX103*/104public static final AccessibleState CHECKED105= new AccessibleState("checked");106107/**108* Indicates the user can change the contents of this object. This109* is usually used primarily for objects that allow the user to110* enter text. Other objects, such as scroll bars and sliders,111* are automatically editable if they are enabled.112* @see #ENABLED113*/114public static final AccessibleState EDITABLE115= new AccessibleState("editable");116117/**118* Indicates this object allows progressive disclosure of its children.119* This is usually used with hierarchical objects such as trees and120* is often paired with the EXPANDED or COLLAPSED states.121* @see #EXPANDED122* @see #COLLAPSED123* @see AccessibleRole#TREE124*/125public static final AccessibleState EXPANDABLE126= new AccessibleState("expandable");127128/**129* Indicates this object is collapsed. This is usually paired with the130* EXPANDABLE state and is used on objects that provide progressive131* disclosure such as trees.132* @see #EXPANDABLE133* @see #EXPANDED134* @see AccessibleRole#TREE135*/136public static final AccessibleState COLLAPSED137= new AccessibleState("collapsed");138139/**140* Indicates this object is expanded. This is usually paired with the141* EXPANDABLE state and is used on objects that provide progressive142* disclosure such as trees.143* @see #EXPANDABLE144* @see #COLLAPSED145* @see AccessibleRole#TREE146*/147public static final AccessibleState EXPANDED148= new AccessibleState("expanded");149150/**151* Indicates this object is enabled. The absence of this state from an152* object's state set indicates this object is not enabled. An object153* that is not enabled cannot be manipulated by the user. In a graphical154* display, it is usually grayed out.155*/156public static final AccessibleState ENABLED157= new AccessibleState("enabled");158159/**160* Indicates this object can accept keyboard focus, which means all161* events resulting from typing on the keyboard will normally be162* passed to it when it has focus.163* @see #FOCUSED164*/165public static final AccessibleState FOCUSABLE166= new AccessibleState("focusable");167168/**169* Indicates this object currently has the keyboard focus.170* @see #FOCUSABLE171*/172public static final AccessibleState FOCUSED173= new AccessibleState("focused");174175/**176* Indicates this object is minimized and is represented only by an177* icon. This is usually only associated with frames and internal178* frames.179* @see AccessibleRole#FRAME180* @see AccessibleRole#INTERNAL_FRAME181*/182public static final AccessibleState ICONIFIED183= new AccessibleState("iconified");184185/**186* Indicates something must be done with this object before the187* user can interact with an object in a different window. This188* is usually associated only with dialogs.189* @see AccessibleRole#DIALOG190*/191public static final AccessibleState MODAL192= new AccessibleState("modal");193194/**195* Indicates this object paints every pixel within its196* rectangular region. A non-opaque component paints only some of197* its pixels, allowing the pixels underneath it to "show through".198* A component that does not fully paint its pixels therefore199* provides a degree of transparency.200* @see Accessible#getAccessibleContext201* @see AccessibleContext#getAccessibleComponent202* @see AccessibleComponent#getBounds203*/204public static final AccessibleState OPAQUE205= new AccessibleState("opaque");206207/**208* Indicates the size of this object is not fixed.209* @see Accessible#getAccessibleContext210* @see AccessibleContext#getAccessibleComponent211* @see AccessibleComponent#getSize212* @see AccessibleComponent#setSize213*/214public static final AccessibleState RESIZABLE215= new AccessibleState("resizable");216217218/**219* Indicates this object allows more than one of its children to220* be selected at the same time.221* @see Accessible#getAccessibleContext222* @see AccessibleContext#getAccessibleSelection223* @see AccessibleSelection224*/225public static final AccessibleState MULTISELECTABLE226= new AccessibleState("multiselectable");227228/**229* Indicates this object is the child of an object that allows its230* children to be selected, and that this child is one of those231* children that can be selected.232* @see #SELECTED233* @see Accessible#getAccessibleContext234* @see AccessibleContext#getAccessibleSelection235* @see AccessibleSelection236*/237public static final AccessibleState SELECTABLE238= new AccessibleState("selectable");239240/**241* Indicates this object is the child of an object that allows its242* children to be selected, and that this child is one of those243* children that has been selected.244* @see #SELECTABLE245* @see Accessible#getAccessibleContext246* @see AccessibleContext#getAccessibleSelection247* @see AccessibleSelection248*/249public static final AccessibleState SELECTED250= new AccessibleState("selected");251252/**253* Indicates this object, the object's parent, the object's parent's254* parent, and so on, are all visible. Note that this does not255* necessarily mean the object is painted on the screen. It might256* be occluded by some other showing object.257* @see #VISIBLE258*/259public static final AccessibleState SHOWING260= new AccessibleState("showing");261262/**263* Indicates this object is visible. Note: this means that the264* object intends to be visible; however, it may not in fact be265* showing on the screen because one of the objects that this object266* is contained by is not visible.267* @see #SHOWING268*/269public static final AccessibleState VISIBLE270= new AccessibleState("visible");271272/**273* Indicates the orientation of this object is vertical. This is274* usually associated with objects such as scrollbars, sliders, and275* progress bars.276* @see #VERTICAL277* @see AccessibleRole#SCROLL_BAR278* @see AccessibleRole#SLIDER279* @see AccessibleRole#PROGRESS_BAR280*/281public static final AccessibleState VERTICAL282= new AccessibleState("vertical");283284/**285* Indicates the orientation of this object is horizontal. This is286* usually associated with objects such as scrollbars, sliders, and287* progress bars.288* @see #HORIZONTAL289* @see AccessibleRole#SCROLL_BAR290* @see AccessibleRole#SLIDER291* @see AccessibleRole#PROGRESS_BAR292*/293public static final AccessibleState HORIZONTAL294= new AccessibleState("horizontal");295296/**297* Indicates this (text) object can contain only a single line of text298*/299public static final AccessibleState SINGLE_LINE300= new AccessibleState("singleline");301302/**303* Indicates this (text) object can contain multiple lines of text304*/305public static final AccessibleState MULTI_LINE306= new AccessibleState("multiline");307308/**309* Indicates this object is transient. An assistive technology should310* not add a PropertyChange listener to an object with transient state,311* as that object will never generate any events. Transient objects312* are typically created to answer Java Accessibility method queries,313* but otherwise do not remain linked to the underlying object (for314* example, those objects underneath lists, tables, and trees in Swing,315* where only one actual UI Component does shared rendering duty for316* all of the data objects underneath the actual list/table/tree elements).317*318* @since 1.5319*320*/321public static final AccessibleState TRANSIENT322= new AccessibleState("transient");323324/**325* Indicates this object is responsible for managing its326* subcomponents. This is typically used for trees and tables327* that have a large number of subcomponents and where the328* objects are created only when needed and otherwise remain virtual.329* The application should not manage the subcomponents directly.330*331* @since 1.5332*/333public static final AccessibleState MANAGES_DESCENDANTS334= new AccessibleState ("managesDescendants");335336/**337* Indicates that the object state is indeterminate. An example338* is selected text that is partially bold and partially not339* bold. In this case the attributes associated with the selected340* text are indeterminate.341*342* @since 1.5343*/344public static final AccessibleState INDETERMINATE345= new AccessibleState ("indeterminate");346347/**348* A state indicating that text is truncated by a bounding rectangle349* and that some of the text is not displayed on the screen. An example350* is text in a spreadsheet cell that is truncated by the bounds of351* the cell.352*353* @since 1.5354*/355static public final AccessibleState TRUNCATED356= new AccessibleState("truncated");357358/**359* Creates a new AccessibleState using the given locale independent key.360* This should not be a public method. Instead, it is used to create361* the constants in this file to make it a strongly typed enumeration.362* Subclasses of this class should enforce similar policy.363* <p>364* The key String should be a locale independent key for the state.365* It is not intended to be used as the actual String to display366* to the user. To get the localized string, use toDisplayString.367*368* @param key the locale independent name of the state.369* @see AccessibleBundle#toDisplayString370*/371protected AccessibleState(String key) {372this.key = key;373}374}375376377