You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Richard van Nieuwenhoven <ni...@cfc.at> on 2006/04/26 16:52:59 UTC
MyFaces Tobago bugfix in SelectManyRendererBase
Hello,
first of all thanks, great work!
I think i found a bug in the class
org.apache.myfaces.tobago.renderkit.SelectManyRendererBase. it can take
an Object array as selected-object getter but needs a setter with a
String[].
The information how to convert a Object into a String and back is
normaly done with a javax.faces.convert.Converter but not in this case.....
I changed the last part of the decode method to:
....
Object [] convertedValue = null;
if (newValue == null) {
convertedValue = new Object[0]; // because no selection will not
submitted by browsers
}else {
convertedValue = new Object[newValue.length];
for (int index=0;index < newValue.length;index++)
convertedValue[index] = getConvertedValue(facesContext,
component, newValue[index]);
}
uiSelectMany.setValue(convertedValue);
......
The situation improved now, but the setter must now have a parameter of
type Object[].... I would like to use the specific type-array, but for
that i have to know the specific-type in the decode method (to create
the array in the correct type). the best solution would be if the "Apply
Request Values" did the conversion from Object[] to SpecificType[].
regards,
Ritchie
P.S. is this the correct mailing list to report a MyFaces Tobago bugfix?
Re: MyFaces Tobago bugfix in SelectManyRendererBase
Posted by Richard van Nieuwenhoven <ni...@cfc.at>.
"Apply Request Values" should be "Update Model Values" of course....
Richard van Nieuwenhoven schrieb:
> Hello,
>
> first of all thanks, great work!
> I think i found a bug in the class
> org.apache.myfaces.tobago.renderkit.SelectManyRendererBase. it can
> take an Object array as selected-object getter but needs a setter with
> a String[].
> The information how to convert a Object into a String and back is
> normaly done with a javax.faces.convert.Converter but not in this
> case.....
>
> I changed the last part of the decode method to:
>
> ....
> Object [] convertedValue = null;
> if (newValue == null) {
> convertedValue = new Object[0]; // because no selection will
> not submitted by browsers
> }else {
> convertedValue = new Object[newValue.length];
> for (int index=0;index < newValue.length;index++)
> convertedValue[index] = getConvertedValue(facesContext,
> component, newValue[index]);
> }
>
> uiSelectMany.setValue(convertedValue);
>
> ......
>
> The situation improved now, but the setter must now have a parameter
> of type Object[].... I would like to use the specific type-array, but
> for that i have to know the specific-type in the decode method (to
> create the array in the correct type). the best solution would be if
> the "Apply Request Values" did the conversion from Object[] to
> SpecificType[].
>
> regards,
> Ritchie
>
> P.S. is this the correct mailing list to report a MyFaces Tobago bugfix?
>
>
Re: MyFaces Tobago bugfix in SelectManyRendererBase
Posted by Mike Kienenberger <mk...@gmail.com>.
On 4/26/06, Richard van Nieuwenhoven <ni...@cfc.at> wrote:
> P.S. is this the correct mailing list to report a MyFaces Tobago bugfix?
It's the correct place to discuss bugs for Tobago.
Once you're sure it's a bug, please use the issue tracker to report it
(and to provide a patch to fix it):
http://issues.apache.org/jira/secure/BrowseProject.jspa?id=12310273