Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/accessibility/AccessibleHyperlink.java
38829 views
/*1* Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.accessibility;262728import java.util.*;29import java.awt.*;30import javax.swing.text.*;313233/**34* Encapsulation of a link, or set of links (e.g. client side imagemap)35* in a Hypertext document36*37* @see Accessible38* @see Accessible#getAccessibleContext39* @see AccessibleContext40* @see AccessibleText41* @see AccessibleContext#getAccessibleText42*43* @author Peter Korn44*/45public abstract class AccessibleHyperlink implements AccessibleAction {4647/**48* Since the document a link is associated with may have49* changed, this method returns whether or not this Link is still valid50* (with respect to the document it references).51*52* @return a flag indicating whether this link is still valid with53* respect to the AccessibleHypertext it belongs to54*/55public abstract boolean isValid();5657/**58* Returns the number of accessible actions available in this Link59* If there are more than one, the first one is NOT considered the60* "default" action of this LINK object (e.g. in an HTML imagemap).61* In general, links will have only one AccessibleAction in them.62*63* @return the zero-based number of Actions in this object64*/65public abstract int getAccessibleActionCount();6667/**68* Performs the specified Action on the object69*70* @param i zero-based index of actions71* @return true if the action was performed; otherwise false.72* @see #getAccessibleActionCount73*/74public abstract boolean doAccessibleAction(int i);7576/**77* Returns a String description of this particular78* link action. This should be a text string79* associated with anchoring text, this should be the80* anchor text. E.g. from HTML:81* <a HREF="http://www.sun.com/access">Accessibility</a>82* this method would return "Accessibility".83*84* Similarly, from this HTML:85* <a HREF="#top"><img src="top-hat.gif" alt="top hat"></a>86* this method would return "top hat"87*88* @param i zero-based index of the actions89* @return a String description of the action90* @see #getAccessibleActionCount91*/92public abstract String getAccessibleActionDescription(int i);9394/**95* Returns an object that represents the link action,96* as appropriate for that link. E.g. from HTML:97* <a HREF="http://www.sun.com/access">Accessibility</a>98* this method would return a99* java.net.URL("http://www.sun.com/access.html");100*101* @param i zero-based index of the actions102* @return an Object representing the hypertext link itself103* @see #getAccessibleActionCount104*/105public abstract Object getAccessibleActionObject(int i);106107/**108* Returns an object that represents the link anchor,109* as appropriate for that link. E.g. from HTML:110* <a href="http://www.sun.com/access">Accessibility</a>111* this method would return a String containing the text:112* "Accessibility".113*114* Similarly, from this HTML:115* <a HREF="#top"><img src="top-hat.gif" alt="top hat"></a>116* this might return the object ImageIcon("top-hat.gif", "top hat");117*118* @param i zero-based index of the actions119* @return an Object representing the hypertext anchor120* @see #getAccessibleActionCount121*/122public abstract Object getAccessibleActionAnchor(int i);123124/**125* Gets the index with the hypertext document at which this126* link begins127*128* @return index of start of link129*/130public abstract int getStartIndex();131132/**133* Gets the index with the hypertext document at which this134* link ends135*136* @return index of end of link137*/138public abstract int getEndIndex();139}140141142