Revision: 1092
Author:   jhoskens
Date:     2006-04-25 23:46:47 -0700 (Tue, 25 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/spring-rich-c/?rev=1092&view=rev

Log Message:
-----------
- Added function to remove a child from the formModel
- revert and reset will first check children to resp. revert and reset 
themselves
(in addition to commit())

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-04-26 06:44:42 UTC (rev 1091)
+++ 
trunk/spring-richclient/support/src/main/java/org/springframework/binding/form/support/AbstractFormModel.java
       2006-04-26 06:46:47 UTC (rev 1092)
@@ -232,6 +232,14 @@
         child.addPropertyChangeListener(DIRTY_PROPERTY, dirtyChangeHandler);
         child.addPropertyChangeListener(COMMITTABLE_PROPERTY, 
committableChangeHandler);
     }
+    
+    public void removeChild(HierarchicalFormModel child)
+    {
+        Assert.required(child, "child");
+        children.remove(child);
+        child.removePropertyChangeListener(DIRTY_PROPERTY, dirtyChangeHandler);
+        child.removePropertyChangeListener(COMMITTABLE_PROPERTY, 
committableChangeHandler);
+    }
 
     public boolean hasProperty(String formProperty) {
         return propertyValueModels.containsKey(formProperty);
@@ -507,7 +515,15 @@
     protected void postCommit() {
     }
 
+    /**
+     * Revert state. If formModel has children, these will be reverted first.
+     * CommitTrigger is used to revert bufferedValueModels while 
revertToOriginal() is
+     * called upon FormMediatingValueModels.
+     */
     public void revert() {
+        for (Iterator i = children.iterator(); i.hasNext();) {
+            ((FormModel)i.next()).revert();
+        }
         // this will cause all buffered value models to revert
         commitTrigger.revert();
         // this will then go back and revert all unbuffered value models
@@ -517,9 +533,13 @@
     }
 
     /**
+     * If formModel has children, these are reset first.
      * @see FormModel#reset()
      */
     public void reset() {
+        for (Iterator i = children.iterator(); i.hasNext();) {
+            ((FormModel)i.next()).reset();
+        }
         setFormObject(null);
     }
 


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