Hi,

I implemented two methods in javax.swing.text.View:

2005-10-10  Roman Kennke  <[EMAIL PROTECTED]>

        * javax/swing/text/View.java
        (modelToView(pos, Shape)): New method.
        (viewToModel(float, float, Shape)): New method.

/Roman
Index: javax/swing/text/View.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/text/View.java,v
retrieving revision 1.21
diff -u -r1.21 View.java
--- javax/swing/text/View.java	6 Oct 2005 20:16:32 -0000	1.21
+++ javax/swing/text/View.java	10 Oct 2005 19:28:44 -0000
@@ -507,6 +507,30 @@
   }
 
   /**
+   * Maps a position in the document into the coordinate space of the View.
+   * The output rectangle usually reflects the font height but has a width
+   * of zero.
+   *
+   * This method is deprecated and calls
+   * [EMAIL PROTECTED] #modelToView(int, Position.Bias, int, Position.Bias, Shape)} with
+   * a bias of [EMAIL PROTECTED] Position.Bias#Forward}.
+   *
+   * @param pos the position of the character in the model
+   * @param a the area that is occupied by the view
+   *
+   * @return a rectangle that gives the location of the document position
+   *         inside the view coordinate space
+   *
+   * @throws BadLocationException if <code>pos</code> is invalid
+   *
+   * @deprecated Use [EMAIL PROTECTED] #modelToView(int, Shape, Position.Bias)} instead.
+   */
+  public Shape modelToView(int pos, Shape a) throws BadLocationException
+  {
+    return modelToView(pos, a, Position.Bias.Forward);
+  }
+
+  /**
    * Maps coordinates from the <code>View</code>'s space into a position
    * in the document model.
    *
@@ -520,6 +544,25 @@
    */
   public abstract int viewToModel(float x, float y, Shape a, Position.Bias[] b);
 
+  /**
+   * Maps coordinates from the <code>View</code>'s space into a position
+   * in the document model. This method is deprecated and only there for
+   * compatibility.
+   *
+   * @param x the x coordinate in the view space
+   * @param y the y coordinate in the view space
+   * @param a the allocation of this <code>View</code>
+   *
+   * @return the position in the document that corresponds to the screen
+   *         coordinates <code>x, y</code>
+   *
+   * @deprecated Use [EMAIL PROTECTED] #viewToModel(float, float, Shape, Position.Bias[])}
+   *             instead.
+   */
+  public int viewToModel(float x, float y, Shape a)
+  {
+    return viewToModel(x, y, a, new Position.Bias[0]);
+  }
 
   /**
    * Dumps the complete View hierarchy. This method can be used for debugging
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to