]
Chris Rudd commented on JBSEAM-308:
-----------------------------------
An alternate workaround would be to change the signature of DataBinder.wrap to take the
existing wrapper (if found) and the object to be wrapped, so that the DataBinder can make
the determination of if a new wrapper should be used or if the existing is sufficient.
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.1, 1.0, 1.0 beta 2, 1.0 beta 1, 1.1
Reporter: Chris Rudd
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: