[seam-issues] [JBoss JIRA] Created: (JBSEAM-4695) UISelectItems.asSelectItem(items) should not wrap item if already instanceof SelectItem

Gergely Nagy (JIRA) jira-events at lists.jboss.org
Thu Aug 19 04:42:11 EDT 2010


UISelectItems.asSelectItem(items) should not wrap item if already instanceof SelectItem
---------------------------------------------------------------------------------------

                 Key: JBSEAM-4695
                 URL: https://jira.jboss.org/browse/JBSEAM-4695
             Project: Seam
          Issue Type: Bug
    Affects Versions: 2.1.2.GA
            Reporter: Gergely Nagy


We already had logic to prepare SelectItems with custom labels in the business layer, and wanted to make use of seam.UISelectItems' noSelectionLabel feature when the following issue came up:

org.jboss.seam.ui.component.UISelectItems.asSelectItems(Iterable) method should not wrap elements if they are already SelectItems. Proposed solution:

   private List<javax.faces.model.SelectItem> asSelectItems(Iterable iterable) 
   {
      List<javax.faces.model.SelectItem> selectItems =  new ArrayList<javax.faces.model.SelectItem>();
      for (final Object o : iterable)
      {
         selectItems.add(o instanceof SelectItem ? o : new ContextualSelectItem(o) {...});
...


it is also very unfortunate that non-public features of this class are private instead of protected, so we couldn't work around this issue by subclassing UISelectItems.

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

        


More information about the seam-issues mailing list