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 124 125 126 127
/* * @(#)AccessibleExtendedText.java 1.5 06/04/07 * * 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.*; /** * <P>The AccessibleExtendedText interface contains additional methods * not provided by the AccessibleText interface * * Applications can determine if an object supports the AccessibleExtendedText * interface by first obtaining its AccessibleContext (see {@link Accessible}) * and then calling the {@link AccessibleContext#getAccessibleText} method of * AccessibleContext. If the return value is an instance of * AccessibleExtendedText, the object supports this interface. * * @see Accessible * @see Accessible#getAccessibleContext * @see AccessibleContext * @see AccessibleContext#getAccessibleText * @see AccessibleText.AccessibleTextChunk * * @version 1.5 04/07/06 * @author Peter Korn * @author Lynn Monsanto * @since 1.5 */ public interface AccessibleExtendedText { /** * Constant used to indicate that the part of the text that should be * retrieved is a line of text. * * @see AccessibleText#getAtIndex * @see AccessibleText#getAfterIndex * @see AccessibleText#getBeforeIndex */ public static final int LINE = 4; // BugID: 4849720 /** * Constant used to indicate that the part of the text that should be * retrieved is contiguous text with the same text attributes. * * @see AccessibleText#getAtIndex * @see AccessibleText#getAfterIndex * @see AccessibleText#getBeforeIndex */ public static final int ATTRIBUTE_RUN = 5; // BugID: 4849720 /** * Returns the text between two indices * * @param startIndex the start index in the text * @param endIndex the end index in the text * @return the text string if the indices are valid. * Otherwise, null is returned. */ public String getTextRange(int startIndex, int endIndex); /** * Returns the <code>AccessibleTextSequence</code> at a given index. * * @param part the <code>CHARACTER</code>, <code>WORD</code>, * <code>SENTENCE</code>, <code>LINE</code> or <code>ATTRIBUTE_RUN</code> * to retrieve * @param index an index within the text * @return an <code>AccessibleTextSequence</code> specifying the text * if part and index are valid. Otherwise, null is returned. * * @see AccessibleText#CHARACTER * @see AccessibleText#WORD * @see AccessibleText#SENTENCE */ public AccessibleTextSequence getTextSequenceAt(int part, int index); /** * Returns the <code>AccessibleTextSequence</code> after a given index. * * @param part the <code>CHARACTER</code>, <code>WORD</code>, * <code>SENTENCE</code>, <code>LINE</code> or <code>ATTRIBUTE_RUN</code> * to retrieve * @param index an index within the text * @return an <code>AccessibleTextSequence</code> specifying the text * if part and index are valid. Otherwise, null is returned. * * @see AccessibleText#CHARACTER * @see AccessibleText#WORD * @see AccessibleText#SENTENCE */ public AccessibleTextSequence getTextSequenceAfter(int part, int index); /** * Returns the <code>AccessibleTextSequence</code> before a given index. * * @param part the <code>CHARACTER</code>, <code>WORD</code>, * <code>SENTENCE</code>, <code>LINE</code> or <code>ATTRIBUTE_RUN</code> * to retrieve * @param index an index within the text * @return an <code>AccessibleTextSequence</code> specifying the text * if part and index are valid. Otherwise, null is returned. * * @see AccessibleText#CHARACTER * @see AccessibleText#WORD * @see AccessibleText#SENTENCE */ public AccessibleTextSequence getTextSequenceBefore(int part, int index); /** * Returns the bounding rectangle of the text between two indices. * * @param startIndex the start index in the text * @param endIndex the end index in the text * @return the bounding rectangle of the text if the indices are valid. * Otherwise, null is returned. */ public Rectangle getTextBounds(int startIndex, int endIndex); }