1/*
2 * Copyright (c) 1998, 2017, 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
26package javax.accessibility;
27
28/**
29 * The {@code AccessibleHypertext} class is the base class for all classes that
30 * present hypertext information on the display. This class provides the
31 * standard mechanism for an assistive technology to access that text via its
32 * content, attributes, and spatial location. It also provides standard
33 * mechanisms for manipulating hyperlinks. Applications can determine if an
34 * object supports the {@code AccessibleHypertext} interface by first obtaining
35 * its {@code AccessibleContext} (see {@link Accessible}) and then calling the
36 * {@link AccessibleContext#getAccessibleText} method of
37 * {@code AccessibleContext}. If the return value is a class which extends
38 * {@code AccessibleHypertext}, then that object supports
39 * {@code AccessibleHypertext}.
40 *
41 * @author Peter Korn
42 * @see Accessible
43 * @see Accessible#getAccessibleContext
44 * @see AccessibleContext
45 * @see AccessibleText
46 * @see AccessibleContext#getAccessibleText
47 */
48public interface AccessibleHypertext extends AccessibleText {
49
50    /**
51     * Returns the number of links within this hypertext document.
52     *
53     * @return number of links in this hypertext doc
54     */
55    public abstract int getLinkCount();
56
57    /**
58     * Returns the nth Link of this Hypertext document.
59     *
60     * @param  linkIndex within the links of this Hypertext
61     * @return Link object encapsulating the nth link(s)
62     */
63    public abstract AccessibleHyperlink getLink(int linkIndex);
64
65    /**
66     * Returns the index into an array of hyperlinks that is associated with
67     * this character index, or -1 if there is no hyperlink associated with this
68     * index.
69     *
70     * @param  charIndex index within the text
71     * @return index into the set of hyperlinks for this hypertext doc
72     */
73    public abstract int getLinkIndex(int charIndex);
74}
75