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

Kaffe CVS cvs-commits at kaffe.org
Mon Dec 6 11:10:55 PST 2004


PatchSet 5554 
Date: 2004/12/06 19:06:50
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: various swing fixes

2004-12-06  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/javax/swing/DefaultListCellRenderer.java,
        libraries/javalib/javax/swing/JLabel.java,
        libraries/javalib/javax/swing/JList.java:
        Resynced with GNU Classpath.

        2004-12-06  Michael Koch  <konqueror at gmx.de>

        * javax/swing/DefaultListCellRenderer.java
        (serialVersionUID): Made private.
        (getListCellRendererComponent): Set horizontal alignment.
        * javax/swing/JLabel.java
        (setVerticalAlignment): Re-implemented.
        (setHorizontalAlignment): Do nothing if old value = new value.
        * javax/swing/JList.java
        (setCellRenderer): Likewise.
        (setModel): Re-implemented.
        (setSelectionModel): Likewise.

Members: 
	ChangeLog:1.3100->1.3101 
	libraries/javalib/javax/swing/DefaultListCellRenderer.java:1.3->1.4 
	libraries/javalib/javax/swing/JLabel.java:1.4->1.5 
	libraries/javalib/javax/swing/JList.java:1.5->1.6 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3100 kaffe/ChangeLog:1.3101
--- kaffe/ChangeLog:1.3100	Mon Dec  6 19:02:09 2004
+++ kaffe/ChangeLog	Mon Dec  6 19:06:50 2004
@@ -1,5 +1,25 @@
 2004-12-06  Dalibor Topic  <robilad at kaffe.org>
 
+	* libraries/javalib/javax/swing/DefaultListCellRenderer.java,
+	libraries/javalib/javax/swing/JLabel.java,
+	libraries/javalib/javax/swing/JList.java:
+        Resynced with GNU Classpath.
+
+	2004-12-06  Michael Koch  <konqueror at gmx.de>
+
+        * javax/swing/DefaultListCellRenderer.java
+        (serialVersionUID): Made private.
+        (getListCellRendererComponent): Set horizontal alignment.
+        * javax/swing/JLabel.java
+        (setVerticalAlignment): Re-implemented.
+        (setHorizontalAlignment): Do nothing if old value = new value.
+        * javax/swing/JList.java
+        (setCellRenderer): Likewise.
+        (setModel): Re-implemented.
+        (setSelectionModel): Likewise.
+
+2004-12-06  Dalibor Topic  <robilad at kaffe.org>
+
 	* libraries/javalib/java/awt/Component.java,
 	libraries/javalib/java/awt/geom/Rectangle2D.java:
         Resynced with GNU Classpath.
Index: kaffe/libraries/javalib/javax/swing/DefaultListCellRenderer.java
diff -u kaffe/libraries/javalib/javax/swing/DefaultListCellRenderer.java:1.3 kaffe/libraries/javalib/javax/swing/DefaultListCellRenderer.java:1.4
--- kaffe/libraries/javalib/javax/swing/DefaultListCellRenderer.java:1.3	Sun Oct 24 13:39:10 2004
+++ kaffe/libraries/javalib/javax/swing/DefaultListCellRenderer.java	Mon Dec  6 19:06:51 2004
@@ -52,10 +52,10 @@
  * @author Andrew Selkirk
  * @version 1.0
  */
-public class DefaultListCellRenderer extends JLabel implements ListCellRenderer,
-                                                               Serializable
+public class DefaultListCellRenderer extends JLabel
+  implements ListCellRenderer, Serializable
 {
-  static final long serialVersionUID = 7708947179685189462L;
+  private static final long serialVersionUID = 7708947179685189462L;
 
   public static class UIResource extends DefaultListCellRenderer
     implements javax.swing.plaf.UIResource
@@ -89,6 +89,7 @@
     String s = value.toString();
     setText(s);
     setOpaque(true);
+    setHorizontalAlignment(LEFT);
 
     if (isSelected)
       {
Index: kaffe/libraries/javalib/javax/swing/JLabel.java
diff -u kaffe/libraries/javalib/javax/swing/JLabel.java:1.4 kaffe/libraries/javalib/javax/swing/JLabel.java:1.5
--- kaffe/libraries/javalib/javax/swing/JLabel.java:1.4	Sun Oct 24 13:39:11 2004
+++ kaffe/libraries/javalib/javax/swing/JLabel.java	Mon Dec  6 19:06:51 2004
@@ -523,13 +523,13 @@
    */
   public void setVerticalAlignment(int alignment)
   {
-    if (alignment != verticalAlignment)
-      {
-	int oldAlignment = verticalAlignment;
-	verticalAlignment = checkVerticalKey(alignment, "verticalAlignment");
-	firePropertyChange(VERTICAL_ALIGNMENT_CHANGED_PROPERTY, oldAlignment,
-	                   verticalAlignment);
-      }
+    if (alignment == verticalAlignment)
+      return;
+
+    int oldAlignment = verticalAlignment;
+    verticalAlignment = checkVerticalKey(alignment, "verticalAlignment");
+    firePropertyChange(VERTICAL_ALIGNMENT_CHANGED_PROPERTY,
+		       oldAlignment, verticalAlignment);
   }
 
   /**
@@ -550,6 +550,9 @@
    */
   public void setHorizontalAlignment(int alignment)
   {
+    if (horizontalAlignment == alignment)
+      return;
+    
     int oldAlignment = horizontalAlignment;
     horizontalAlignment = checkHorizontalKey(alignment, "horizontalAlignment");
     firePropertyChange(HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, oldAlignment,
Index: kaffe/libraries/javalib/javax/swing/JList.java
diff -u kaffe/libraries/javalib/javax/swing/JList.java:1.5 kaffe/libraries/javalib/javax/swing/JList.java:1.6
--- kaffe/libraries/javalib/javax/swing/JList.java:1.5	Fri Dec  3 14:14:08 2004
+++ kaffe/libraries/javalib/javax/swing/JList.java	Mon Dec  6 19:06:51 2004
@@ -862,13 +862,16 @@
   /**
    * Sets the value of the {@link #celLRenderer} property.
    *
-   * @param cellRenderer The new property value
+   * @param renderer The new property value
    */
-  public void setCellRenderer(ListCellRenderer cr)
+  public void setCellRenderer(ListCellRenderer renderer)
   {
+    if (cellRenderer == renderer)
+      return;
+    
     ListCellRenderer old = cellRenderer;
-    cellRenderer = cr;
-    firePropertyChange(CELL_RENDERER_PROPERTY_CHANGED, old, cr);
+    cellRenderer = renderer;
+    firePropertyChange(CELL_RENDERER_PROPERTY_CHANGED, old, renderer);
     revalidate();
     repaint();
   }
@@ -890,15 +893,21 @@
    *
    * @param model The new property value
    */
-  public void setModel(ListModel m)
+  public void setModel(ListModel model)
   {
-    ListModel old = model;
-    if (old != null)
-      old.removeListDataListener(listListener);
-    model = m;
-    if (model != null)
-      model.addListDataListener(listListener);
-    firePropertyChange(MODEL_PROPERTY_CHANGED, old, m);
+    if (this.model == model)
+      return;
+    
+    if (this.model != null)
+      this.model.removeListDataListener(listListener);
+    
+    ListModel old = this.model;
+    this.model = model;
+    
+    if (this.model != null)
+      this.model.addListDataListener(listListener);
+    
+    firePropertyChange(MODEL_PROPERTY_CHANGED, old, model);
     revalidate();
     repaint();
   }
@@ -914,17 +923,23 @@
    * {@link #listListener} is unsubscribed from the existing selection
    * model, if it exists, and re-subscribed to the new selection model.
    *
-   * @param l The new property value
+   * @param model The new property value
    */
-  public void setSelectionModel(ListSelectionModel l)
+  public void setSelectionModel(ListSelectionModel model)
   {
+    if (selectionModel == model)
+      return;
+    
+    if (selectionModel != null)
+      selectionModel.removeListSelectionListener(listListener);
+    
     ListSelectionModel old = selectionModel;
-    if (old != null)
-      old.removeListSelectionListener(listListener);
-    selectionModel = l;
+    selectionModel = model;
+    
     if (selectionModel != null)
       selectionModel.addListSelectionListener(listListener);
-    firePropertyChange(SELECTION_MODEL_PROPERTY_CHANGED, old, l);
+    
+    firePropertyChange(SELECTION_MODEL_PROPERTY_CHANGED, old, model);
     revalidate();
     repaint();
   }




More information about the kaffe mailing list