Path: blob/master/src/java.desktop/share/classes/javax/accessibility/AccessibleExtendedText.java
41153 views
/*1* Copyright (c) 2003, 2017, 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;2627import java.awt.Rectangle;2829/**30* The {@code AccessibleExtendedText} interface contains additional methods not31* provided by the {@code AccessibleText} interface.32* <p>33* Applications can determine if an object supports the34* {@code AccessibleExtendedText} interface by first obtaining its35* {@code AccessibleContext} (see {@link Accessible}) and then calling the36* {@link AccessibleContext#getAccessibleText} method of37* {@code AccessibleContext}. If the return value is an instance of38* {@code AccessibleExtendedText}, the object supports this interface.39*40* @author Peter Korn41* @author Lynn Monsanto42* @see Accessible43* @see Accessible#getAccessibleContext44* @see AccessibleContext45* @see AccessibleContext#getAccessibleText46* @since 1.547*/48public interface AccessibleExtendedText {4950/**51* Constant used to indicate that the part of the text that should be52* retrieved is a line of text.53*54* @see AccessibleText#getAtIndex55* @see AccessibleText#getAfterIndex56* @see AccessibleText#getBeforeIndex57*/58public static final int LINE = 4; // BugID: 48497205960/**61* Constant used to indicate that the part of the text that should be62* retrieved is contiguous text with the same text attributes.63*64* @see AccessibleText#getAtIndex65* @see AccessibleText#getAfterIndex66* @see AccessibleText#getBeforeIndex67*/68public static final int ATTRIBUTE_RUN = 5; // BugID: 48497206970/**71* Returns the text between two indices.72*73* @param startIndex the start index in the text74* @param endIndex the end index in the text75* @return the text string if the indices are valid. Otherwise, {@code null}76* is returned.77*/78public String getTextRange(int startIndex, int endIndex);7980/**81* Returns the {@code AccessibleTextSequence} at a given index.82*83* @param part the {@code CHARACTER}, {@code WORD}, {@code SENTENCE},84* {@code LINE} or {@code ATTRIBUTE_RUN} to retrieve85* @param index an index within the text86* @return an {@code AccessibleTextSequence} specifying the text if87* {@code part} and {@code index} are valid. Otherwise, {@code null}88* is returned.89* @see AccessibleText#CHARACTER90* @see AccessibleText#WORD91* @see AccessibleText#SENTENCE92*/93public AccessibleTextSequence getTextSequenceAt(int part, int index);9495/**96* Returns the {@code AccessibleTextSequence} after a given index.97*98* @param part the {@code CHARACTER}, {@code WORD}, {@code SENTENCE},99* {@code LINE} or {@code ATTRIBUTE_RUN} to retrieve100* @param index an index within the text101* @return an {@code AccessibleTextSequence} specifying the text if102* {@code part} and {@code index} are valid. Otherwise, {@code null}103* is returned.104* @see AccessibleText#CHARACTER105* @see AccessibleText#WORD106* @see AccessibleText#SENTENCE107*/108public AccessibleTextSequence getTextSequenceAfter(int part, int index);109110/**111* Returns the {@code AccessibleTextSequence} before a given index.112*113* @param part the {@code CHARACTER}, {@code WORD}, {@code SENTENCE},114* {@code LINE} or {@code ATTRIBUTE_RUN} to retrieve115* @param index an index within the text116* @return an {@code AccessibleTextSequence} specifying the text if117* {@code part} and {@code index} are valid. Otherwise, {@code null}118* is returned.119* @see AccessibleText#CHARACTER120* @see AccessibleText#WORD121* @see AccessibleText#SENTENCE122*/123public AccessibleTextSequence getTextSequenceBefore(int part, int index);124125/**126* Returns the bounding rectangle of the text between two indices.127*128* @param startIndex the start index in the text129* @param endIndex the end index in the text130* @return the bounding rectangle of the text if the indices are valid.131* Otherwise, {@code null} is returned.132*/133public Rectangle getTextBounds(int startIndex, int endIndex);134}135136137