[kaffe] CVS kaffe (robilad): Resynced with GNU classpath: JTable fixes

Kaffe CVS cvs-commits at kaffe.org
Sun Oct 3 16:27:11 PDT 2004


PatchSet 5238 
Date: 2004/10/03 23:23:01
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU classpath: JTable fixes

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

        * libraries/javalib/javax/swing/JTable.java:
        Resynced with GNU Classpath.

        2004-09-27  Michael Koch  <konqueror at gmx.de>

        * javax/swing/JTable.java
        (setModel): Reimplemented.

        2004-09-27  Michael Koch  <konqueror at gmx.de>

        * javax/swing/JTextArea.java
        (insert): Renaming of method local variables.

Members: 
	ChangeLog:1.2792->1.2793 
	libraries/javalib/javax/swing/JTable.java:1.5->1.6 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2792 kaffe/ChangeLog:1.2793
--- kaffe/ChangeLog:1.2792	Sat Oct  2 18:00:18 2004
+++ kaffe/ChangeLog	Sun Oct  3 23:23:01 2004
@@ -1,3 +1,18 @@
+2004-10-03  Dalibor Topic  <robilad at kaffe.org>
+
+	* libraries/javalib/javax/swing/JTable.java:
+	Resynced with GNU Classpath.
+
+	2004-09-27  Michael Koch  <konqueror at gmx.de>
+
+        * javax/swing/JTable.java
+        (setModel): Reimplemented.
+	
+	2004-09-27  Michael Koch  <konqueror at gmx.de>
+
+        * javax/swing/JTextArea.java
+        (insert): Renaming of method local variables.
+
 2004-10-02  Dalibor Topic  <robilad at kaffe.org>
 
 	* test/regression/TestScript.in:
Index: kaffe/libraries/javalib/javax/swing/JTable.java
diff -u kaffe/libraries/javalib/javax/swing/JTable.java:1.5 kaffe/libraries/javalib/javax/swing/JTable.java:1.6
--- kaffe/libraries/javalib/javax/swing/JTable.java:1.5	Tue Sep 28 22:45:30 2004
+++ kaffe/libraries/javalib/javax/swing/JTable.java	Sun Oct  3 23:23:04 2004
@@ -1148,16 +1148,32 @@
    */ 
   public void setModel(TableModel m)
   {
+    // Throw exception is m is null.
     if (m == null)
       throw new IllegalArgumentException();
-    TableModel tmp = dataModel;
-    if (autoCreateColumnsFromModel)
-      createColumnsFromModel();
-    if (tmp != null)
-      tmp.removeTableModelListener(this);
+   
+    // Don't do anything if setting the current model again.
+    if (dataModel == m)
+      return;
+    
+    // Remove table as TableModelListener from old model.
+    if (dataModel != null)
+      dataModel.removeTableModelListener(this);
+    
     if (m != null)
-      m.addTableModelListener(this);
-    dataModel = m;
+      {
+	// Set property.
+        dataModel = m;
+
+	// Add table as TableModelListener to new model.
+	dataModel.addTableModelListener(this);
+
+	// Automatically create columns.
+	if (autoCreateColumnsFromModel)
+	  createColumnsFromModel();
+      }
+    
+    // Repaint table.
     revalidate();
     repaint();
   }




More information about the kaffe mailing list