[cp-patches] Stub TextLayout

Thomas Fitzsimmons fitzsim at redhat.com
Thu Jun 8 14:16:44 UTC 2006


Sven de Marothy wrote:
> Time to remove this unnecessary peer interface and replace the stub peer
> with a stubbed actual impl. Yay! This makes our JAPI scores more honest.
> 
> Ok?

Yes, go ahead.

Tom

> 
> /Sven
> 
> 2006-06-08  Sven de Marothy  <sven at physto.se>
> 
> 	* java/awt/font/TextLayout: Replace methods with stubs.
> 	* gnu/java/awt/peer/gtk/GtkToolkit.java:
> 	( getClasspathTextLayoutPeer ): Remove method.
> 
> 
> ------------------------------------------------------------------------
> 
> Index: gnu/java/awt/ClasspathToolkit.java
> ===================================================================
> RCS file: /sources/classpath/classpath/gnu/java/awt/ClasspathToolkit.java,v
> retrieving revision 1.19
> diff -U3 -r1.19 ClasspathToolkit.java
> --- gnu/java/awt/ClasspathToolkit.java	2 Sep 2005 09:15:22 -0000	1.19
> +++ gnu/java/awt/ClasspathToolkit.java	8 Jun 2006 00:51:46 -0000
> @@ -41,7 +41,6 @@
>  import gnu.java.awt.EmbeddedWindow;
>  import gnu.java.awt.peer.ClasspathFontPeer;
>  import gnu.java.awt.peer.EmbeddedWindowPeer;
> -import gnu.java.awt.peer.ClasspathTextLayoutPeer;
>  import gnu.java.security.action.SetAccessibleAction;
>  
>  import java.awt.AWTException;
> @@ -120,10 +119,6 @@
>     */
>    public abstract ClasspathFontPeer getClasspathFontPeer (String name, Map attrs); 
>  
> -  public abstract ClasspathTextLayoutPeer 
> -  getClasspathTextLayoutPeer (AttributedString str, FontRenderContext frc); 
> -
> -
>    /** 
>     * Creates a {@link Font}, in a platform-specific manner.
>     * 
> Index: gnu/java/awt/peer/gtk/GtkToolkit.java
> ===================================================================
> RCS file: /sources/classpath/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java,v
> retrieving revision 1.87
> diff -U3 -r1.87 GtkToolkit.java
> --- gnu/java/awt/peer/gtk/GtkToolkit.java	5 Jun 2006 13:47:04 -0000	1.87
> +++ gnu/java/awt/peer/gtk/GtkToolkit.java	8 Jun 2006 00:51:46 -0000
> @@ -42,7 +42,6 @@
>  import gnu.classpath.Configuration;
>  import gnu.java.awt.EmbeddedWindow;
>  import gnu.java.awt.peer.ClasspathFontPeer;
> -import gnu.java.awt.peer.ClasspathTextLayoutPeer;
>  import gnu.java.awt.peer.EmbeddedWindowPeer;
>  
>  import java.awt.*;
> @@ -528,12 +527,6 @@
>        }
>    }
>  
> -  public ClasspathTextLayoutPeer getClasspathTextLayoutPeer (AttributedString str, 
> -                                                             FontRenderContext frc)
> -  {
> -    return new GdkTextLayout(str, frc);
> -  }
> -
>    protected EventQueue getSystemEventQueueImpl() 
>    {
>      synchronized (GtkToolkit.class)
> Index: java/awt/font/TextLayout.java
> ===================================================================
> RCS file: /sources/classpath/classpath/java/awt/font/TextLayout.java,v
> retrieving revision 1.7
> diff -U3 -r1.7 TextLayout.java
> --- java/awt/font/TextLayout.java	2 Jul 2005 20:32:29 -0000	1.7
> +++ java/awt/font/TextLayout.java	8 Jun 2006 00:51:46 -0000
> @@ -39,7 +39,6 @@
>  package java.awt.font;
>  
>  import gnu.java.awt.ClasspathToolkit;
> -import gnu.java.awt.peer.ClasspathTextLayoutPeer;
>  
>  import java.awt.Font;
>  import java.awt.Graphics2D;
> @@ -57,276 +56,287 @@
>  public final class TextLayout implements Cloneable
>  {
>    public static final CaretPolicy DEFAULT_CARET_POLICY = new CaretPolicy ();
> -  ClasspathTextLayoutPeer peer;
> -
> -  public static class CaretPolicy
> -  {
> -    public CaretPolicy ()
> -    {
> -      // Do nothing here.
> -    }
> -
> -    public TextHitInfo getStrongCaret (TextHitInfo hit1, TextHitInfo hit2,
> -                                       TextLayout layout)
> -    {
> -      return layout.peer.getStrongCaret(hit1, hit2);
> -    }
> -  }
>  
>    public TextLayout (AttributedCharacterIterator text, FontRenderContext frc)
> -  {    
> -    AttributedString as = new AttributedString (text);
> -    ClasspathToolkit tk = (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
> -    peer = tk.getClasspathTextLayoutPeer(as, frc);
> +    throws NotImplementedException
> +  {
> +    throw new Error ("not implemented");
>    }
>  
>    public TextLayout (String string, Font font, FontRenderContext frc) 
> +    throws NotImplementedException
>    {
> -    AttributedString as = new AttributedString (string);
> -    as.addAttribute (TextAttribute.FONT, font);
> -    ClasspathToolkit tk = (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
> -    peer = tk.getClasspathTextLayoutPeer(as, frc);
> +    throw new Error ("not implemented");
>    }
>  
>    public TextLayout (String string, Map attributes, FontRenderContext frc)  
> +    throws NotImplementedException
>    {
> -    AttributedString as = new AttributedString (string, attributes);
> -    ClasspathToolkit tk = (ClasspathToolkit)(Toolkit.getDefaultToolkit ());
> -    peer = tk.getClasspathTextLayoutPeer(as, frc);
> +    throw new Error ("not implemented");
>    }
>  
>    protected Object clone ()
> +    throws NotImplementedException
>    {
> -    try
> -      {
> -        TextLayout tl = (TextLayout) super.clone ();
> -        tl.peer = (ClasspathTextLayoutPeer) this.peer.clone();
> -        return tl;
> -      }
> -    catch (CloneNotSupportedException e)
> -      {
> -        // This should never occur
> -        throw new InternalError ();
> -      }
> +    throw new Error ("not implemented");
>    }
>  
>  
>    public void draw (Graphics2D g2, float x, float y) 
> +    throws NotImplementedException
>    {
> -    peer.draw(g2, x, y);
> +    throw new Error ("not implemented");
>    }
>  
>    public boolean equals (Object obj)
> +    throws NotImplementedException
>    {
> -    if (! (obj instanceof TextLayout))
> -      return false;
> -
> -    return equals ((TextLayout) obj);
> +    throw new Error ("not implemented");
>    }
>  
>    public boolean equals (TextLayout tl)
> +    throws NotImplementedException
>    {
> -    return this.peer.equals(tl.peer);
> +    throw new Error ("not implemented");
>    }
>  
>    public float getAdvance ()
> +    throws NotImplementedException
>    {
> -    return peer.getAdvance();
> +    throw new Error ("not implemented");
>    }
>  
>    public float getAscent ()
> +    throws NotImplementedException
>    {
> -    return peer.getAscent();
> +    throw new Error ("not implemented");
>    }
>  
>    public byte getBaseline ()
> +    throws NotImplementedException
>    {
> -    return peer.getBaseline();
> +    throw new Error ("not implemented");
>    }
>  
>    public float[] getBaselineOffsets ()
> +    throws NotImplementedException
>    {
> -    return peer.getBaselineOffsets();
> +    throw new Error ("not implemented");
>    }
>  
>    public Shape getBlackBoxBounds (int firstEndpoint, int secondEndpoint)
> +    throws NotImplementedException
>    {
> -    return peer.getBlackBoxBounds(firstEndpoint, secondEndpoint);
> +    throw new Error ("not implemented");
>    }
>  
>    public Rectangle2D getBounds()
> +    throws NotImplementedException
>    {
> -    return peer.getBounds();
> +    throw new Error ("not implemented");
>    }
>  
>    public float[] getCaretInfo (TextHitInfo hit)
> +    throws NotImplementedException
>    {
> -    return getCaretInfo(hit, getBounds());
> +    throw new Error ("not implemented");
>    }
>  
>    public float[] getCaretInfo (TextHitInfo hit, Rectangle2D bounds)
> +    throws NotImplementedException
>    {
> -    return peer.getCaretInfo(hit, bounds);
> +    throw new Error ("not implemented");
>    }
>  
>    public Shape getCaretShape (TextHitInfo hit)
> +    throws NotImplementedException
>    {
> -    return getCaretShape(hit, getBounds());
> +    throw new Error ("not implemented");
>    }
>  
>    public Shape getCaretShape (TextHitInfo hit, Rectangle2D bounds)
> +    throws NotImplementedException
>    {
> -    return peer.getCaretShape(hit, bounds);
> +    throw new Error ("not implemented");
>    }
>  
>    public Shape[] getCaretShapes (int offset)
> +    throws NotImplementedException
>    {
> -    return getCaretShapes(offset, getBounds());
> +    throw new Error ("not implemented");
>    }
>  
>    public Shape[] getCaretShapes (int offset, Rectangle2D bounds)
> +    throws NotImplementedException
>    {
> -    return getCaretShapes(offset, getBounds(), DEFAULT_CARET_POLICY);
> +    throw new Error ("not implemented");
>    }
>  
>    public Shape[] getCaretShapes (int offset, Rectangle2D bounds,
>                                   TextLayout.CaretPolicy policy)
> +    throws NotImplementedException
>    {
> -    return peer.getCaretShapes(offset, bounds, policy);
> +    throw new Error ("not implemented");
>    }
>  
>    public int getCharacterCount ()
> +    throws NotImplementedException
>    {
> -    return peer.getCharacterCount();
> +    throw new Error ("not implemented");
>    }
>  
>    public byte getCharacterLevel (int index)
> +    throws NotImplementedException
>    {
> -    return peer.getCharacterLevel(index);
> +    throw new Error ("not implemented");
>    }
>  
>    public float getDescent ()
> +    throws NotImplementedException
>    {
> -    return peer.getDescent();
> +    throw new Error ("not implemented");
>    }
>  
>    public TextLayout getJustifiedLayout (float justificationWidth)
> +    throws NotImplementedException
>    {
> -    return peer.getJustifiedLayout(justificationWidth);
> +    throw new Error ("not implemented");
>    }
>  
>    public float getLeading ()
> +    throws NotImplementedException
>    {
> -    return peer.getLeading();
> +    throw new Error ("not implemented");
>    }
>  
>    public Shape getLogicalHighlightShape (int firstEndpoint, int secondEndpoint)
> +    throws NotImplementedException
>    {
> -    return getLogicalHighlightShape (firstEndpoint, secondEndpoint, getBounds());
> +    throw new Error ("not implemented");
>    }
>  
>    public Shape getLogicalHighlightShape (int firstEndpoint, int secondEndpoint,
>                                           Rectangle2D bounds)
> +    throws NotImplementedException
>    {
> -    return peer.getLogicalHighlightShape(firstEndpoint, secondEndpoint, bounds);
> +    throw new Error ("not implemented");
>    }
>  
>    public int[] getLogicalRangesForVisualSelection (TextHitInfo firstEndpoint,
>                                                     TextHitInfo secondEndpoint)
> +    throws NotImplementedException
>    {
> -    return peer.getLogicalRangesForVisualSelection(firstEndpoint, secondEndpoint);
> +    throw new Error ("not implemented");
>    }
>  
>    public TextHitInfo getNextLeftHit (int offset)
> +    throws NotImplementedException
>    {
> -    return getNextLeftHit(offset, DEFAULT_CARET_POLICY);
> +    throw new Error ("not implemented");
>    }
>  
>    public TextHitInfo getNextLeftHit (int offset, TextLayout.CaretPolicy policy)
> +    throws NotImplementedException
>    {
> -    return peer.getNextLeftHit(offset, policy);
> +    throw new Error ("not implemented");
>    }
>  
>    public TextHitInfo getNextLeftHit (TextHitInfo hit)
> +    throws NotImplementedException
>    {
> -    return getNextLeftHit(hit.getCharIndex());
> +    throw new Error ("not implemented");
>    }
>  
>    public TextHitInfo getNextRightHit (int offset)
> +    throws NotImplementedException
>    {
> -    return getNextRightHit(offset, DEFAULT_CARET_POLICY);
> +    throw new Error ("not implemented");
>    }
>  
>    public TextHitInfo getNextRightHit (int offset, TextLayout.CaretPolicy policy)
> +    throws NotImplementedException
>    {
> -    return peer.getNextRightHit(offset, policy);
> +    throw new Error ("not implemented");
>    }
>  
>    public TextHitInfo getNextRightHit (TextHitInfo hit)
> +    throws NotImplementedException
>    {
> -    return getNextRightHit(hit.getCharIndex());
> +    throw new Error ("not implemented");
>    }
>  
>    public Shape getOutline (AffineTransform tx)
> +    throws NotImplementedException
>    {
> -    return peer.getOutline(tx);
> +    throw new Error ("not implemented");
>    }
>  
>    public float getVisibleAdvance ()
> +    throws NotImplementedException
>    {
> -    return peer.getVisibleAdvance();
> +    throw new Error ("not implemented");
>    }
>  
>    public Shape getVisualHighlightShape (TextHitInfo firstEndpoint,
>                                          TextHitInfo secondEndpoint)
> +    throws NotImplementedException
>    {
> -    return getVisualHighlightShape(firstEndpoint, secondEndpoint, getBounds());
> +    throw new Error ("not implemented");
>    }
>  
>    public Shape getVisualHighlightShape (TextHitInfo firstEndpoint,
>                                          TextHitInfo secondEndpoint,
>                                          Rectangle2D bounds)
> +    throws NotImplementedException
>    {
> -    return peer.getVisualHighlightShape(firstEndpoint, secondEndpoint, bounds);
> +    throw new Error ("not implemented");
>    }
>  
>    public TextHitInfo getVisualOtherHit (TextHitInfo hit)
> +    throws NotImplementedException
>    {
> -    return peer.getVisualOtherHit(hit);
> +    throw new Error ("not implemented");
>    }
>  
>    protected void handleJustify (float justificationWidth)
> +    throws NotImplementedException
>    {
> -    peer.handleJustify(justificationWidth);
> +    throw new Error ("not implemented");
>    }
>  
>    public int hashCode ()
> +    throws NotImplementedException
>    {
> -    return peer.hashCode();
> +    throw new Error ("not implemented");
>    }
>  
>    public TextHitInfo hitTestChar (float x, float y)
> +    throws NotImplementedException
>    {
> -    return hitTestChar(x, y, getBounds());
> +    throw new Error ("not implemented");
>    }
>  
>    public TextHitInfo hitTestChar (float x, float y, Rectangle2D bounds)
> +    throws NotImplementedException
>    {
> -    return peer.hitTestChar(x, y, bounds);
> +    throw new Error ("not implemented");
>    }
>  
>    public boolean isLeftToRight ()
> +    throws NotImplementedException
>    {
> -    return peer.isLeftToRight();
> +    throw new Error ("not implemented");
>    }
>  
>    public boolean isVertical ()
> +    throws NotImplementedException
>    {
> -    return peer.isVertical();
> +    throw new Error ("not implemented");
>    }
>  
>    public String toString ()
> +    throws NotImplementedException
>    {
> -    return peer.toString();
> +    throw new Error ("not implemented");
>    }
>  }




More information about the Classpath-patches mailing list