jdk/src/share/classes/javax/accessibility/AccessibleExtendedText.java
author darcy
Thu, 10 Dec 2009 13:28:07 -0800
changeset 4511 ae1aa33f5de4
parent 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
4891262: API spec, javax/accessibility: few invalid javadoc tags Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.accessibility;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import javax.swing.text.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * <P>The AccessibleExtendedText interface contains additional methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * not provided by the AccessibleText interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * Applications can determine if an object supports the AccessibleExtendedText
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * interface by first obtaining its AccessibleContext (see {@link Accessible})
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * and then calling the {@link AccessibleContext#getAccessibleText} method of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * AccessibleContext.  If the return value is an instance of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * AccessibleExtendedText, the object supports this interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * @see Accessible
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * @see Accessible#getAccessibleContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * @see AccessibleContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * @see AccessibleContext#getAccessibleText
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * @author       Peter Korn
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * @author       Lynn Monsanto
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
public interface AccessibleExtendedText {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     * Constant used to indicate that the part of the text that should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * retrieved is a line of text.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * @see AccessibleText#getAtIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * @see AccessibleText#getAfterIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * @see AccessibleText#getBeforeIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    public static final int LINE = 4; // BugID: 4849720
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * Constant used to indicate that the part of the text that should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * retrieved is contiguous text with the same text attributes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * @see AccessibleText#getAtIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * @see AccessibleText#getAfterIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * @see AccessibleText#getBeforeIndex
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    public static final int ATTRIBUTE_RUN = 5; // BugID: 4849720
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * Returns the text between two indices
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * @param startIndex the start index in the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * @param endIndex the end index in the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * @return the text string if the indices are valid.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * Otherwise, null is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    public String getTextRange(int startIndex, int endIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * Returns the <code>AccessibleTextSequence</code> at a given index.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * @param part the <code>CHARACTER</code>, <code>WORD</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * <code>SENTENCE</code>, <code>LINE</code> or <code>ATTRIBUTE_RUN</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * to retrieve
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * @param index an index within the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * @return an <code>AccessibleTextSequence</code> specifying the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * if part and index are valid.  Otherwise, null is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * @see AccessibleText#CHARACTER
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * @see AccessibleText#WORD
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * @see AccessibleText#SENTENCE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    public AccessibleTextSequence getTextSequenceAt(int part, int index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * Returns the <code>AccessibleTextSequence</code> after a given index.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * @param part the <code>CHARACTER</code>, <code>WORD</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * <code>SENTENCE</code>, <code>LINE</code> or <code>ATTRIBUTE_RUN</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * to retrieve
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * @param index an index within the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * @return an <code>AccessibleTextSequence</code> specifying the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * if part and index are valid.  Otherwise, null is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * @see AccessibleText#CHARACTER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * @see AccessibleText#WORD
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * @see AccessibleText#SENTENCE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    public AccessibleTextSequence getTextSequenceAfter(int part, int index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * Returns the <code>AccessibleTextSequence</code> before a given index.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * @param part the <code>CHARACTER</code>, <code>WORD</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * <code>SENTENCE</code>, <code>LINE</code> or <code>ATTRIBUTE_RUN</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * to retrieve
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * @param index an index within the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * @return an <code>AccessibleTextSequence</code> specifying the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * if part and index are valid.  Otherwise, null is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * @see AccessibleText#CHARACTER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * @see AccessibleText#WORD
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * @see AccessibleText#SENTENCE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    public AccessibleTextSequence getTextSequenceBefore(int part, int index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * Returns the bounding rectangle of the text between two indices.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * @param startIndex the start index in the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * @param endIndex the end index in the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * @return the bounding rectangle of the text if the indices are valid.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * Otherwise, null is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    public Rectangle getTextBounds(int startIndex, int endIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
}