From: Lieven D. (JIRA) <no...@sp...> - 2010-03-31 14:31:35
|
[ https://jira.springsource.org/browse/RCP-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52568#action_52568 ] Lieven Doclo commented on RCP-631: ---------------------------------- Depends on what you consider to be dirty. So in your case, say you have a dummy object X(A=1, and B=2) and you set this bean on a formmodel that sets the value of B to 3 whenever A is changed through a valuechangelistener. The following will fail: {code} X x = new X(); ... // sets values of A=1 and B=2 formModel.setFormObject(x); if(!formModel.isDirty) // formModel isn't dirty, so one would assume no values have been changed { assertEquals(x, formModel.getFormObject); // fails because B is 3 now, although the form model is not dirty } {/code} I would assume that when the formmodel isn't dirty, the object behind the formmodel hasn't been changed. With your changes, I can't be sure anymore, as listeners on the formmodel may have altered the object... > Clearing the valuemodels in AbstractFormModel#setDeliverValueChangeEvents(boolean,boolean) should occur after all ValueChangeEvents are delivered. > -------------------------------------------------------------------------------------------------------------------------------------------------- > > Key: RCP-631 > URL: https://jira.springsource.org/browse/RCP-631 > Project: Spring Rich Client Project > Issue Type: Bug > Components: Core > Affects Versions: 1.1.0 > Reporter: Matthieu Steyt > Assignee: Geoffrey De Smet > Priority: Major > Fix For: 1.1.1 > > Attachments: AbstractFormModelTests.java.patch > > > Consider the following example: > A formmodel containing two valuemodels A and B. B has a changelistener registered in which A gets a new value. The current implementation of the setDeliverValueChangeEvents(boolean,boolean) method uses the following sequence: > 1. valueChangeEvents of A are delivered > 2. A is cleared (dirty = false) > 3. valueChangeEvents of B are delivered, as a consequence A is adapted (back to dirty) > 4. B is cleared (dirty = false) > Result: > A is dirty, while it is the intention of the method that A is cleared. > Solution: > Two for-loops instead of one. One for firing the events and one for clearing the value models. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://jira.springsource.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |