author | ddehaven |
Tue, 19 Aug 2014 10:32:16 -0700 | |
changeset 26037 | 508779ce6619 |
parent 26013 | jdk/src/share/classes/javax/swing/plaf/TextUI.java@83b99f14245f |
parent 25859 | jdk/src/share/classes/javax/swing/plaf/TextUI.java@3317bb8137f4 |
child 39553 | 965a62655c4c |
permissions | -rw-r--r-- |
2 | 1 |
/* |
26013
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
2 |
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 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 |
* |
|
5506 | 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. |
|
2 | 24 |
*/ |
25 |
package javax.swing.plaf; |
|
26 |
||
27 |
import javax.swing.Action; |
|
28 |
import javax.swing.BoundedRangeModel; |
|
29 |
import java.awt.Point; |
|
30 |
import java.awt.Rectangle; |
|
31 |
import java.awt.Insets; |
|
32 |
import javax.swing.text.*; |
|
33 |
||
34 |
/** |
|
35 |
* Text editor user interface |
|
36 |
* |
|
37 |
* @author Timothy Prinzing |
|
38 |
*/ |
|
39 |
public abstract class TextUI extends ComponentUI |
|
40 |
{ |
|
41 |
/** |
|
42 |
* Converts the given location in the model to a place in |
|
43 |
* the view coordinate system. |
|
44 |
* |
|
26013
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
45 |
* @param t the text component for which this UI is installed |
20158
1c5d22e5b898
8025117: [cleanup] Eliminate doclint errors in javax/swing/text classes
yan
parents:
5506
diff
changeset
|
46 |
* @param pos the local location in the model to translate >= 0 |
26013
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
47 |
* @return the coordinates as a {@code Rectangle} |
2 | 48 |
* @exception BadLocationException if the given position does not |
49 |
* represent a valid location in the associated document |
|
50 |
*/ |
|
51 |
public abstract Rectangle modelToView(JTextComponent t, int pos) throws BadLocationException; |
|
52 |
||
53 |
/** |
|
54 |
* Converts the given location in the model to a place in |
|
55 |
* the view coordinate system. |
|
56 |
* |
|
26013
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
57 |
* @param t the text component for which this UI is installed |
20158
1c5d22e5b898
8025117: [cleanup] Eliminate doclint errors in javax/swing/text classes
yan
parents:
5506
diff
changeset
|
58 |
* @param pos the local location in the model to translate >= 0 |
26013
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
59 |
* @param bias the bias for the position |
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
60 |
* @return the coordinates as a {@code Rectangle} |
2 | 61 |
* @exception BadLocationException if the given position does not |
62 |
* represent a valid location in the associated document |
|
63 |
*/ |
|
64 |
public abstract Rectangle modelToView(JTextComponent t, int pos, Position.Bias bias) throws BadLocationException; |
|
65 |
||
66 |
/** |
|
67 |
* Converts the given place in the view coordinate system |
|
68 |
* to the nearest representative location in the model. |
|
69 |
* |
|
26013
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
70 |
* @param t the text component for which this UI is installed |
2 | 71 |
* @param pt the location in the view to translate. This |
72 |
* should be in the same coordinate system as the mouse |
|
73 |
* events. |
|
20158
1c5d22e5b898
8025117: [cleanup] Eliminate doclint errors in javax/swing/text classes
yan
parents:
5506
diff
changeset
|
74 |
* @return the offset from the start of the document >= 0 |
2 | 75 |
*/ |
76 |
public abstract int viewToModel(JTextComponent t, Point pt); |
|
77 |
||
78 |
/** |
|
79 |
* Provides a mapping from the view coordinate space to the logical |
|
80 |
* coordinate space of the model. |
|
81 |
* |
|
26013
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
82 |
* @param t the text component for which this UI is installed |
2 | 83 |
* @param pt the location in the view to translate. |
84 |
* This should be in the same coordinate system |
|
85 |
* as the mouse events. |
|
86 |
* @param biasReturn |
|
87 |
* filled in by this method to indicate whether |
|
88 |
* the point given is closer to the previous or the next |
|
89 |
* character in the model |
|
90 |
* |
|
91 |
* @return the location within the model that best represents the |
|
20158
1c5d22e5b898
8025117: [cleanup] Eliminate doclint errors in javax/swing/text classes
yan
parents:
5506
diff
changeset
|
92 |
* given point in the view >= 0 |
2 | 93 |
*/ |
94 |
public abstract int viewToModel(JTextComponent t, Point pt, |
|
95 |
Position.Bias[] biasReturn); |
|
96 |
||
97 |
/** |
|
98 |
* Provides a way to determine the next visually represented model |
|
99 |
* location that one might place a caret. Some views may not be visible, |
|
100 |
* they might not be in the same order found in the model, or they just |
|
101 |
* might not allow access to some of the locations in the model. |
|
102 |
* |
|
103 |
* @param t the text component for which this UI is installed |
|
20158
1c5d22e5b898
8025117: [cleanup] Eliminate doclint errors in javax/swing/text classes
yan
parents:
5506
diff
changeset
|
104 |
* @param pos the position to convert >= 0 |
2 | 105 |
* @param b the bias for the position |
106 |
* @param direction the direction from the current position that can |
|
107 |
* be thought of as the arrow keys typically found on a keyboard. |
|
108 |
* This may be SwingConstants.WEST, SwingConstants.EAST, |
|
109 |
* SwingConstants.NORTH, or SwingConstants.SOUTH |
|
110 |
* @param biasRet an array to contain the bias for the returned position |
|
111 |
* @return the location within the model that best represents the next |
|
112 |
* location visual position |
|
22260
c9185e010e03
8031082: Fix non-missing doclint problems in client libraries
darcy
parents:
20158
diff
changeset
|
113 |
* @exception BadLocationException for a bad location within a document model |
2 | 114 |
* @exception IllegalArgumentException for an invalid direction |
115 |
*/ |
|
116 |
public abstract int getNextVisualPositionFrom(JTextComponent t, |
|
117 |
int pos, Position.Bias b, |
|
118 |
int direction, Position.Bias[] biasRet) |
|
119 |
throws BadLocationException; |
|
120 |
||
121 |
/** |
|
122 |
* Causes the portion of the view responsible for the |
|
123 |
* given part of the model to be repainted. |
|
124 |
* |
|
26013
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
125 |
* @param t the text component for which this UI is installed |
20158
1c5d22e5b898
8025117: [cleanup] Eliminate doclint errors in javax/swing/text classes
yan
parents:
5506
diff
changeset
|
126 |
* @param p0 the beginning of the range >= 0 |
1c5d22e5b898
8025117: [cleanup] Eliminate doclint errors in javax/swing/text classes
yan
parents:
5506
diff
changeset
|
127 |
* @param p1 the end of the range >= p0 |
2 | 128 |
*/ |
129 |
public abstract void damageRange(JTextComponent t, int p0, int p1); |
|
130 |
||
131 |
/** |
|
132 |
* Causes the portion of the view responsible for the |
|
133 |
* given part of the model to be repainted. |
|
134 |
* |
|
26013
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
135 |
* @param t the text component for which this UI is installed |
20158
1c5d22e5b898
8025117: [cleanup] Eliminate doclint errors in javax/swing/text classes
yan
parents:
5506
diff
changeset
|
136 |
* @param p0 the beginning of the range >= 0 |
1c5d22e5b898
8025117: [cleanup] Eliminate doclint errors in javax/swing/text classes
yan
parents:
5506
diff
changeset
|
137 |
* @param p1 the end of the range >= p0 |
26013
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
138 |
* @param firstBias the bias of the first character position, toward the |
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
139 |
* previous character or the next character |
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
140 |
* @param secondBias the bias of the second character position, toward the |
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
141 |
* previous character or the next character |
2 | 142 |
*/ |
143 |
public abstract void damageRange(JTextComponent t, int p0, int p1, |
|
144 |
Position.Bias firstBias, |
|
145 |
Position.Bias secondBias); |
|
146 |
||
147 |
/** |
|
148 |
* Fetches the binding of services that set a policy |
|
149 |
* for the type of document being edited. This contains |
|
150 |
* things like the commands available, stream readers and |
|
151 |
* writers, etc. |
|
152 |
* |
|
26013
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
153 |
* @param t the text component for which this UI is installed |
2 | 154 |
* @return the editor kit binding |
155 |
*/ |
|
156 |
public abstract EditorKit getEditorKit(JTextComponent t); |
|
157 |
||
158 |
/** |
|
159 |
* Fetches a View with the allocation of the associated |
|
160 |
* text component (i.e. the root of the hierarchy) that |
|
161 |
* can be traversed to determine how the model is being |
|
162 |
* represented spatially. |
|
163 |
* |
|
26013
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
164 |
* @param t the text component for which this UI is installed |
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
165 |
* @return a {@code View} with the allocation of the associated |
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
166 |
* text component |
2 | 167 |
*/ |
168 |
public abstract View getRootView(JTextComponent t); |
|
169 |
||
170 |
/** |
|
171 |
* Returns the string to be used as the tooltip at the passed in location. |
|
172 |
* |
|
26013
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
173 |
* @param t the text component for which this UI is installed |
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
174 |
* @param pt a {@code Point} specifying location for which to get a tooltip |
83b99f14245f
8042284: Add block tags for @return and @param to swing plaf classes
ssides
parents:
22260
diff
changeset
|
175 |
* @return a {@code String} containing the tooltip |
2 | 176 |
* @see javax.swing.text.JTextComponent#getToolTipText |
177 |
* @since 1.4 |
|
178 |
*/ |
|
179 |
public String getToolTipText(JTextComponent t, Point pt) { |
|
180 |
return null; |
|
181 |
} |
|
182 |
} |