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 (JIRA)" <de...@myfaces.apache.org> on 2006/04/26 18:10:02 UTC

[jira] Created: (TOBAGO-59) SelectManyRendererBase can't handle setter

SelectManyRendererBase can't handle setter
------------------------------------------

         Key: TOBAGO-59
         URL: http://issues.apache.org/jira/browse/TOBAGO-59
     Project: MyFaces Tobago
        Type: Bug

    Versions: 1.0.8    
    Reporter: Richard van Nieuwenhoven
    Priority: Minor


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 "Update Model Values"  did the conversion from Object[] to SpecificType[].



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


[jira] Commented: (TOBAGO-59) SelectManyRendererBase can't handle setter

Posted by "Richard van Nieuwenhoven (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/TOBAGO-59?page=comments#action_12376916 ] 

Richard van Nieuwenhoven commented on TOBAGO-59:
------------------------------------------------

it functions in my current case but i think you, or bether the place you copied it from has a bug.

in this code the convertertype of the first element overwrites the arraycomponenttype but this sould not be allowed!!
when my array contaigns diffrent subclasses the array must be of the superclasstype (as specified in the valuebinding)
and not the type of the first ellement in my array.

i have made a patch and will include it in 5 min

> SelectManyRendererBase can't handle setter
> ------------------------------------------
>
>          Key: TOBAGO-59
>          URL: http://issues.apache.org/jira/browse/TOBAGO-59
>      Project: MyFaces Tobago
>         Type: Bug

>     Versions: 1.0.7
>     Reporter: Richard van Nieuwenhoven
>     Assignee: Bernd Bohmann
>     Priority: Minor
>      Fix For: 1.0.7
>  Attachments: SelectManyRendererBase.java, SelectManyRendererBase.java, SelectManyRendererBase.java.diff
>
> 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 "Update Model Values"  did the conversion from Object[] to SpecificType[].

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


Re: [jira] Resolved: (TOBAGO-59) SelectManyRendererBase can't handle setter

Posted by Bernd Bohmann <be...@atanion.com>.
Please add a bug report for MyFaces Core.

Richard van Nieuwenhoven schrieb:
> Who is responsible for doing this? should i wirte a new bugreport ? how 
> is the right procedure!
> 
> regards,
> Ritchie
> 
> 
> Bernd Bohmann (JIRA) schrieb:
>>      [ http://issues.apache.org/jira/browse/TOBAGO-59?page=all ]
>>      Bernd Bohmann resolved TOBAGO-59:
>> ---------------------------------
>>
>>     Resolution: Fixed
>>
>> I think you are right.
>> We should change it in myfaces shared code.
>>
>>  
>>> SelectManyRendererBase can't handle setter
>>> ------------------------------------------
>>>
>>>          Key: TOBAGO-59
>>>          URL: http://issues.apache.org/jira/browse/TOBAGO-59
>>>      Project: MyFaces Tobago
>>>         Type: Bug
>>>     
>>
>>  
>>>     Versions: 1.0.7
>>>     Reporter: Richard van Nieuwenhoven
>>>     Assignee: Bernd Bohmann
>>>     Priority: Minor
>>>      Fix For: 1.0.7
>>>  Attachments: SelectManyRendererBase.java, 
>>> SelectManyRendererBase.java, SelectManyRendererBase.java.diff
>>>
>>> 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 "Update Model Values"  did the conversion from Object[] to 
>>> SpecificType[].
>>>     
>>
>>   
> 
> 

-- 
Dipl.-Ing. Bernd Bohmann - Atanion GmbH - Software Development
Bismarckstr. 13, 26122 Oldenburg, http://www.atanion.com
phone: +49 441 4082312, mobile: +49 173 8839471, fax: +49 441 4082333

Re: [jira] Resolved: (TOBAGO-59) SelectManyRendererBase can't handle setter

Posted by Richard van Nieuwenhoven <ni...@cfc.at>.
Who is responsible for doing this? should i wirte a new bugreport ? how 
is the right procedure!

regards,
Ritchie


Bernd Bohmann (JIRA) schrieb:
>      [ http://issues.apache.org/jira/browse/TOBAGO-59?page=all ]
>      
> Bernd Bohmann resolved TOBAGO-59:
> ---------------------------------
>
>     Resolution: Fixed
>
> I think you are right.
> We should change it in myfaces shared code.
>
>   
>> SelectManyRendererBase can't handle setter
>> ------------------------------------------
>>
>>          Key: TOBAGO-59
>>          URL: http://issues.apache.org/jira/browse/TOBAGO-59
>>      Project: MyFaces Tobago
>>         Type: Bug
>>     
>
>   
>>     Versions: 1.0.7
>>     Reporter: Richard van Nieuwenhoven
>>     Assignee: Bernd Bohmann
>>     Priority: Minor
>>      Fix For: 1.0.7
>>  Attachments: SelectManyRendererBase.java, SelectManyRendererBase.java, SelectManyRendererBase.java.diff
>>
>> 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 "Update Model Values"  did the conversion from Object[] to SpecificType[].
>>     
>
>   


[jira] Resolved: (TOBAGO-59) SelectManyRendererBase can't handle setter

Posted by "Bernd Bohmann (JIRA)" <de...@myfaces.apache.org>.
     [ http://issues.apache.org/jira/browse/TOBAGO-59?page=all ]
     
Bernd Bohmann resolved TOBAGO-59:
---------------------------------

    Resolution: Fixed

I think you are right.
We should change it in myfaces shared code.

> SelectManyRendererBase can't handle setter
> ------------------------------------------
>
>          Key: TOBAGO-59
>          URL: http://issues.apache.org/jira/browse/TOBAGO-59
>      Project: MyFaces Tobago
>         Type: Bug

>     Versions: 1.0.7
>     Reporter: Richard van Nieuwenhoven
>     Assignee: Bernd Bohmann
>     Priority: Minor
>      Fix For: 1.0.7
>  Attachments: SelectManyRendererBase.java, SelectManyRendererBase.java, SelectManyRendererBase.java.diff
>
> 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 "Update Model Values"  did the conversion from Object[] to SpecificType[].

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


[jira] Commented: (TOBAGO-59) SelectManyRendererBase can't handle setter

Posted by "Bernd Bohmann (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/TOBAGO-59?page=comments#action_12376779 ] 

Bernd Bohmann commented on TOBAGO-59:
-------------------------------------

Thank you for your input.

This component is in a pre jsf version. Maybe it was never touched after the jsf move.

In decode the setSubmittedValue must be called and the getConvertedValue should implement following logic: 

http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/api/javax/faces/component/UISelectMany.html

Can you test it with the latest version from the trunk.

> SelectManyRendererBase can't handle setter
> ------------------------------------------
>
>          Key: TOBAGO-59
>          URL: http://issues.apache.org/jira/browse/TOBAGO-59
>      Project: MyFaces Tobago
>         Type: Bug

>     Versions: 1.0.7
>     Reporter: Richard van Nieuwenhoven
>     Assignee: Bernd Bohmann
>     Priority: Minor
>      Fix For: 1.0.7
>  Attachments: SelectManyRendererBase.java, SelectManyRendererBase.java
>
> 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 "Update Model Values"  did the conversion from Object[] to SpecificType[].

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


[jira] Updated: (TOBAGO-59) SelectManyRendererBase can't handle setter

Posted by "Richard van Nieuwenhoven (JIRA)" <de...@myfaces.apache.org>.
     [ http://issues.apache.org/jira/browse/TOBAGO-59?page=all ]

Richard van Nieuwenhoven updated TOBAGO-59:
-------------------------------------------

    Status: Patch Available  (was: Open)

> SelectManyRendererBase can't handle setter
> ------------------------------------------
>
>          Key: TOBAGO-59
>          URL: http://issues.apache.org/jira/browse/TOBAGO-59
>      Project: MyFaces Tobago
>         Type: Bug

>     Versions: 1.0.8
>     Reporter: Richard van Nieuwenhoven
>     Priority: Minor

>
> 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 "Update Model Values"  did the conversion from Object[] to SpecificType[].

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