OSDN Git Service

fire event when value is realy changed
authortama3 <tama3@acee48c3-7b26-0410-bdac-b3d0e5314bbc>
Fri, 5 Oct 2007 04:22:13 +0000 (04:22 +0000)
committertama3 <tama3@acee48c3-7b26-0410-bdac-b3d0e5314bbc>
Fri, 5 Oct 2007 04:22:13 +0000 (04:22 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/stigmata/trunk@237 acee48c3-7b26-0410-bdac-b3d0e5314bbc

src/main/java/jp/naist/se/stigmata/BirthmarkEnvironment.java

index c986df2..c9711f1 100644 (file)
@@ -147,9 +147,15 @@ public class BirthmarkEnvironment{
      * add given property.\r
      */\r
     public void addProperty(String key, String value){\r
+        boolean contains = properties.containsKey(key);\r
         String old = getProperty(key);\r
         properties.put(key, value);\r
-        firePropertyEvent(new PropertyChangeEvent(this, key, old, value));\r
+\r
+        // value is updated?\r
+        if(!((old != null && old.equals(value)) ||\r
+             (contains && old == null && value == null))){\r
+            firePropertyEvent(new PropertyChangeEvent(this, key, old, value));\r
+        }\r
     }\r
 \r
     /**\r