KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > accessibility > AccessibleExtendedText


1 /*
2  * @(#)AccessibleExtendedText.java 1.2 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7  
8 package javax.accessibility;
9  
10  
11 import java.util.*;
12 import java.awt.*;
13 import javax.swing.text.*;
14  
15  
16 /**
17  * <P>The AccessibleExtendedText interface contains additional methods
18  * not provided by the AccessibleText interface
19  *
20  * Applications can determine if an object supports the AccessibleExtendedText
21  * interface by first obtaining its AccessibleContext (see {@link Accessible})
22  * and then calling the {@link AccessibleContext#getAccessibleText} method of
23  * AccessibleContext. If the return value is an instance of
24  * AccessibleExtendedText, the object supports this interface.
25  *
26  * @see Accessible
27  * @see Accessible#getAccessibleContext
28  * @see AccessibleContext
29  * @see AccessibleContext#getAccessibleText
30  * @see AccessibleText.AccessibleTextChunk
31  *
32  * @version 1.2 12/19/03
33  * @author Peter Korn
34  * @author Lynn Monsanto
35  */

36 public interface AccessibleExtendedText {
37  
38     /**
39      * Constant used to indicate that the part of the text that should be
40      * retrieved is a line of text.
41      *
42      * @see #getAtIndex
43      * @see #getAfterIndex
44      * @see #getBeforeIndex
45      */

46     public static final int LINE = 4; // BugID: 4849720
47

48     /**
49      * Constant used to indicate that the part of the text that should be
50      * retrieved is contiguous text with the same text attributes.
51      *
52      * @see #getAtIndex
53      * @see #getAfterIndex
54      * @see #getBeforeIndex
55      */

56     public static final int ATTRIBUTE_RUN = 5; // BugID: 4849720
57

58     /**
59      * Returns the text between two indices
60      *
61      * @param startIndex the start index in the text
62      * @param endIndex the end index in the text
63      * @return the text string if the indices are valid.
64      * Otherwise, null is returned.
65      */

66     public String JavaDoc getTextRange(int startIndex, int endIndex);
67  
68     /**
69      * Returns the AccessibleTextSequence at a given index.
70      *
71      * @param part the CHARACTER, WORD, SENTENCE, LINE or ATTRIBUTE_RUN to
72      * retrieve
73      * @param index an index within the text
74      * @return an AccessibleTextSequence specifying the text if part and index
75      * are valid. Otherwise, null is returned.
76      *
77      * @see AccessibleText.CHARACTER
78      * @see AccessibleText.WORK
79      * @see AccessibleText.SENTENCE
80      */

81     public AccessibleTextSequence JavaDoc getTextSequenceAt(int part, int index);
82  
83     /**
84      * Returns the AccessibleTextSequence after a given index.
85      *
86      * @param part the CHARACTER, WORD, SENTENCE, LINE or ATTRIBUTE_RUN to
87      * retrieve
88      * @param index an index within the text
89      * @return an AccessibleTextSequence specifying the text if part and index
90      * are valid. Otherwise, null is returned.
91      *
92      * @see AccessibleText.CHARACTER
93      * @see AccessibleText.WORK
94      * @see AccessibleText.SENTENCE
95      */

96     public AccessibleTextSequence JavaDoc getTextSequenceAfter(int part, int index);
97  
98     /**
99      * Returns the AccessibleTextSequence before a given index.
100      *
101      * @param part the CHARACTER, WORD, SENTENCE, LINE or ATTRIBUTE_RUN to
102      * retrieve
103      * @param index an index within the text
104      * @return an AccessibleTextSequence specifying the text if part and index
105      * are valid. Otherwise, null is returned.
106      *
107      * @see AccessibleText.CHARACTER
108      * @see AccessibleText.WORK
109      * @see AccessibleText.SENTENCE
110      */

111     public AccessibleTextSequence JavaDoc getTextSequenceBefore(int part, int index);
112  
113     /**
114      * Returns the bounding rectangle of the text between two indices.
115      *
116      * @param startIndex the start index in the text
117      * @param endIndex the end index in the text
118      * @return the bounding rectangle of the text if the indices are valid.
119      * Otherwise, null is returned.
120      */

121     public Rectangle getTextBounds(int startIndex, int endIndex);
122 }
123  
124
Popular Tags