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

Kaffe CVS cvs-commits at kaffe.org
Sat Jan 22 10:10:25 PST 2005


PatchSet 5882 
Date: 2005/01/22 18:01:14
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: fixes for DefaultListModel

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

Resynced with GNU Classpath.

2005-01-18 David Gilbert <david.gilbert at object-refinery.com>

* javax/swing/DefaultListModel.java
(add): fire correct event,
(addElement): corrected interval indices in event,
(clear): corrected upper bound for interval, only fire event if
list is not empty,
(setSize): fire appropriate event.

Members: 
	ChangeLog:1.3423->1.3424 
	libraries/javalib/javax/swing/DefaultListModel.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3423 kaffe/ChangeLog:1.3424
--- kaffe/ChangeLog:1.3423	Thu Jan 20 23:27:48 2005
+++ kaffe/ChangeLog	Sat Jan 22 18:01:14 2005
@@ -1,3 +1,16 @@
+2005-01-22  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+
+	2005-01-18 David Gilbert <david.gilbert at object-refinery.com>
+
+	* javax/swing/DefaultListModel.java
+	(add): fire correct event,
+	(addElement): corrected interval indices in event,
+	(clear): corrected upper bound for interval, only fire event if
+	list is not empty,
+	(setSize): fire appropriate event.
+	
 2005-01-20  Kiyo Inaba  <inaba at src.ricoh.co.jp>
 
 	* kaffe/kaffevm/jit/funcs.c,
Index: kaffe/libraries/javalib/javax/swing/DefaultListModel.java
diff -u kaffe/libraries/javalib/javax/swing/DefaultListModel.java:1.1 kaffe/libraries/javalib/javax/swing/DefaultListModel.java:1.2
--- kaffe/libraries/javalib/javax/swing/DefaultListModel.java:1.1	Thu Jul 22 19:37:17 2004
+++ kaffe/libraries/javalib/javax/swing/DefaultListModel.java	Sat Jan 22 18:01:22 2005
@@ -1,5 +1,5 @@
 /* DefaultListModel.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.
 
@@ -198,7 +198,7 @@
   public void add(int index, Object element)
   {
     elements.add(index, element);
-    fireContentsChanged(this, index, index);
+    fireIntervalAdded(this, index, index);
   }
 
   /**
@@ -209,8 +209,9 @@
    */
   public void addElement(Object element)
   {
+    int s = elements.size();
     elements.add(element);
-    fireIntervalAdded(this, elements.size(), elements.size());
+    fireIntervalAdded(this, s, s);
   }
 
   /**
@@ -266,8 +267,12 @@
    */
   public void clear()
   {
-    elements.clear();
-    fireIntervalRemoved(this, 0, elements.size());
+    int s = elements.size();
+    if (s > 0)
+    {
+      elements.clear();
+      fireIntervalRemoved(this, 0, s - 1);
+    }
   }
 
   /**
@@ -341,7 +346,16 @@
    */
   public void setSize(int size)
   {
+    int oldSize = elements.size();
     elements.setSize(size);
+    if (oldSize < size) 
+    {
+      fireIntervalAdded(this, oldSize, size - 1); 
+    }
+    else if (oldSize > size) 
+    {
+      this.fireIntervalRemoved(this, size, oldSize - 1);
+    }
   }
 
   /**



More information about the kaffe mailing list