[richfaces-issues] [JBoss JIRA] (RF-13101) rich:select Method getSelectInputLabel is not working when using objects
J W (JIRA)
issues at jboss.org
Tue Feb 18 03:43:47 EST 2014
[ https://issues.jboss.org/browse/RF-13101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12945426#comment-12945426 ]
J W commented on RF-13101:
--------------------------
I fear i will not be able to provide a reproducer, but let me try to explain what is going wrong here (unfortunately the Person who noticed and fixed this Bug is not available anymore for us):
The if statement in the loop of the mentioned Method looks like this {code} if (value.equals(item.getValue())) { {code}
Whenever we use Cloned Objects this if-statement would return false, although the objects are equal.
To solve this issue we are now comparing the actual String-Values - not the object values, like the current {{item.getValue()}} does - in this method to get the actual label.
Apperently our workarround was updated and i have missed to update it in this issue. Sorry for that. Here is the actual code of this Method:
{code}
public static String getSelectInputLabel(FacesContext facesContext, UIComponent component) {
//RF-Issue: https://issues.jboss.org/browse/RF-13101
//FIX BEGIN
String label = null;
String selectedValue = InputUtils.getInputValue(facesContext, component);
if (selectedValue != null) {
List<ClientSelectItem> convertedSelectItems = getConvertedSelectItems(facesContext, component);
for (ClientSelectItem clientSelectItem : convertedSelectItems) {
if (selectedValue.equals(clientSelectItem.getConvertedValue())) {
label = clientSelectItem.getLabel();
break;
}
}
}
return label;
//FIX END
}
{code}
I hope the Problem is a bit clearer now.
> rich:select Method getSelectInputLabel is not working when using objects
> ------------------------------------------------------------------------
>
> Key: RF-13101
> URL: https://issues.jboss.org/browse/RF-13101
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: component-input, component-selects
> Affects Versions: 4.3.2, 5.0.0.Alpha1
> Reporter: J W
> Labels: rich:select, select, waiting_on_user
> Original Estimate: 30 minutes
> Remaining Estimate: 30 minutes
>
> The condition of the if-statement in org.richfaces.renderkit.SelectHelper.getSelectInputLabel(FacesContext facesContext, UIComponent component) is not working with the string-representations of the items. If using cloned objects the equals method will return false, even if the items are the same, because the IDs are different.
> The method should use only the strings of the objects, similiar to how MyFaces has solved this (check workarround).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the richfaces-issues
mailing list