|
From: Geoffrey De S. (JIRA) <no...@sp...> - 2010-04-01 07:28:35
|
[ https://jira.springsource.org/browse/RCP-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52592#action_52592 ]
Geoffrey De Smet commented on RCP-631:
--------------------------------------
I agree with these 3 arguments:
* Matthieu: 1) The current for loop is unstable because it is order dependend (and the order is undefined)
* Lieven, Jan: 2) After setting a formObject, the formObject can be dirty (due to listeners)
* ?: 3) The original author of boolean clearValueModels was fixing a problem, we have to make sure we don't regress that problem
Examples to prove some of those arguments
* 1) See Matthieu's patch which simply breaks on the order in which the user code calls listeners
* 2) A Contact (think Thunderbird) has a property firstName, lastName, displayName.
** if displayName is empty and firstName or lastName are changed, then displayName = firstName + " " + lastName
** if the db has a row: firstName = "Kabouter", lastName = "Plop", displayName = ""
*** then it will be shown to the user in the form as firstName = "Kabouter", lastName = "Plop", displayName = "Kabouter Plop"
*** In that case the save button should be enabled (so it should be dirty)
**** because otherwise if you send a mail to that contact, the display name of that contact is not the displayName shown in the unsaved form, "Kabouter Plop"
> 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
|