| 1 | /* AccessibleHyperlink.java -- aids in accessibly navigating hypertext
|
|---|
| 2 | Copyright (C) 2002 Free Software Foundation, Inc.
|
|---|
| 3 |
|
|---|
| 4 | This file is part of GNU Classpath.
|
|---|
| 5 |
|
|---|
| 6 | GNU Classpath is free software; you can redistribute it and/or modify
|
|---|
| 7 | it under the terms of the GNU General Public License as published by
|
|---|
| 8 | the Free Software Foundation; either version 2, or (at your option)
|
|---|
| 9 | any later version.
|
|---|
| 10 |
|
|---|
| 11 | GNU Classpath is distributed in the hope that it will be useful, but
|
|---|
| 12 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 14 | General Public License for more details.
|
|---|
| 15 |
|
|---|
| 16 | You should have received a copy of the GNU General Public License
|
|---|
| 17 | along with GNU Classpath; see the file COPYING. If not, write to the
|
|---|
| 18 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|---|
| 19 | 02111-1307 USA.
|
|---|
| 20 |
|
|---|
| 21 | Linking this library statically or dynamically with other modules is
|
|---|
| 22 | making a combined work based on this library. Thus, the terms and
|
|---|
| 23 | conditions of the GNU General Public License cover the whole
|
|---|
| 24 | combination.
|
|---|
| 25 |
|
|---|
| 26 | As a special exception, the copyright holders of this library give you
|
|---|
| 27 | permission to link this library with independent modules to produce an
|
|---|
| 28 | executable, regardless of the license terms of these independent
|
|---|
| 29 | modules, and to copy and distribute the resulting executable under
|
|---|
| 30 | terms of your choice, provided that you also meet, for each linked
|
|---|
| 31 | independent module, the terms and conditions of the license of that
|
|---|
| 32 | module. An independent module is a module which is not derived from
|
|---|
| 33 | or based on this library. If you modify this library, you may extend
|
|---|
| 34 | this exception to your version of the library, but you are not
|
|---|
| 35 | obligated to do so. If you do not wish to do so, delete this
|
|---|
| 36 | exception statement from your version. */
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 | package javax.accessibility;
|
|---|
| 40 |
|
|---|
| 41 | /**
|
|---|
| 42 | * This object encapsulates actions associated with navigating hypertext.
|
|---|
| 43 | *
|
|---|
| 44 | * @author Eric Blake <[email protected]>
|
|---|
| 45 | * @see Accessible
|
|---|
| 46 | * @see AccessibleContext
|
|---|
| 47 | * @see AccessibleText
|
|---|
| 48 | * @see AccessibleContext#getAccessibleText()
|
|---|
| 49 | * @since 1.2
|
|---|
| 50 | * @status updated to 1.4
|
|---|
| 51 | */
|
|---|
| 52 | public abstract class AccessibleHyperlink implements AccessibleAction
|
|---|
| 53 | {
|
|---|
| 54 | /**
|
|---|
| 55 | * The default constructor.
|
|---|
| 56 | */
|
|---|
| 57 | public AccessibleHyperlink()
|
|---|
| 58 | {
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | /**
|
|---|
| 62 | * Returns whether the document the link references is still valid, as the
|
|---|
| 63 | * association may have changed with a text edit.
|
|---|
| 64 | *
|
|---|
| 65 | * @return true if the link is valid with respect to the AccessibleHypertext
|
|---|
| 66 | */
|
|---|
| 67 | public abstract boolean isValid();
|
|---|
| 68 |
|
|---|
| 69 | /**
|
|---|
| 70 | * Get the number possible actions for this object, starting from 0. In
|
|---|
| 71 | * general, a hypertext link has only one action, except for an image map,
|
|---|
| 72 | * so there isn't really a default action.
|
|---|
| 73 | *
|
|---|
| 74 | * @return the 0-based number of actions
|
|---|
| 75 | */
|
|---|
| 76 | public abstract int getAccessibleActionCount();
|
|---|
| 77 |
|
|---|
| 78 | /**
|
|---|
| 79 | * Perform the specified action. Does nothing if out of bounds.
|
|---|
| 80 | *
|
|---|
| 81 | * @param i the action to perform, 0-based
|
|---|
| 82 | * @return true if the action was performed
|
|---|
| 83 | * @see #getAccessibleActionCount()
|
|---|
| 84 | */
|
|---|
| 85 | public abstract boolean doAccessibleAction(int i);
|
|---|
| 86 |
|
|---|
| 87 | /**
|
|---|
| 88 | * Get the anchor text of the link, or null if the index is out of bounds.
|
|---|
| 89 | * For example, <a href="http://www.gnu.org/">GNU Home Page</a>
|
|---|
| 90 | * would return "GNU Home Page", while <a HREF="#top">
|
|---|
| 91 | * <img src="top-hat.png" alt="top hat"></a> would return
|
|---|
| 92 | * "top hat".
|
|---|
| 93 | *
|
|---|
| 94 | * @param i the link to retrieve, 0-based
|
|---|
| 95 | * @return the link anchor text
|
|---|
| 96 | * @see #getAccessibleActionCount()
|
|---|
| 97 | */
|
|---|
| 98 | public abstract String getAccessibleActionDescription(int i);
|
|---|
| 99 |
|
|---|
| 100 | /**
|
|---|
| 101 | * Get the link location, or null if the index is out of bounds. For
|
|---|
| 102 | * example, <a href="http://www.gnu.org/">GNU Home Page</a>
|
|---|
| 103 | * would return a java.net.URL("http://www.gnu.org/").
|
|---|
| 104 | *
|
|---|
| 105 | * @param i the link to retrieve, 0-based
|
|---|
| 106 | * @return the link location
|
|---|
| 107 | * @see #getAccessibleActionCount()
|
|---|
| 108 | */
|
|---|
| 109 | public abstract String getAccessibleActionObject(int i);
|
|---|
| 110 |
|
|---|
| 111 | /**
|
|---|
| 112 | * Get the anchor appropriate for the link, or null if the index is out of
|
|---|
| 113 | * bounds. For example, <a href="http://www.gnu.org/">GNU Home Page
|
|---|
| 114 | * </a> would return "GNU Home Page", while <a HREF="#top">
|
|---|
| 115 | * <img src="top-hat.png" alt="top hat"></a> would return
|
|---|
| 116 | * an ImageIcon("top-hat.png", "top hat").
|
|---|
| 117 | *
|
|---|
| 118 | * @param i the link to retrieve, 0-based
|
|---|
| 119 | * @return the link anchor object
|
|---|
| 120 | * @see #getAccessibleActionCount()
|
|---|
| 121 | */
|
|---|
| 122 | public abstract String getAccessibleActionAnchor(int i);
|
|---|
| 123 |
|
|---|
| 124 | /**
|
|---|
| 125 | * Gets the character index where this link starts in the parent hypertext
|
|---|
| 126 | * document.
|
|---|
| 127 | *
|
|---|
| 128 | * @return the starting index
|
|---|
| 129 | */
|
|---|
| 130 | public abstract int getStartIndex();
|
|---|
| 131 |
|
|---|
| 132 | /**
|
|---|
| 133 | * Gets the character index where this link ends in the parent hypertext
|
|---|
| 134 | * document.
|
|---|
| 135 | *
|
|---|
| 136 | * @return the ending index
|
|---|
| 137 | */
|
|---|
| 138 | public abstract int getEndIndex();
|
|---|
| 139 | } // class AccessibleAction
|
|---|