Revision: 1110
Author:   jhoskens
Date:     2006-05-04 06:10:44 -0700 (Thu, 04 May 2006)
ViewCVS:  http://svn.sourceforge.net/spring-rich-c/?rev=1110&view=rev

Log Message:
-----------
Removing a childFormModel must include removing it from the dirtylist if needed.

Modified Paths:
--------------
    
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/support/AbstractFormModel.java
===================================================================
--- 
trunk/spring-richclient/support/src/main/java/org/springframework/binding/form/support/AbstractFormModel.java
       2006-05-02 14:29:36 UTC (rev 1109)
+++ 
trunk/spring-richclient/support/src/main/java/org/springframework/binding/form/support/AbstractFormModel.java
       2006-05-04 13:10:44 UTC (rev 1110)
@@ -224,6 +224,11 @@
         return (FormModel[])children.toArray(new FormModel[children.size()]);
     }
 
+    /**
+     * Add child to this FormModel. Dirty and committable changes are 
forwarded to
+     * parent model.
+     * @param child FormModel to add as child.
+     */
     public void addChild(HierarchicalFormModel child) {
         Assert.required(child, "child");
         Assert.isTrue(child.getParent() == null, "Child form model '" + child 
+ "' already has a parent");
@@ -233,12 +238,21 @@
         child.addPropertyChangeListener(COMMITTABLE_PROPERTY, 
committableChangeHandler);
     }
     
+    /**
+     * Remove a child FormModel. Dirty and committable listeners are removed.
+     * When child was dirty, remove the formModel from the dirty list and 
update the dirty state.
+     * @param child FormModel to remove from childlist.
+     */
     public void removeChild(HierarchicalFormModel child)
     {
         Assert.required(child, "child");
         children.remove(child);
         child.removePropertyChangeListener(DIRTY_PROPERTY, dirtyChangeHandler);
         child.removePropertyChangeListener(COMMITTABLE_PROPERTY, 
committableChangeHandler);
+        // when dynamically adding/removing childModels take care of 
dirtymessages:
+        // removing child that was dirty: remove from dirty map and update 
dirty state
+        if (dirtyValueAndFormModels.remove(child))
+            dirtyUpdated();
     }
 
     public boolean hasProperty(String formProperty) {


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