ICEfaces
  1. ICEfaces
  2. ICE-4058

Iteration component should be able to iterate on a Map

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8DR#2
    • Fix Version/s: 1.8RC2, 1.8
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      java

      Description

      for instance in UISeries:

      else if (currentValue instanceof Map) {
                  this.dataModel = new SetDataModel(((Map) currentValue).entrySet());

        Activity

        Hide
        Mark Collette added a comment -

        We shouldn't support Map or Set, because they don't have orderings, which could cause problems for users, when any modification can drastically affect the subsequent iteration, or in the case of LinkedHashMap no modification would be necessary. What that means is, the data model will render in one sequence, and then a post-back could apply input values to any element of the Set or Map, instantly corrupting the data model.

        I'm not sure why ICE-2755 added support for Set, given these concerns. Perhaps this would be useful for SortedMap and SortedSet? Or just when used with output components.

        I'm just worried that new users will see their code "work" and be caught unawares with these issues, whereas if it failed immediately, they would then find out about this issue, and know to use a more appropriate data structure.

        Show
        Mark Collette added a comment - We shouldn't support Map or Set, because they don't have orderings, which could cause problems for users, when any modification can drastically affect the subsequent iteration, or in the case of LinkedHashMap no modification would be necessary. What that means is, the data model will render in one sequence, and then a post-back could apply input values to any element of the Set or Map, instantly corrupting the data model. I'm not sure why ICE-2755 added support for Set, given these concerns. Perhaps this would be useful for SortedMap and SortedSet? Or just when used with output components. I'm just worried that new users will see their code "work" and be caught unawares with these issues, whereas if it failed immediately, they would then find out about this issue, and know to use a more appropriate data structure.
        Hide
        Keith Garry Boyce added a comment -

        I suppose you could specifically check of instanceof LinkedHashMap or LinkedHashSet but i think that would limit the flexibility of implementation somewhat. Preferable would be to throw an error if customer specifies HashMap or HashSet as implementation and update javadoc and warning log messages to reflect warning of this behaviour if user sends in own implementation of map or Set

        Show
        Keith Garry Boyce added a comment - I suppose you could specifically check of instanceof LinkedHashMap or LinkedHashSet but i think that would limit the flexibility of implementation somewhat. Preferable would be to throw an error if customer specifies HashMap or HashSet as implementation and update javadoc and warning log messages to reflect warning of this behaviour if user sends in own implementation of map or Set
        Hide
        Mark Collette added a comment -

        We'll enable support for more advanced uses, and if beginners run into trouble, they can find help from the community.

        Subversion 18418
        icefaces\component\src\com\icesoft\faces\component\panelseries\UISeries.java

        Show
        Mark Collette added a comment - We'll enable support for more advanced uses, and if beginners run into trouble, they can find help from the community. Subversion 18418 icefaces\component\src\com\icesoft\faces\component\panelseries\UISeries.java

          People

          • Assignee:
            Unassigned
            Reporter:
            Keith Garry Boyce
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: