Merge from the pain train
[official-gcc.git] / libjava / javax / accessibility / AccessibleHyperlink.java
blob663f30af017a314e0436202df92cd1eb87889e46
1 /* AccessibleHyperlink.java -- aids in accessibly navigating hypertext
2 Copyright (C) 2002, 2005 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
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.
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.
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.
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.
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. */
39 package javax.accessibility;
41 /**
42 * This object encapsulates actions associated with navigating hypertext.
44 * @author Eric Blake (ebb9@email.byu.edu)
45 * @see Accessible
46 * @see AccessibleContext
47 * @see AccessibleText
48 * @see AccessibleContext#getAccessibleText()
49 * @since 1.2
50 * @status updated to 1.4
52 public abstract class AccessibleHyperlink implements AccessibleAction
54 /**
55 * The default constructor.
57 public AccessibleHyperlink()
61 /**
62 * Returns whether the document the link references is still valid, as the
63 * association may have changed with a text edit.
65 * @return true if the link is valid with respect to the AccessibleHypertext
67 public abstract boolean isValid();
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.
74 * @return the 0-based number of actions
76 public abstract int getAccessibleActionCount();
78 /**
79 * Perform the specified action. Does nothing if out of bounds.
81 * @param i the action to perform, 0-based
82 * @return true if the action was performed
83 * @see #getAccessibleActionCount()
85 public abstract boolean doAccessibleAction(int i);
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".
94 * @param i the link to retrieve, 0-based
95 * @return the link anchor text
96 * @see #getAccessibleActionCount()
98 public abstract String getAccessibleActionDescription(int i);
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/").
105 * @param i the link to retrieve, 0-based
106 * @return the link location
107 * @see #getAccessibleActionCount()
109 public abstract Object getAccessibleActionObject(int i);
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").
118 * @param i the link to retrieve, 0-based
119 * @return the link anchor object
120 * @see #getAccessibleActionCount()
122 public abstract Object getAccessibleActionAnchor(int i);
125 * Gets the character index where this link starts in the parent hypertext
126 * document.
128 * @return the starting index
130 public abstract int getStartIndex();
133 * Gets the character index where this link ends in the parent hypertext
134 * document.
136 * @return the ending index
138 public abstract int getEndIndex();
139 } // class AccessibleAction