1/* 2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. 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. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26package javax.accessibility; 27 28/** 29 * This {@code AccessibleSelection} interface provides the standard mechanism 30 * for an assistive technology to determine what the current selected children 31 * are, as well as modify the selection set. Any object that has children that 32 * can be selected should support the {@code AccessibleSelection} interface. 33 * Applications can determine if an object supports the 34 * {@code AccessibleSelection} interface by first obtaining its 35 * {@code AccessibleContext} (see {@link Accessible}) and then calling the 36 * {@link AccessibleContext#getAccessibleSelection} method. If the return value 37 * is not {@code null}, the object supports this interface. 38 * 39 * @author Peter Korn 40 * @author Hans Muller 41 * @author Willie Walker 42 * @see Accessible 43 * @see Accessible#getAccessibleContext 44 * @see AccessibleContext 45 * @see AccessibleContext#getAccessibleSelection 46 */ 47public interface AccessibleSelection { 48 49 /** 50 * Returns the number of {@code Accessible} children currently selected. If 51 * no children are selected, the return value will be 0. 52 * 53 * @return the number of items currently selected 54 */ 55 public int getAccessibleSelectionCount(); 56 57 /** 58 * Returns an {@code Accessible} representing the specified selected child 59 * of the object. If there isn't a selection, or there are fewer children 60 * selected than the integer passed in, the return value will be 61 * {@code null}. 62 * <p> 63 * Note that the index represents the i-th selected child, which is 64 * different from the i-th child. 65 * 66 * @param i the zero-based index of selected children 67 * @return the i-th selected child 68 * @see #getAccessibleSelectionCount 69 */ 70 public Accessible getAccessibleSelection(int i); 71 72 /** 73 * Determines if the current child of this object is selected. 74 * 75 * @param i the zero-based index of the child in this {@code Accessible} 76 * object 77 * @return {@code true} if the current child of this object is selected; 78 * else {@code false} 79 * @see AccessibleContext#getAccessibleChild 80 */ 81 public boolean isAccessibleChildSelected(int i); 82 83 /** 84 * Adds the specified {@code Accessible} child of the object to the object's 85 * selection. If the object supports multiple selections, the specified 86 * child is added to any existing selection, otherwise it replaces any 87 * existing selection in the object. If the specified child is already 88 * selected, this method has no effect. 89 * 90 * @param i the zero-based index of the child 91 * @see AccessibleContext#getAccessibleChild 92 */ 93 public void addAccessibleSelection(int i); 94 95 /** 96 * Removes the specified child of the object from the object's selection. If 97 * the specified item isn't currently selected, this method has no effect. 98 * 99 * @param i the zero-based index of the child 100 * @see AccessibleContext#getAccessibleChild 101 */ 102 public void removeAccessibleSelection(int i); 103 104 /** 105 * Clears the selection in the object, so that no children in the object are 106 * selected. 107 */ 108 public void clearAccessibleSelection(); 109 110 /** 111 * Causes every child of the object to be selected if the object supports 112 * multiple selections. 113 */ 114 public void selectAllAccessibleSelection(); 115} 116