From: Matthieu S. (JIRA) <no...@sp...> - 2010-04-02 08:15:35
|
[ https://jira.springsource.org/browse/RCP-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52615#action_52615 ] Matthieu Steyt commented on RCP-631: ------------------------------------ Reconsider the example with object X x1 = new X(id=1, A=a1(id=5), B=10) with A another domain object and you set this bean on a formmodel that sets the value of A to an instance a2 with id=5 (fresh from a db back-end) when B=10 (this is necessary for user interaction with the form) and of course a2.equals(a1). But as the value change detector checks on java instance equality (==) instead of using the equals() implementation our formmodel will be dirty after setting x1 on it. I don't think this is desired behaviour. One could say, use a value change detector that uses equals(), but: * does not work with referables/derived valuemodels (when you change a property on the referred entity, you expect the derived value model to change even if oldEntity.equals(newEntity)) * a considerable amount of bindings make intensive use of cloning to make a valuemodel clear that something has changed... which will break if you use a value change detector that uses equals()... > 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 |