[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: text fixes for swing

Kaffe CVS cvs-commits at kaffe.org
Wed Jan 26 05:30:18 PST 2005


PatchSet 5916 
Date: 2005/01/26 13:24:53
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: text fixes for swing

2005-01-26  Dalibor Topic  <robilad at kaffe.org>

        Resynced with GNU Classpath.

        2005-01-24  Michael Koch  <konqueror at gmx.de>

        * javax/swing/plaf/basic/BasicTextUI.java
        (RootView.modelToView): Made it public and return a java.awt.Shape.
        Handle null subview.
        (uninstall): Set textComponent to null when its not possible used
        anymore.
        * javax/swing/text/View.java
        (setParent): Use better argument name.
        (getContainer): Get parent via getParent().
        (getViewFactory): Likewise.
        (getAttributes): Get element via getElement().
        (getStartOffset): Likewise.
        (getEndOffset): Likewise.
        (getResizeWeight): New method.
        (getMaximumSpan): Likewise.
        (getMinimumSpan): Likewise.
        (setSize): Likewise.
        (getGraphics): Likewise.

Members: 
	ChangeLog:1.3455->1.3456 
	libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java:1.9->1.10 
	libraries/javalib/javax/swing/text/View.java:1.5->1.6 

cvs rdiff: [13:29:47] waiting for robilad's lock in /home/cvs/kaffe/kaffe
cvs rdiff: [13:30:17] obtained lock in /home/cvs/kaffe/kaffe
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3455 kaffe/ChangeLog:1.3456
--- kaffe/ChangeLog:1.3455	Wed Jan 26 13:20:20 2005
+++ kaffe/ChangeLog	Wed Jan 26 13:24:53 2005
@@ -2,6 +2,30 @@
 
         Resynced with GNU Classpath.
 
+	2005-01-24  Michael Koch  <konqueror at gmx.de>
+
+        * javax/swing/plaf/basic/BasicTextUI.java
+        (RootView.modelToView): Made it public and return a java.awt.Shape.
+        Handle null subview.
+        (uninstall): Set textComponent to null when its not possible used
+        anymore.
+        * javax/swing/text/View.java
+        (setParent): Use better argument name.
+        (getContainer): Get parent via getParent().
+        (getViewFactory): Likewise.
+        (getAttributes): Get element via getElement().
+        (getStartOffset): Likewise.
+        (getEndOffset): Likewise.
+        (getResizeWeight): New method.
+        (getMaximumSpan): Likewise.
+        (getMinimumSpan): Likewise.
+        (setSize): Likewise.
+        (getGraphics): Likewise.
+
+2005-01-26  Dalibor Topic  <robilad at kaffe.org>
+
+        Resynced with GNU Classpath.
+
 	2005-01-24  Graydon Hoare  <graydon at redhat.com>
 	            Michael Koch  <konqueror at gmx.de>
 
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java:1.9 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java:1.10
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java:1.9	Sun Dec 12 01:35:14 2004
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java	Wed Jan 26 13:24:57 2005
@@ -1,5 +1,5 @@
-/* BasicTextUI.java
-   Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
+/* BasicTextUI.java --
+   Copyright (C) 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -104,6 +104,8 @@
       super(null);
     }
 
+    // View methods.
+
     public ViewFactory getViewFactory()
     {
       // FIXME: Handle EditorKit somehow.
@@ -140,9 +142,12 @@
 	view.paint(g, s);
     }
 
-    protected Rectangle modelToView(int position, Shape a, Position.Bias bias)
+    public Shape modelToView(int position, Shape a, Position.Bias bias)
       throws BadLocationException
     {
+      if (view == null)
+	return null;
+      
       return ((PlainView) view).modelToView(position, a, bias).getBounds();
     }
   }
@@ -327,11 +332,12 @@
     rootView.setView(null);
 
     textComponent.removePropertyChangeListener(updateHandler);
-    textComponent = null;
 
     uninstallDefaults();
     uninstallListeners();
     uninstallKeyboardActions();
+
+    textComponent = null;
   }
 
   protected void uninstallDefaults()
@@ -442,13 +448,13 @@
 
   public View create(Element elem)
   {
-    // subclasses have to implement this to get this functionality
+    // Subclasses have to implement this to get this functionality.
     return null;
   }
 
   public View create(Element elem, int p0, int p1)
   {
-    // subclasses have to implement this to get this functionality
+    // Subclasses have to implement this to get this functionality.
     return null;
   }
   
Index: kaffe/libraries/javalib/javax/swing/text/View.java
diff -u kaffe/libraries/javalib/javax/swing/text/View.java:1.5 kaffe/libraries/javalib/javax/swing/text/View.java:1.6
--- kaffe/libraries/javalib/javax/swing/text/View.java:1.5	Sun Oct 24 13:39:24 2004
+++ kaffe/libraries/javalib/javax/swing/text/View.java	Wed Jan 26 13:24:58 2005
@@ -1,5 +1,5 @@
 /* View.java -- 
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -35,6 +35,7 @@
 obligated to do so.  If you do not wish to do so, delete this
 exception statement from your version. */
 
+
 package javax.swing.text;
 
 import java.awt.Container;
@@ -69,9 +70,9 @@
 
   public abstract void paint(Graphics g, Shape s);
 
-  public void setParent(View a)
+  public void setParent(View parent)
   {
-    parent = a;
+    this.parent = parent;
   }
     
   public View getParent()
@@ -87,6 +88,7 @@
 
   public Container getContainer()
   {
+    View parent = getParent();
     return parent != null ? parent.getContainer() : null;
   }
   
@@ -101,6 +103,32 @@
   }
 
   public abstract float getPreferredSpan(int axis);
+
+  public int getResizeWeight(int axis)
+  {
+    return 0;
+  }
+
+  public float getMaximumSpan(int axis)
+  {
+    if (getResizeWeight(axis) <= 0)
+      return getPreferredSpan(axis);
+
+    return Integer.MAX_VALUE;
+  }
+
+  public float getMinimumSpan(int axis)
+  {
+    if (getResizeWeight(axis) <= 0)
+      return getPreferredSpan(axis);
+
+    return Integer.MAX_VALUE;
+  }
+  
+  public void setSize(float width, float height)
+  {
+    // The default implementation does nothing.
+  }
   
   public float getAlignment(int axis)
   {
@@ -109,7 +137,7 @@
 
   public AttributeSet getAttributes()
   {
-    return elt.getAttributes();
+    return getElement().getAttributes();
   }
   
   public boolean isVisible()
@@ -129,6 +157,7 @@
 
   public ViewFactory getViewFactory()
   {
+    View parent = getParent();
     return parent != null ? parent.getViewFactory() : null;
   }
 
@@ -167,12 +196,12 @@
 
   public int getStartOffset()
   {
-    return elt.getStartOffset();
+    return getElement().getStartOffset();
   }
 
   public int getEndOffset()
   {
-    return elt.getEndOffset();
+    return getElement().getEndOffset();
   }
 
   public Shape getChildAllocation(int index, Shape a)
@@ -204,6 +233,14 @@
       return getView(index).getToolTipText(x, y, childAllocation);
 
     return null;
+  }
+
+  /**
+   * @since 1.3
+   */
+  public Graphics getGraphics()
+  {
+    return getContainer().getGraphics();
   }
 }
 




More information about the kaffe mailing list