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 * The {@code AccessibleAction} interface should be supported by any object that 30 * can perform one or more actions. This interface provides the standard 31 * mechanism for an assistive technology to determine what those actions are as 32 * well as tell the object to perform them. Any object that can be manipulated 33 * should support this interface. Applications can determine if an object 34 * supports the {@code AccessibleAction} interface by first obtaining its 35 * {@code AccessibleContext} (see {@link Accessible}) and then calling the 36 * {@link AccessibleContext#getAccessibleAction} method. If the return value is 37 * not {@code null}, the object supports this interface. 38 * 39 * @author Peter Korn 40 * @author Hans Muller 41 * @author Willie Walker 42 * @author Lynn Monsanto 43 * @see Accessible 44 * @see Accessible#getAccessibleContext 45 * @see AccessibleContext 46 * @see AccessibleContext#getAccessibleAction 47 */ 48public interface AccessibleAction { 49 50 /** 51 * An action which causes a tree node to collapse if expanded and expand if 52 * collapsed. 53 * 54 * @since 1.5 55 */ 56 public static final String TOGGLE_EXPAND = 57 new String ("toggleexpand"); 58 59 /** 60 * An action which increments a value. 61 * 62 * @since 1.5 63 */ 64 public static final String INCREMENT = 65 new String ("increment"); 66 67 68 /** 69 * An action which decrements a value. 70 * 71 * @since 1.5 72 */ 73 public static final String DECREMENT = 74 new String ("decrement"); 75 76 /** 77 * An action which causes a component to execute its default action. 78 * 79 * @since 1.6 80 */ 81 public static final String CLICK = new String("click"); 82 83 /** 84 * An action which causes a popup to become visible if it is hidden and 85 * hidden if it is visible. 86 * 87 * @since 1.6 88 */ 89 public static final String TOGGLE_POPUP = new String("toggle popup"); 90 91 /** 92 * Returns the number of accessible actions available in this object If 93 * there are more than one, the first one is considered the "default" action 94 * of the object. 95 * 96 * @return the zero-based number of actions in this object 97 */ 98 public int getAccessibleActionCount(); 99 100 /** 101 * Returns a description of the specified action of the object. 102 * 103 * @param i zero-based index of the actions 104 * @return a {@code String} description of the action 105 * @see #getAccessibleActionCount 106 */ 107 public String getAccessibleActionDescription(int i); 108 109 /** 110 * Performs the specified action on the object. 111 * 112 * @param i zero-based index of actions 113 * @return {@code true} if the action was performed; otherwise {@code false} 114 * @see #getAccessibleActionCount 115 */ 116 public boolean doAccessibleAction(int i); 117} 118