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

Kaffe CVS cvs-commits at kaffe.org
Fri Dec 3 18:42:34 PST 2004


PatchSet 5535 
Date: 2004/12/04 02:38:16
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: swing fixes

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

        *  libraries/javalib/javax/swing/AbstractListModel.java,
        libraries/javalib/javax/swing/DefaultSingleSelectionModel.java,
        libraries/javalib/javax/swing/JPopupMenu.java:
        Resynced with GNU Classpath.

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

        * javax/swing/AbstractListModel.java
        (fireContentsChanged): Simplified.
        (fireIntervalAdded): Likewise.
        (fireIntervalRemoved): Likewise.
        * javax/swing/DefaultSingleSelectionModel.java:
        Reformatted.
        (fireStateChanged): Simplified.
        * javax/swing/JPopupMenu.java
        (setSelectionModel): Set property.

Members: 
	ChangeLog:1.3081->1.3082 
	libraries/javalib/javax/swing/AbstractListModel.java:1.2->1.3 
	libraries/javalib/javax/swing/DefaultSingleSelectionModel.java:1.3->1.4 
	libraries/javalib/javax/swing/JPopupMenu.java:1.5->1.6 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3081 kaffe/ChangeLog:1.3082
--- kaffe/ChangeLog:1.3081	Sat Dec  4 02:11:20 2004
+++ kaffe/ChangeLog	Sat Dec  4 02:38:16 2004
@@ -1,5 +1,24 @@
 2004-12-03  Dalibor Topic  <robilad at kaffe.org>
 
+	*  libraries/javalib/javax/swing/AbstractListModel.java,
+	libraries/javalib/javax/swing/DefaultSingleSelectionModel.java,
+	libraries/javalib/javax/swing/JPopupMenu.java:
+        Resynced with GNU Classpath.
+
+	2004-12-01  Michael Koch  <konqueror at gmx.de>
+
+        * javax/swing/AbstractListModel.java
+        (fireContentsChanged): Simplified.
+        (fireIntervalAdded): Likewise.
+        (fireIntervalRemoved): Likewise.
+        * javax/swing/DefaultSingleSelectionModel.java:
+        Reformatted.
+        (fireStateChanged): Simplified.
+        * javax/swing/JPopupMenu.java
+        (setSelectionModel): Set property.
+
+2004-12-03  Dalibor Topic  <robilad at kaffe.org>
+
 	* libraries/javalib/gnu/java/nio/SelectorImpl.java:
         Resynced with GNU Classpath.
 
Index: kaffe/libraries/javalib/javax/swing/AbstractListModel.java
diff -u kaffe/libraries/javalib/javax/swing/AbstractListModel.java:1.2 kaffe/libraries/javalib/javax/swing/AbstractListModel.java:1.3
--- kaffe/libraries/javalib/javax/swing/AbstractListModel.java:1.2	Sun Oct 24 13:39:10 2004
+++ kaffe/libraries/javalib/javax/swing/AbstractListModel.java	Sat Dec  4 02:38:18 2004
@@ -100,25 +100,12 @@
   protected void fireContentsChanged(Object source, int startIndex,
                                      int endIndex)
   {
-    // Variables
-    ListDataEvent event;
-    ListDataListener[] listeners;
-    ListDataListener listener;
-    int index;
+    ListDataEvent event = new ListDataEvent(source, ListDataEvent.CONTENTS_CHANGED,
+                                            startIndex, endIndex);
+    ListDataListener[] listeners = getListDataListeners();
 
-    // Create Event
-    event = new ListDataEvent(source, ListDataEvent.CONTENTS_CHANGED,
-                              startIndex, endIndex);
-
-    // Get Listeners
-    listeners = getListDataListeners();
-
-    // Process Listeners
-    for (index = 0; index < listeners.length; index++)
-      {
-        listener = (ListDataListener) listeners[index];
-        listener.contentsChanged(event);
-      }
+    for (int index = 0; index < listeners.length; index++)
+      listeners[index].contentsChanged(event);
   }
 
   /**
@@ -134,25 +121,13 @@
    */
   protected void fireIntervalAdded(Object source, int startIndex, int endIndex)
   {
-    // Variables
-    ListDataEvent event;
-    ListDataListener[] listeners;
-    ListDataListener listener;
-    int index;
-
-    // Create Event
-    event = new ListDataEvent(source, ListDataEvent.INTERVAL_ADDED,
-                              startIndex, endIndex);
+    ListDataEvent event =
+      new ListDataEvent(source, ListDataEvent.INTERVAL_ADDED,
+                       startIndex, endIndex);
+    ListDataListener[] listeners = getListDataListeners();
 
-    // Get Listeners
-    listeners = getListDataListeners();
-
-    // Process Listeners
-    for (index = 0; index < listeners.length; index++)
-      {
-        listener = listeners[index];
-        listener.intervalAdded(event);
-      }
+    for (int index = 0; index < listeners.length; index++)
+      listeners[index].intervalAdded(event);
   }
 
   /**
@@ -169,25 +144,13 @@
   protected void fireIntervalRemoved(Object source, int startIndex,
                                      int endIndex)
   {
-    // Variables
-    ListDataEvent event;
-    ListDataListener[] listeners;
-    ListDataListener listener;
-    int index;
-
-    // Create Event
-    event = new ListDataEvent(source, ListDataEvent.INTERVAL_REMOVED,
-                              startIndex, endIndex);
-
-    // Get Listeners
-    listeners = getListDataListeners();
+    ListDataEvent event =
+      new ListDataEvent(source, ListDataEvent.INTERVAL_REMOVED,
+                       startIndex, endIndex);
+    ListDataListener[] listeners = getListDataListeners();
 
-    // Process Listeners
-    for (index = 0; index < listeners.length; index++)
-      {
-        listener = listeners[index];
-        listener.intervalRemoved(event);
-      }
+    for (int index = 0; index < listeners.length; index++)
+      listeners[index].intervalRemoved(event);
   }
 
   /**
Index: kaffe/libraries/javalib/javax/swing/DefaultSingleSelectionModel.java
diff -u kaffe/libraries/javalib/javax/swing/DefaultSingleSelectionModel.java:1.3 kaffe/libraries/javalib/javax/swing/DefaultSingleSelectionModel.java:1.4
--- kaffe/libraries/javalib/javax/swing/DefaultSingleSelectionModel.java:1.3	Fri Dec  3 00:56:19 2004
+++ kaffe/libraries/javalib/javax/swing/DefaultSingleSelectionModel.java	Sat Dec  4 02:38:18 2004
@@ -47,23 +47,23 @@
 
 /**
  * DefaultSingleSelectionModel
- * @author	Andrew Selkirk
- * @version	1.0
+ *
+ * @author Andrew Selkirk
  */
 public class DefaultSingleSelectionModel
   implements SingleSelectionModel, Serializable
 {
-  static final long serialVersionUID = 3676229404753786004L;
+  private static final long serialVersionUID = 3676229404753786004L;
 
   /**
    * changeEvent
    */
-  protected transient ChangeEvent changeEvent = new ChangeEvent (this);
+  protected transient ChangeEvent changeEvent = new ChangeEvent(this);
 
   /**
    * listenerList
    */
-  protected EventListenerList listenerList= new EventListenerList ();
+  protected EventListenerList listenerList = new EventListenerList();
 
   /**
    * index
@@ -73,15 +73,16 @@
   /**
    * Constructor DefaultSingleSelectionModel
    */
-  public DefaultSingleSelectionModel ()
+  public DefaultSingleSelectionModel()
   {
+    // Do nothing.
   }
 
   /**
    * getSelectedIndex
    * @return int
    */
-  public int getSelectedIndex ()
+  public int getSelectedIndex()
   {
     return index;
   }
@@ -90,34 +91,28 @@
    * setSelectedIndex
    * @param index TODO
    */
-  public void setSelectedIndex (int index)
+  public void setSelectedIndex(int index)
   {
-    // Set Data
     this.index = index;
-
-    // Notify Listeners
-    fireStateChanged ();
+    fireStateChanged();
   }
 
   /**
    * clearSelection
    */
-  public void clearSelection ()
+  public void clearSelection()
   {
-    // Set Data
     index = -1;
-
-    // Notify Listeners
-    fireStateChanged ();
+    fireStateChanged();
   }
 
   /**
    * isSelected
    * @return boolean
    */
-  public boolean isSelected ()
+  public boolean isSelected()
   {
-    return (index != -1);
+    return index != -1;
   }
 
   /**
@@ -125,9 +120,9 @@
    *
    * @param listener the listener to add
    */
-  public void addChangeListener (ChangeListener listener)
+  public void addChangeListener(ChangeListener listener)
   {
-    listenerList.add (ChangeListener.class, listener);
+    listenerList.add(ChangeListener.class, listener);
   }
 
   /**
@@ -135,30 +130,20 @@
    *
    * @param listener the listener to remove
    */
-  public void removeChangeListener (ChangeListener listener)
+  public void removeChangeListener(ChangeListener listener)
   {
-    listenerList.remove (ChangeListener.class, listener);
+    listenerList.remove(ChangeListener.class, listener);
   }
 
   /**
    * fireStateChanged
    */
-  protected void fireStateChanged ()
+  protected void fireStateChanged()
   {
-    // Variables
-    ChangeListener listener;
-    ChangeListener[] listeners;
-    int index;
-
-    // Get Listeners
-    listeners = getChangeListeners ();
-
-    // Process Listeners
-    for (index = 0; index < listeners.length; index++)
-      {
-        listener = listeners [index];
-        listener.stateChanged (changeEvent);
-      }
+    ChangeListener[] listeners = getChangeListeners();
+
+    for (int i = 0; i < listeners.length; i++)
+      listeners[i].stateChanged(changeEvent);
   }
 
   /**
@@ -170,9 +155,9 @@
    *
    * @since 1.3
    */
-  public EventListener[] getListeners (Class listenerClass)
+  public EventListener[] getListeners(Class listenerClass)
   {
-    return listenerList.getListeners (listenerClass);
+    return listenerList.getListeners(listenerClass);
   }
 
   /**
@@ -180,8 +165,8 @@
    *
    * @since 1.4
    */
-  public ChangeListener[] getChangeListeners ()
+  public ChangeListener[] getChangeListeners()
   {
-    return (ChangeListener[]) getListeners (ChangeListener.class);
+    return (ChangeListener[]) getListeners(ChangeListener.class);
   }
 }
Index: kaffe/libraries/javalib/javax/swing/JPopupMenu.java
diff -u kaffe/libraries/javalib/javax/swing/JPopupMenu.java:1.5 kaffe/libraries/javalib/javax/swing/JPopupMenu.java:1.6
--- kaffe/libraries/javalib/javax/swing/JPopupMenu.java:1.5	Sun Oct 24 13:39:11 2004
+++ kaffe/libraries/javalib/javax/swing/JPopupMenu.java	Sat Dec  4 02:38:18 2004
@@ -386,10 +386,7 @@
    */
   public void setSelectionModel(SingleSelectionModel model)
   {
-    if (selectionModel != model)
-      {
-	SingleSelectionModel oldModel = this.selectionModel;
-      }
+	selectionModel = model;
   }
 
   /**




More information about the kaffe mailing list