/[classpath]/classpath/javax/accessibility/AccessibleText.java
ViewVC logotype

Diff of /classpath/javax/accessibility/AccessibleText.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by mark, Tue Jan 22 22:27:02 2002 UTC revision 1.5 by ericb, Mon Mar 18 22:22:45 2002 UTC
# Line 1  Line 1 
1  /* AccessibleText.java -- Java interface for aiding in accessibly rendering  /* AccessibleText.java -- aids in accessibly manipulating text
2     other Java components     Copyright (C) 2000, 2002 Free Software Foundation, Inc.
    Copyright (C) 2000 Free Software Foundation, Inc.  
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 8  GNU Classpath is free software; you can Line 7  GNU Classpath is free software; you can
7  it under the terms of the GNU General Public License as published by  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2, or (at your option)  the Free Software Foundation; either version 2, or (at your option)
9  any later version.  any later version.
10    
11  GNU Classpath is distributed in the hope that it will be useful, but  GNU Classpath is distributed in the hope that it will be useful, but
12  WITHOUT ANY WARRANTY; without even the implied warranty of  WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Line 36  this exception to your version of the li Line 35  this exception to your version of the li
35  obligated to do so.  If you do not wish to do so, delete this  obligated to do so.  If you do not wish to do so, delete this
36  exception statement from your version. */  exception statement from your version. */
37    
38    
39  package javax.accessibility;  package javax.accessibility;
40    
 import javax.swing.text.AttributeSet;  
41  import java.awt.Rectangle;  import java.awt.Rectangle;
42  import java.awt.Point;  import java.awt.Point;
43    // XXX Waiting on javax.swing support.
44    // import javax.swing.text.AttributeSet;
45    
46  public interface AccessibleText {  /**
47      public static final int CHARACTER = 1;   * Objects which present textual information on the display should implement
48      public static final int WORD = 2;   * this interface.  Accessibility software can use the implementations of
49      public static final int SENTENCE = 3;   * this interface to change the attributes and spacial location of the text.
50      public abstract String getAfterIndex(int part, int index);   *
51      public abstract String getAtIndex(int part, int index);   * <p>The <code>AccessibleContext.getAccessibleText()</code> method
52      public abstract String getBeforeIndex(int part, int index);   * should return <code>null</code> if an object does not implement this
53      public abstract int getCaretPosition();   * interface.
54      public abstract int getCharCount();   *
55      public abstract AttributeSet getCharacterAttribute(int index);   * @author Eric Blake <ebb9@email.byu.edu>
56      public abstract Rectangle getCharacterBounds(int index);   * @see Accessible
57      public abstract int getIndexAtPoint(Point point);   * @see AccessibleContext
58      public abstract String getSelectedText();   * @see AccessibleContext#getAccessibleText()
59      public abstract int getSelectionEnd();   * @since 1.2
60      public abstract int getSelectionStart();   * @status updated to 1.4, except for javax.swing support
61  }   */
62    public interface AccessibleText
63    {
64      /**
65       * Constant designating that the next selection should be a character.
66       *
67       * @see #getAtIndex(int, int)
68       * @see #getAfterIndex(int, int)
69       * @see #getBeforeIndex(int, int)
70       */
71      int CHARACTER = 1;
72    
73      /**
74       * Constant designating that the next selection should be a word.
75       *
76       * @see #getAtIndex(int, int)
77       * @see #getAfterIndex(int, int)
78       * @see #getBeforeIndex(int, int)
79       */
80      int WORD = 2;
81    
82      /**
83       * Constant designating that the next selection should be a sentence.
84       *
85       * @see #getAtIndex(int, int)
86       * @see #getAfterIndex(int, int)
87       * @see #getBeforeIndex(int, int)
88       */
89      int SENTENCE = 3;
90    
91      /**
92       * Given a point in the coordinate system of this object, return the
93       * 0-based index of the character at that point, or -1 if there is none.
94       *
95       * @param p the point to look at
96       * @return the character index, or -1
97       */
98      int getIndexAtPoint(Point point);
99    
100      /**
101       * Determines the bounding box of the indexed character. Returns an empty
102       * rectangle if the index is out of bounds.
103       *
104       * @param index the 0-based character index
105       * @return the bounding box, may be empty
106       */
107      Rectangle getCharacterBounds(int index);
108    
109      /**
110       * Return the number of characters.
111       *
112       * @return the character count
113       */
114      int getCharCount();
115    
116      /**
117       * Return the offset of the character. The offset matches the index of the
118       * character to the right, since the carat lies between characters.
119       *
120       * @return the 0-based caret position
121       */
122      int getCaretPosition();
123    
124      /**
125       * Returns the section of text at the index, or null if the index or part
126       * is invalid.
127       *
128       * @param part {@link CHARACTER}, {@link WORD}, or {@link SENTENCE}
129       * @param index the 0-based character index
130       * @return the selection of text at that index, or null
131       */
132      String getAtIndex(int part, int index);
133    
134      /**
135       * Returns the section of text after the index, or null if the index or part
136       * is invalid.
137       *
138       * @param part {@link CHARACTER}, {@link WORD}, or {@link SENTENCE}
139       * @param index the 0-based character index
140       * @return the selection of text after that index, or null
141       */
142      String getAfterIndex(int part, int index);
143    
144      /**
145       * Returns the section of text before the index, or null if the index or part
146       * is invalid.
147       *
148       * @param part {@link CHARACTER}, {@link WORD}, or {@link SENTENCE}
149       * @param index the 0-based character index
150       * @return the selection of text before that index, or null
151       */
152      String getBeforeIndex(int part, int index);
153    
154      /**
155       * Returns the attributes of a character at an index, or null if the index
156       * is out of bounds.
157       *
158       * @param index the 0-based character index
159       * @return the character's attributes
160       */
161      // XXX Waiting on javax.swing support.
162      //  AttributeSet getCharacterAttribute(int index);
163    
164      /**
165       * Returns the start index of the selection. If there is no selection, this
166       * is the same as the caret location.
167       *
168       * @return the 0-based character index of the selection start
169       */
170      int getSelectionStart();
171    
172      /**
173       * Returns the end index of the selection. If there is no selection, this
174       * is the same as the caret location.
175       *
176       * @return the 0-based character index of the selection end
177       */
178      int getSelectionEnd();
179    
180      /**
181       * Returns the selected text. This may be null or "" if no text is selected.
182       *
183       * @return the selected text
184       */
185      String getSelectedText();
186    } // interface AccessibleText

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26