/[classpath]/classpath/javax/swing/plaf/TextUI.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/TextUI.java

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

revision 1.3 by egagnon, Sun Aug 11 20:08:43 2002 UTC revision 1.4 by brawer, Thu Jun 26 07:05:09 2003 UTC
# Line 1  Line 1 
1  /* TextUI.java  /* TextUI.java
2     Copyright (C) 2002 Free Software Foundation, Inc.     Copyright (C) 2002, 2003 Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 38  exception statement from your version. * Line 38  exception statement from your version. *
38    
39  package javax.swing.plaf;  package javax.swing.plaf;
40    
41  import javax.swing.text.*;  import java.awt.Point;
42  import java.awt.*;  import java.awt.Rectangle;
43    import javax.swing.text.BadLocationException;
44    import javax.swing.text.EditorKit;
45    import javax.swing.text.JTextComponent;
46    import javax.swing.text.Position;
47    import javax.swing.text.View;
48    
49  public abstract class TextUI extends ComponentUI  
50    /**
51     * An abstract base class for delegates that provide the user
52     * interface for text editors.
53     *
54     * @see javax.swing.text.JTextComponent
55     *
56     * @author Ronald Veldema (rveldema@cs.vu.nl)
57     * @author Sascha Brawer (brawer@dandelis.ch)
58     */
59    public abstract class TextUI
60      extends ComponentUI
61  {  {
62      public TextUI()    /**
63      {     * Constructs a new <code>TextUI</code>.
64      }     */  
65      public TextUI()
66      public abstract  void damageRange(JTextComponent t, int p0, int p1);    {
67      public abstract  void damageRange(JTextComponent t, int p0, int p1, Position.Bias firstBias, Position.Bias secondBias);    }
68      public abstract  EditorKit getEditorKit(JTextComponent t);  
69      public abstract  int getNextVisualPositionFrom(JTextComponent t,  
70                                              int pos,    /**
71                                              Position.Bias b,     * Calculates the geometric extent of the character at the
72                                              int direction,     * given offset.
73                                              Position.Bias[] biasRet);     *
74      public abstract  View getRootView(JTextComponent t);     * @param tc the <code>JTextComponent</code> for which this
75      public abstract  Rectangle modelToView(JTextComponent t, int pos);     *        delegate object provides the user interface.
76      public abstract  Rectangle modelToView(JTextComponent t, int pos, Position.Bias bias);     *
77      public abstract  int viewToModel(JTextComponent t, Point pt);     * @param pos the zero-based index of the character into the
78      public abstract  int viewToModel(JTextComponent t, Point pt, Position.Bias[] biasReturn);     *        document model.
79       *
80       * @return the bounding box of the character at index
81       *         <code>pos</code>, in view coordinates.
82       *
83       * @throws BadLocationException if <code>pos</code> does not
84       *         designate a valid position in the document model.
85       *
86       * @see javax.swing.text.View#modelToView(int,
87       *      javax.swing.text.Position.Bias, int,
88       *      javax.swing.text.position.Bias, java.awt.Shape)
89       */
90      public abstract Rectangle modelToView(JTextComponent tc, int pos)
91        throws BadLocationException;
92    
93    
94      /**
95       * Calculates the geometric extent of the character at the
96       * given offset.
97       *
98       * @param tc the <code>JTextComponent</code> for which this
99       *        delegate object provides the user interface.
100       *
101       * @param pos the zero-based index of the character into the
102       *        document model.
103       *
104       * @param bias whether to take the character before or after the
105       *        caret position indicated by <code>pos</code>.  The value
106       *        must be either {@link
107       *        javax.swing.text.Position.Bias#Backward} or {@link
108       *        javax.swing.text.Position.Bias#Forward}.
109       *
110       * @return the bounding box of the character at index
111       *         <code>pos</code>, in view coordinates.
112       *
113       * @throws BadLocationException if <code>pos</code> does not
114       *         designate a valid position in the document model.
115       *
116       * @see javax.swing.text.View#modelToView(int,
117       *      javax.swing.text.Position.Bias, int,
118       *      javax.swing.text.position.Bias, java.awt.Shape)
119       */
120      public abstract Rectangle modelToView(JTextComponent tc, int pos,
121                                            Position.Bias bias)
122        throws BadLocationException;
123    
124    
125      /**
126       * Finds the caret position which is closest to the specified visual
127       * location.
128       *
129       * @param tc the <code>JTextComponent</code> for which this
130       *        delegate object provides the user interface.
131       *
132       * @param loc the position in view coordinates.
133       *
134       * @return the caret position which is closest to <code>loc</code>.
135       *
136       * @see #viewToModel(JTextComponent, Point, Position.Bias[])
137       */
138      public abstract int viewToModel(JTextComponent t, Point pt);
139    
140    
141      /**
142       * Finds the caret position which is closest to the specified visual
143       * location.
144       *
145       * @param tc the <code>JTextComponent</code> for which this
146       *        delegate object provides the user interface.
147       *
148       * @param loc the position in view coordinates.
149       *
150       * @param outBias an array whose size must be at least one.
151       *        After the call, <code>outBias[0]</code> will indicate
152       *        whether <code>loc</code> is in the glyph before
153       *        (<code>Position.Bias.Backward</code>) or after
154       *        (<code>Position.Bias.Forward</code>) the returned
155       *        caret position.
156       *
157       * @return the caret position which is closest to <code>loc</code>.
158       */
159      public abstract int viewToModel(JTextComponent tc, Point loc,
160                                      Position.Bias[] outBias);
161    
162    
163    
164      /**
165       * Calculates the caret position that is visually next to the given
166       * position. This is useful to determine where to move the caret
167       * after the user has pressed an arrow key.
168       *
169       * @param tc the <code>JTextComponent</code> for which this
170       *        delegate object provides the user interface.
171       *
172       * @param pos the current caret position, a zero-based index
173       *        into the document model.
174       *
175       * @param bias whether to take the character before or after the
176       *        caret position indicated by <code>pos</code>.  The value
177       *        must be either {@link
178       *        javax.swing.text.Position.Bias#Backward} or {@link
179       *        javax.swing.text.Position.Bias#Forward}.
180       *
181       * @param direction the visual direction. Pass
182       *        {@link javax.swing.SwingConstants#WEST} for the left
183       *        arrow key, {@link javax.swing.SwingConstants#EAST}
184       *        for the right arrow key, {@link
185       *        javax.swing.SwingConstants#NORTH} for the up arrow
186       *        key, or {@link javax.swing.SwingConstants#SOUTH}
187       *        for the down arrow key.
188       */
189      public abstract int getNextVisualPositionFrom(JTextComponent tc,
190                                                    int pos,
191                                                    Position.Bias bias,
192                                                    int direction,
193                                                    Position.Bias[] outBias);
194    
195    
196      /**
197       * Repaints a range of characters.
198       *
199       * @param tc the <code>JTextComponent</code> for which this
200       *        delegate object provides the user interface.
201       *
202       * @param start the first character in the range that needs
203       *        painting, indicated as an index into the document model.
204       *
205       * @param end the last character in the range that needs
206       *        painting, indicated as an index into the document model.
207       *        <code>end</code> must be greater than or equal to
208       *        <code>start</code>.
209       */
210      public abstract void damageRange(JTextComponent tc, int start, int end);
211    
212    
213      /**
214       * Repaints a range of characters, also specifying the bias for the
215       * start and end of the range.
216       *
217       * @param tc the <code>JTextComponent</code> for which this
218       *        delegate object provides the user interface.
219       *
220       * @param start the first character in the range that needs
221       *        painting, indicated as an index into the document model.
222       *
223       * @param end the last character in the range that needs
224       *        painting, indicated as an index into the document model.
225       *        <code>end</code> must be greater than or equal to
226       *        <code>start</code>.
227       */
228      public abstract void damageRange(JTextComponent tc,
229                                       int start, int end,
230                                       Position.Bias startBias,
231                                       Position.Bias endBias);
232    
233      
234      /**
235       * Retrieves the <code>EditorKit</code> managing policies and
236       * persistent state.
237       *
238       * @param tc the <code>JTextComponent</code> for which this
239       *        delegate object provides the user interface.
240       *
241       * @return the <code>EditorKit</code> used by <code>tc</code>.
242       */
243      public abstract EditorKit getEditorKit(JTextComponent tc);
244      
245      
246      /**
247       * Retrieves the root of the view tree that visually presents
248       * the text.
249       *
250       * @param tc the <code>JTextComponent</code> for which this
251       *        delegate object provides the user interface.
252       *
253       * @return the root <code>View</code> used by <code>tc</code>.
254       */
255      public abstract View getRootView(JTextComponent tc);
256    
257    
258      /**
259       * Returns a String for presenting a tool tip at the specified
260       * location.
261       *
262       * @param tc the <code>JTextComponent</code> for which this
263       *        delegate object provides the user interface.
264       *
265       * @param loc the location for which the tool tip is requested.
266       *
267       * @return the text for the tool tip, or <code>null</code> to
268       *         display no tool tip.
269       *
270       * @since 1.4
271       */
272      public String getToolTipText(JTextComponent tc, Point loc)
273      {
274        return null;
275      }
276  }  }

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

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