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