Revision: 1126
Author:   jhoskens
Date:     2006-05-09 07:51:11 -0700 (Tue, 09 May 2006)
ViewCVS:  http://svn.sourceforge.net/spring-rich-c/?rev=1126&view=rev

Log Message:
-----------
Parent formmodel needed to remove listeners etc when using removeChild(model)

Modified Paths:
--------------
    
trunk/spring-richclient/support/src/main/java/org/springframework/binding/form/HierarchicalFormModel.java
    
trunk/spring-richclient/support/src/main/java/org/springframework/binding/form/support/AbstractFormModel.java
Modified: 
trunk/spring-richclient/support/src/main/java/org/springframework/binding/form/HierarchicalFormModel.java
===================================================================
--- 
trunk/spring-richclient/support/src/main/java/org/springframework/binding/form/HierarchicalFormModel.java
   2006-05-08 13:55:31 UTC (rev 1125)
+++ 
trunk/spring-richclient/support/src/main/java/org/springframework/binding/form/HierarchicalFormModel.java
   2006-05-09 14:51:11 UTC (rev 1126)
@@ -50,6 +50,11 @@
     void setParent(HierarchicalFormModel parent);
     
     /**
+     * Remove the parent form model
+     */
+    void removeParent();
+    
+    /**
      * Adds a new child to the form model. The child form model will have it's 
      * parent set to this.
      */

Modified: 
trunk/spring-richclient/support/src/main/java/org/springframework/binding/form/support/AbstractFormModel.java
===================================================================
--- 
trunk/spring-richclient/support/src/main/java/org/springframework/binding/form/support/AbstractFormModel.java
       2006-05-08 13:55:31 UTC (rev 1125)
+++ 
trunk/spring-richclient/support/src/main/java/org/springframework/binding/form/support/AbstractFormModel.java
       2006-05-09 14:51:11 UTC (rev 1126)
@@ -220,6 +220,11 @@
         this.parent.addPropertyChangeListener(ENABLED_PROPERTY, 
enabledChangeHandler);
     }
 
+    public void removeParent() {
+        this.parent.removePropertyChangeListener(ENABLED_PROPERTY, 
enabledChangeHandler);
+        this.parent = null;
+    }
+
     public FormModel[] getChildren() {
         return (FormModel[])children.toArray(new FormModel[children.size()]);
     }
@@ -246,6 +251,7 @@
     public void removeChild(HierarchicalFormModel child)
     {
         Assert.required(child, "child");
+        child.removeParent();
         children.remove(child);
         child.removePropertyChangeListener(DIRTY_PROPERTY, dirtyChangeHandler);
         child.removePropertyChangeListener(COMMITTABLE_PROPERTY, 
committableChangeHandler);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
spring-rich-c-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs

Reply via email to