Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/accessibility/AccessibleExtendedText.java
38829 views
/*1* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.accessibility;262728import java.util.*;29import java.awt.*;30import javax.swing.text.*;313233/**34* <P>The AccessibleExtendedText interface contains additional methods35* not provided by the AccessibleText interface36*37* Applications can determine if an object supports the AccessibleExtendedText38* interface by first obtaining its AccessibleContext (see {@link Accessible})39* and then calling the {@link AccessibleContext#getAccessibleText} method of40* AccessibleContext. If the return value is an instance of41* AccessibleExtendedText, the object supports this interface.42*43* @see Accessible44* @see Accessible#getAccessibleContext45* @see AccessibleContext46* @see AccessibleContext#getAccessibleText47*48* @author Peter Korn49* @author Lynn Monsanto50* @since 1.551*/52public interface AccessibleExtendedText {5354/**55* Constant used to indicate that the part of the text that should be56* retrieved is a line of text.57*58* @see AccessibleText#getAtIndex59* @see AccessibleText#getAfterIndex60* @see AccessibleText#getBeforeIndex61*/62public static final int LINE = 4; // BugID: 48497206364/**65* Constant used to indicate that the part of the text that should be66* retrieved is contiguous text with the same text attributes.67*68* @see AccessibleText#getAtIndex69* @see AccessibleText#getAfterIndex70* @see AccessibleText#getBeforeIndex71*/72public static final int ATTRIBUTE_RUN = 5; // BugID: 48497207374/**75* Returns the text between two indices76*77* @param startIndex the start index in the text78* @param endIndex the end index in the text79* @return the text string if the indices are valid.80* Otherwise, null is returned.81*/82public String getTextRange(int startIndex, int endIndex);8384/**85* Returns the <code>AccessibleTextSequence</code> at a given index.86*87* @param part the <code>CHARACTER</code>, <code>WORD</code>,88* <code>SENTENCE</code>, <code>LINE</code> or <code>ATTRIBUTE_RUN</code>89* to retrieve90* @param index an index within the text91* @return an <code>AccessibleTextSequence</code> specifying the text92* if part and index are valid. Otherwise, null is returned.93*94* @see AccessibleText#CHARACTER95* @see AccessibleText#WORD96* @see AccessibleText#SENTENCE97*/98public AccessibleTextSequence getTextSequenceAt(int part, int index);99100/**101* Returns the <code>AccessibleTextSequence</code> after a given index.102*103* @param part the <code>CHARACTER</code>, <code>WORD</code>,104* <code>SENTENCE</code>, <code>LINE</code> or <code>ATTRIBUTE_RUN</code>105* to retrieve106* @param index an index within the text107* @return an <code>AccessibleTextSequence</code> specifying the text108* if part and index are valid. Otherwise, null is returned.109*110* @see AccessibleText#CHARACTER111* @see AccessibleText#WORD112* @see AccessibleText#SENTENCE113*/114public AccessibleTextSequence getTextSequenceAfter(int part, int index);115116/**117* Returns the <code>AccessibleTextSequence</code> before a given index.118*119* @param part the <code>CHARACTER</code>, <code>WORD</code>,120* <code>SENTENCE</code>, <code>LINE</code> or <code>ATTRIBUTE_RUN</code>121* to retrieve122* @param index an index within the text123* @return an <code>AccessibleTextSequence</code> specifying the text124* if part and index are valid. Otherwise, null is returned.125*126* @see AccessibleText#CHARACTER127* @see AccessibleText#WORD128* @see AccessibleText#SENTENCE129*/130public AccessibleTextSequence getTextSequenceBefore(int part, int index);131132/**133* Returns the bounding rectangle of the text between two indices.134*135* @param startIndex the start index in the text136* @param endIndex the end index in the text137* @return the bounding rectangle of the text if the indices are valid.138* Otherwise, null is returned.139*/140public Rectangle getTextBounds(int startIndex, int endIndex);141}142143144