[jbossseam-issues] [JBoss JIRA] Closed: (JBSEAM-308) DataModel instance changes even though the backing list did not when using PAGE scope

Gavin King (JIRA) jira-events at lists.jboss.org
Mon Jun 11 00:57:11 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBSEAM-308?page=all ]

Gavin King closed JBSEAM-308.
-----------------------------

    Fix Version/s: 1.3.0.ALPHA
       Resolution: Done
         Assignee: Gavin King

I finally understood this. The proposed fix was the correct one.

> DataModel instance changes even though the backing list did not when using PAGE scope
> -------------------------------------------------------------------------------------
>
>                 Key: JBSEAM-308
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-308
>             Project: JBoss Seam
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0 beta 1, 1.0 beta 2, 1.0, 1.0.1, 1.1.0.BETA1
>            Reporter: Chris Rudd
>         Assigned To: Gavin King
>             Fix For: 1.3.0.ALPHA
>
>
> The outjectDataModel code attempts to determine if the value changed and therefore needs to be re outjected.
> When not using PAGE scope this works fine. When PAGE scope is used it always reports dirty, which causes the value to be outjected. 
> The issue is that if the backing value didnt change, it still gets re-wrapped and outjected instead of just re-outjected. 
> I noticed this when working with an @DataModel, the UIData components im using cache the DataModel to ensure that it doesnt change between the updateValues and the invokeApplication phases. So hwat ends up happening is that in the updateValues phase a property gets set on my component, causing the datamodel to be re-outjected, since the UIData has already cached the original value, it never picks up the "new" one. When I get to the invokeApplication phase and it calls an action method on the component the datamodel that the UIData updated the rowIndex on isnt the same one that seam pulls the rowIndex from to inject the @DataModelSelection.
> I propose the following fix to the 1.0.0 GA code ( removed PAGE scope check from dirty assignment, added else clause to if(dirty) ):
>  private void outjectDataModelList(String name, Object list, ScopeType scope, DataBinder wrapper)
>    {
>       
>       Context context = getDataModelContext(scope);
>       Object existingDataModel = context.get(name);
>       boolean dirty = existingDataModel == null || 
>             !wrapper.getWrappedData(existingDataModel).equals(list); //TODO: delegate to the wrapper to determine equality
>       
>       if ( dirty )
>       {
>          if ( list != null )
>          {
>             context.set( name, wrapper.wrap(list) );
>          }
>          else
>          {
>             context.remove( name );
>          }
>       }
>       // If page scope, outject the existingDataModel even if there was no change
>       else if( scope==ScopeType.PAGE )
>       {
>          context.set( name, existingDataModel );
>       }
>       
>    }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list