1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
/* * @(#)AccessibleHyperlink.java 1.14 05/11/17 * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package javax.accessibility; import java.util.*; import java.awt.*; import javax.swing.text.*; /** * Encapsulation of a link, or set of links (e.g. client side imagemap) * in a Hypertext document * * @see Accessible * @see Accessible#getAccessibleContext * @see AccessibleContext * @see AccessibleText * @see AccessibleContext#getAccessibleText * * @version 1.14, 11/17/05 * @author Peter Korn */ public abstract class AccessibleHyperlink implements AccessibleAction { /** * Since the document a link is associated with may have * changed, this method returns whether or not this Link is still valid * (with respect to the document it references). * * @return a flag indicating whether this link is still valid with * respect to the AccessibleHypertext it belongs to */ public abstract boolean isValid(); /** * Returns the number of accessible actions available in this Link * If there are more than one, the first one is NOT considered the * "default" action of this LINK object (e.g. in an HTML imagemap). * In general, links will have only one AccessibleAction in them. * * @return the zero-based number of Actions in this object */ public abstract int getAccessibleActionCount(); /** * Performs the specified Action on the object * * @param i zero-based index of actions * @return true if the action was performed; otherwise false. * @see #getAccessibleActionCount */ public abstract boolean doAccessibleAction(int i); /** * Returns a String description of this particular * link action. This should be a text string * associated with anchoring text, this should be the * anchor text. E.g. from HTML: * <a HREF="http://www.sun.com/access">Accessibility</a> * this method would return "Accessibility". * * Similarly, from this HTML: * <a HREF="#top"><img src="top-hat.gif" alt="top hat"></a> * this method would return "top hat" * * @param i zero-based index of the actions * @return a String description of the action * @see #getAccessibleActionCount */ public abstract String getAccessibleActionDescription(int i); /** * Returns an object that represents the link action, * as appropriate for that link. E.g. from HTML: * <a HREF="http://www.sun.com/access">Accessibility</a> * this method would return a * java.net.URL("http://www.sun.com/access.html"); * * @param i zero-based index of the actions * @return an Object representing the hypertext link itself * @see #getAccessibleActionCount */ public abstract Object getAccessibleActionObject(int i); /** * Returns an object that represents the link anchor, * as appropriate for that link. E.g. from HTML: * <a href="http://www.sun.com/access">Accessibility</a> * this method would return a String containing the text: * "Accessibility". * * Similarly, from this HTML: * <a HREF="#top"><img src="top-hat.gif" alt="top hat"></a> * this might return the object ImageIcon("top-hat.gif", "top hat"); * * @param i zero-based index of the actions * @return an Object representing the hypertext anchor * @see #getAccessibleActionCount */ public abstract Object getAccessibleActionAnchor(int i); /** * Gets the index with the hypertext document at which this * link begins * * @return index of start of link */ public abstract int getStartIndex(); /** * Gets the index with the hypertext document at which this * link ends * * @return index of end of link */ public abstract int getEndIndex(); }