cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From torehal...@apache.org
Subject svn commit: r480771 - /incubator/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneTableModel.java
Date Wed, 29 Nov 2006 23:48:09 GMT
Author: torehalset
Date: Wed Nov 29 15:48:08 2006
New Revision: 480771

URL: http://svn.apache.org/viewvc?view=rev&rev=480771
Log:
CAY-641: Stack trace instead of error message when relationship and attribute have the same
name
Show JOptionPane if setUpdatedValueAt throws IllegalArgumentException

Modified:
    incubator/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneTableModel.java

Modified: incubator/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneTableModel.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneTableModel.java?view=diff&rev=480771&r1=480770&r2=480771
==============================================================================
--- incubator/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneTableModel.java
(original)
+++ incubator/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneTableModel.java
Wed Nov 29 15:48:08 2006
@@ -28,11 +28,15 @@
 import java.util.Comparator;
 import java.util.List;
 
+import javax.swing.JOptionPane;
 import javax.swing.table.AbstractTableModel;
 
 import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.modeler.Application;
 import org.apache.cayenne.modeler.ProjectController;
 import org.apache.cayenne.util.Util;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * Superclass of CayenneModeler table model classes.
@@ -44,6 +48,8 @@
     protected ProjectController mediator;
     protected Object eventSource;
     protected List objectList;
+    
+    private static Log logObj = LogFactory.getLog(CayenneTableModel.class);
 
     /**
      * Constructor for CayenneTableModel.
@@ -59,8 +65,18 @@
     }
 
     public void setValueAt(Object newVal, int row, int col) {
-        if (!Util.nullSafeEquals(newVal, getValueAt(row, col))) {
-            setUpdatedValueAt(newVal, row, col);
+        try {
+            if (!Util.nullSafeEquals(newVal, getValueAt(row, col))) {
+                setUpdatedValueAt(newVal, row, col);
+            }
+        }
+        catch (IllegalArgumentException e) {
+            logObj.error("Error setting table model value", e);
+            JOptionPane.showMessageDialog(
+                    Application.getFrame(),
+                    e.getMessage(),
+                    "Invalid value",
+                    JOptionPane.ERROR_MESSAGE);
         }
     }
 



Mime
View raw message