Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/share/classes/javax/accessibility/AccessibleHyperlink.java
41153 views
1
/*
2
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package javax.accessibility;
27
28
/**
29
* Encapsulation of a link, or set of links (e.g. client side imagemap) in a
30
* Hypertext document
31
*
32
* @author Peter Korn
33
* @see Accessible
34
* @see Accessible#getAccessibleContext
35
* @see AccessibleContext
36
* @see AccessibleText
37
* @see AccessibleContext#getAccessibleText
38
*/
39
public abstract class AccessibleHyperlink implements AccessibleAction {
40
41
/**
42
* Constructor for subclasses to call.
43
*/
44
protected AccessibleHyperlink() {}
45
46
/**
47
* Since the document a link is associated with may have changed, this
48
* method returns whether or not this Link is still valid (with respect to
49
* the document it references).
50
*
51
* @return a flag indicating whether this link is still valid with respect
52
* to the {@code AccessibleHypertext} it belongs to
53
*/
54
public abstract boolean isValid();
55
56
/**
57
* Returns the number of accessible actions available in this Link If there
58
* are more than one, the first one is NOT considered the "default" action
59
* of this LINK object (e.g. in an HTML imagemap). In general, links will
60
* have only one {@code AccessibleAction} in them.
61
*
62
* @return the zero-based number of actions in this object
63
*/
64
public abstract int getAccessibleActionCount();
65
66
/**
67
* Performs the specified action on the object.
68
*
69
* @param i zero-based index of actions
70
* @return {@code true} if the action was performed; otherwise {@code false}
71
* @see #getAccessibleActionCount
72
*/
73
public abstract boolean doAccessibleAction(int i);
74
75
/**
76
* Returns a string description of this particular link action. This should
77
* be a text string associated with anchoring text, this should be the
78
* anchor text. E.g. from HTML: <a
79
* HREF="http://www.sun.com/access">Accessibility</a> this method
80
* would return "Accessibility".
81
* <p>
82
* Similarly, from this HTML: &lt;a HREF="#top"&gt;&lt;img src="top-hat.gif"
83
* alt="top hat"&gt;&lt;/a&gt; this method would return "top hat"
84
*
85
* @param i zero-based index of the actions
86
* @return a string description of the action
87
* @see #getAccessibleActionCount
88
*/
89
public abstract String getAccessibleActionDescription(int i);
90
91
/**
92
* Returns an object that represents the link action, as appropriate for
93
* that link. E.g. from HTML: &lt;a
94
* HREF="http://www.sun.com/access"&gt;Accessibility&lt;/a&gt; this method
95
* would return a java.net.URL("http://www.sun.com/access.html");
96
*
97
* @param i zero-based index of the actions
98
* @return an object representing the hypertext link itself
99
* @see #getAccessibleActionCount
100
*/
101
public abstract Object getAccessibleActionObject(int i);
102
103
/**
104
* Returns an object that represents the link anchor, as appropriate for
105
* that link. E.g. from HTML: &lt;a
106
* href="http://www.sun.com/access"&gt;Accessibility&lt;/a&gt; this method
107
* would return a {@code String} containing the text: "Accessibility".
108
* <p>
109
* Similarly, from this HTML: &lt;a HREF="#top"&gt;&lt;img src="top-hat.gif"
110
* alt="top hat"&gt;&lt;/a&gt; this might return the object
111
* ImageIcon("top-hat.gif", "top hat");
112
*
113
* @param i zero-based index of the actions
114
* @return an object representing the hypertext anchor
115
* @see #getAccessibleActionCount
116
*/
117
public abstract Object getAccessibleActionAnchor(int i);
118
119
/**
120
* Gets the index with the hypertext document at which this link begins.
121
*
122
* @return index of start of link
123
*/
124
public abstract int getStartIndex();
125
126
/**
127
* Gets the index with the hypertext document at which this link ends.
128
*
129
* @return index of end of link
130
*/
131
public abstract int getEndIndex();
132
}
133
134