KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > accessibility > AccessibleHyperlink


1 /*
2  * @(#)AccessibleHyperlink.java 1.13 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.accessibility;
9
10
11 import java.util.*;
12 import java.awt.*;
13 import javax.swing.text.*;
14
15
16 /**
17  * Encapsulation of a link, or set of links (e.g. client side imagemap)
18  * in a Hypertext document
19  *
20  * @see Accessible
21  * @see Accessible#getAccessibleContext
22  * @see AccessibleContext
23  * @see AccessibleText
24  * @see AccessibleContext#getAccessibleText
25  *
26  * @version 1.13, 12/19/03
27  * @author Peter Korn
28  */

29 public abstract class AccessibleHyperlink implements AccessibleAction JavaDoc {
30
31     /**
32      * Since the document a link is associated with may have
33      * changed, this method returns whether or not this Link is still valid
34      * (with respect to the document it references).
35      *
36      * @return a flag indicating whether this link is still valid with
37      * respect to the AccessibleHypertext it belongs to
38      */

39     public abstract boolean isValid();
40
41     /**
42      * Returns the number of accessible actions available in this Link
43      * If there are more than one, the first one is NOT considered the
44          * "default" action of this LINK object (e.g. in an HTML imagemap).
45      * In general, links will have only one AccessibleAction in them.
46      *
47      * @return the zero-based number of Actions in this object
48      */

49     public abstract int getAccessibleActionCount();
50
51     /**
52      * Performs the specified Action on the object
53      *
54      * @param i zero-based index of actions
55      * @return true if the action was performed; otherwise false.
56      * @see #getAccessibleActionCount
57      */

58     public abstract boolean doAccessibleAction(int i);
59
60     /**
61      * Returns a String description of this particular
62      * link action. This should be a text string
63      * associated with anchoring text, this should be the
64      * anchor text. E.g. from HTML:
65      * <a HREF="http://www.sun.com/access">Accessibility</a>
66      * this method would return "Accessibility".
67      *
68      * Similarly, from this HTML:
69      * <a HREF="#top"><img SRC="top-hat.gif" alt="top hat"></a>
70      * this method would return "top hat"
71      *
72          * @param i zero-based index of the actions
73          * @return a String description of the action
74      * @see #getAccessibleActionCount
75      */

76     public abstract String JavaDoc getAccessibleActionDescription(int i);
77
78     /**
79      * Returns an object that represents the link action,
80      * as appropriate for that link. E.g. from HTML:
81      * <a HREF="http://www.sun.com/access">Accessibility</a>
82      * this method would return a
83      * java.net.URL("http://www.sun.com/access.html");
84      *
85          * @param i zero-based index of the actions
86          * @return an Object representing the hypertext link itself
87      * @see #getAccessibleActionCount
88      */

89     public abstract Object JavaDoc getAccessibleActionObject(int i);
90
91     /**
92      * Returns an object that represents the link anchor,
93      * as appropriate for that link. E.g. from HTML:
94      * <a HREF="http://www.sun.com/access">Accessibility</a>
95      * this method would return a String containing the text:
96      * "Accessibility".
97      *
98      * Similarly, from this HTML:
99      * <a HREF="#top"><img SRC="top-hat.gif" alt="top hat"></a>
100      * this might return the object ImageIcon("top-hat.gif", "top hat");
101      *
102          * @param i zero-based index of the actions
103          * @return an Object representing the hypertext anchor
104      * @see #getAccessibleActionCount
105      */

106     public abstract Object JavaDoc getAccessibleActionAnchor(int i);
107
108     /**
109      * Gets the index with the hypertext document at which this
110      * link begins
111      *
112      * @return index of start of link
113      */

114     public abstract int getStartIndex();
115
116     /**
117      * Gets the index with the hypertext document at which this
118      * link ends
119      *
120      * @return index of end of link
121      */

122     public abstract int getEndIndex();
123 }
124
Popular Tags