AccessibleEditableText.java revision 10444:f08705540498
1/*
2 * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package javax.accessibility;
27
28import java.util.*;
29import java.awt.*;
30import javax.swing.text.*;
31
32/**
33 * <P>The AccessibleEditableText interface should be implemented by all
34 * classes that present editable textual information on the display.
35 * Along with the AccessibleText interface, this interface provides
36 * the standard mechanism for an assistive technology to access
37 * that text via its content, attributes, and spatial location.
38 * Applications can determine if an object supports the AccessibleEditableText
39 * interface by first obtaining its AccessibleContext (see {@link Accessible})
40 * and then calling the {@link AccessibleContext#getAccessibleEditableText}
41 * method of AccessibleContext.  If the return value is not null, the object
42 * supports this interface.
43 *
44 * @see Accessible
45 * @see Accessible#getAccessibleContext
46 * @see AccessibleContext
47 * @see AccessibleContext#getAccessibleText
48 * @see AccessibleContext#getAccessibleEditableText
49 *
50 * @author      Lynn Monsanto
51 * @since 1.4
52 */
53
54public interface AccessibleEditableText extends AccessibleText {
55
56    /**
57     * Sets the text contents to the specified string.
58     *
59     * @param s the string to set the text contents
60     */
61    public void setTextContents(String s);
62
63    /**
64     * Inserts the specified string at the given index/
65     *
66     * @param index the index in the text where the string will
67     * be inserted
68     * @param s the string to insert in the text
69     */
70    public void insertTextAtIndex(int index, String s);
71
72    /**
73     * Returns the text string between two indices.
74     *
75     * @param startIndex the starting index in the text
76     * @param endIndex the ending index in the text
77     * @return the text string between the indices
78     */
79    public String getTextRange(int startIndex, int endIndex);
80
81    /**
82     * Deletes the text between two indices
83     *
84     * @param startIndex the starting index in the text
85     * @param endIndex the ending index in the text
86     */
87    public void delete(int startIndex, int endIndex);
88
89    /**
90     * Cuts the text between two indices into the system clipboard.
91     *
92     * @param startIndex the starting index in the text
93     * @param endIndex the ending index in the text
94     */
95    public void cut(int startIndex, int endIndex);
96
97    /**
98     * Pastes the text from the system clipboard into the text
99     * starting at the specified index.
100     *
101     * @param startIndex the starting index in the text
102     */
103    public void paste(int startIndex);
104
105    /**
106     * Replaces the text between two indices with the specified
107     * string.
108     *
109     * @param startIndex the starting index in the text
110     * @param endIndex the ending index in the text
111     * @param s the string to replace the text between two indices
112     */
113    public void replaceText(int startIndex, int endIndex, String s);
114
115    /**
116     * Selects the text between two indices.
117     *
118     * @param startIndex the starting index in the text
119     * @param endIndex the ending index in the text
120     */
121    public void selectText(int startIndex, int endIndex);
122
123    /**
124     * Sets attributes for the text between two indices.
125     *
126     * @param startIndex the starting index in the text
127     * @param endIndex the ending index in the text
128     * @param as the attribute set
129     * @see AttributeSet
130     */
131    public void setAttributes(int startIndex, int endIndex, AttributeSet as);
132
133}
134