From: Lieven D. (JIRA) <no...@sp...> - 2010-03-31 12:29:36
|
[ https://jira.springsource.org/browse/RCP-631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52560#action_52560 ] Lieven Doclo commented on RCP-631: ---------------------------------- After changing to the suggested solution, one of the tests is failing: testSetFormObjectUpdatesDirtyState on AbstractFormModelTests. This test actually mimics the behavior as shown, but revolves around the assumption that the object should be dirty: if the object composed by the valuemodels in a formmodel isn't the same as the object that was used to create said formmodel, it should be dirty. [code] fm.getValueModel("simpleProperty").addValueChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { fm.getValueModel("singleSelectListProperty").setValue(null); } }); TestBean newBean = new TestBean(); newBean.setSimpleProperty("simpleProperty"); newBean.setSingleSelectListProperty("singleSelectListProperty"); fm.setFormObject(newBean); assertEquals(null, fm.getValueModel("singleSelectListProperty").getValue()); assertTrue(fm.isDirty()); [/code] When your solution would be used, the last statement would return false, while the valuemodel's value (null) isn't the same as the original value ("singleSelectListProperty") which means it should be dirty. > 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: Lieven Doclo > Priority: Major > > 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 |