facelets
  1. facelets
  2. FACELETS-240

UIRepeat 'value' attribute and Collection types

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Incomplete
    • Affects Version/s: Facelets 1.1
    • Fix Version/s: early access
    • Component/s: impl
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      240

      Description

      I encountered a problem attempting to set the ui:repeat "value" attribute to an
      instance that was a subclass of java.util.Set (specifically Hibernate's
      PersistentSet class): the UIRepeat class treated it like a scalar object.

      An iteration tag like ui:repeat should work with all Collection types in my
      opinion. In the UIRepeat.getDataModel() method it's possible to detect an
      instance of Collection and make use of the ArrayDataModel by invoking the
      toArray() method on the instance. In this way a new DataModel implementation
      isn't needed. I've made this change in my own copy of Facelets and it works
      beautifully.

      Hibernate happens to use Sets quite a bit, so this was important to me. I'd be
      happy to submit a patch.

      This issue occurs in Facelets 1.2 as well.\

        Issue Links

          Activity

          Hide
          mkienenb added a comment -

          Note that DataModel expects an ordered Collection. This is why it doesn't
          natively support any collections other than Array, List, or scrollable ResultSet.

          Show
          mkienenb added a comment - Note that DataModel expects an ordered Collection. This is why it doesn't natively support any collections other than Array, List, or scrollable ResultSet.
          Hide
          Ryan Lubke added a comment -

          Agreed with Mike. Closing.

          Show
          Ryan Lubke added a comment - Agreed with Mike. Closing.
          Hide
          Raj added a comment - - edited

          I think there is definitely a need to allow Iterables to be used with ui:repeat.
          For example, sometimes there's are needs to use your custom iterable backed by an existing list. Such as when you want to iterate over a collection of entities/ or just columns read from database but get entityIds/ or read column values on iteration instead of the entity/ or column, in that case using an custom Iterable backed by a list is the nice option, but due to this limitation of ui:repeat tags this cannot be availed and unnecessarily the list needs to be rebuilt.

          And limiting useful cases to arrays, list & result set does not cover all types of ordered collections.

          Show
          Raj added a comment - - edited I think there is definitely a need to allow Iterables to be used with ui:repeat. For example, sometimes there's are needs to use your custom iterable backed by an existing list. Such as when you want to iterate over a collection of entities/ or just columns read from database but get entityIds/ or read column values on iteration instead of the entity/ or column, in that case using an custom Iterable backed by a list is the nice option, but due to this limitation of ui:repeat tags this cannot be availed and unnecessarily the list needs to be rebuilt. And limiting useful cases to arrays, list & result set does not cover all types of ordered collections.
          Hide
          Ed Burns added a comment -

          I've opened this as a spec issue.

          Show
          Ed Burns added a comment - I've opened this as a spec issue.

            People

            • Assignee:
              facelets-issues
              Reporter:
              rwhitsell
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: