Revision: 1758 http://svn.sourceforge.net/spring-rich-c/?rev=1758&view=rev Author: jhoskens Date: 2007-05-22 06:05:23 -0700 (Tue, 22 May 2007)
Log Message: ----------- Parent/child nesting of ValidationResultsReporter replaced by nesting of ValidationResultsModels. The former was a bad idea and was a pain when managing a huge hierarchy. The latter solves this by chaining the models and providing the opportunity to bundle results and their events. Modified Paths: -------------- trunk/spring-richclient/sandbox/src/main/java/org/springframework/richclient/form/AbstractMasterForm.java trunk/spring-richclient/sandbox/src/main/java/org/springframework/richclient/preference/FormBackedPreferencePage.java Modified: trunk/spring-richclient/sandbox/src/main/java/org/springframework/richclient/form/AbstractMasterForm.java =================================================================== --- trunk/spring-richclient/sandbox/src/main/java/org/springframework/richclient/form/AbstractMasterForm.java 2007-05-22 12:57:48 UTC (rev 1757) +++ trunk/spring-richclient/sandbox/src/main/java/org/springframework/richclient/form/AbstractMasterForm.java 2007-05-22 13:05:23 UTC (rev 1758) @@ -25,11 +25,11 @@ import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionListener; -import ca.odell.glazedlists.BasicEventList; -import ca.odell.glazedlists.EventList; import org.springframework.beans.BeanUtils; import org.springframework.binding.form.HierarchicalFormModel; import org.springframework.binding.form.ValidatingFormModel; +import org.springframework.binding.validation.ValidationResultsModel; +import org.springframework.binding.validation.support.DefaultValidationResultsModel; import org.springframework.binding.value.ValueModel; import org.springframework.binding.value.support.DeepCopyBufferedCollectionValueModel; import org.springframework.binding.value.support.DirtyTrackingValueModel; @@ -39,7 +39,6 @@ import org.springframework.richclient.command.AbstractCommand; import org.springframework.richclient.command.ActionCommand; import org.springframework.richclient.command.CommandGroup; -import org.springframework.richclient.core.Guarded; import org.springframework.richclient.dialog.ConfirmationDialog; import org.springframework.richclient.dialog.Messagable; import org.springframework.richclient.table.ListSelectionListenerSupport; @@ -48,6 +47,9 @@ import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; +import ca.odell.glazedlists.BasicEventList; +import ca.odell.glazedlists.EventList; + /** * Abstract base for the Master form of a Master/Detail pair. Derived types must implement * two methods: @@ -597,10 +599,12 @@ * When the results reporter is setup on the master form, we need to capture it and * forward it on to the detail form as well. */ - public ValidationResultsReporter newSingleLineResultsReporter(Guarded guarded, Messagable messageReceiver) { - ValidationResultsReporter reporter = super.newSingleLineResultsReporter( guarded, messageReceiver ); - ValidationResultsReporter child = getDetailForm().newSingleLineResultsReporter( guarded, messageReceiver ); - reporter.addChild( child ); + public ValidationResultsReporter newSingleLineResultsReporter(Messagable messageReceiver) { + // create a resultsModel container which receives events from detail and master + ValidationResultsModel validationResultsModel = new DefaultValidationResultsModel(); + validationResultsModel.add(getFormModel().getValidationResults()); + validationResultsModel.add(getDetailFormModel().getValidationResults()); + ValidationResultsReporter reporter = new SimpleValidationResultsReporter(validationResultsModel, messageReceiver); getDetailFormModel().validate(); return reporter; } Modified: trunk/spring-richclient/sandbox/src/main/java/org/springframework/richclient/preference/FormBackedPreferencePage.java =================================================================== --- trunk/spring-richclient/sandbox/src/main/java/org/springframework/richclient/preference/FormBackedPreferencePage.java 2007-05-22 12:57:48 UTC (rev 1757) +++ trunk/spring-richclient/sandbox/src/main/java/org/springframework/richclient/preference/FormBackedPreferencePage.java 2007-05-22 13:05:23 UTC (rev 1758) @@ -49,7 +49,8 @@ } protected void initPageValidationReporter() { - form.newSingleLineResultsReporter(this, this); + form.newSingleLineResultsReporter(this); + form.addGuarded(this); } public void onAboutToShow() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ spring-rich-c-cvs mailing list spring-rich-c-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs