javaserverfaces-spec-public
  1. javaserverfaces-spec-public
  2. JAVASERVERFACES_SPEC_PUBLIC-450

Allow f:selectItems to reference any Collection or array (not just those of SelectItem)

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2 Sprint 8
    • Fix Version/s: 2.0
    • Component/s: Uncategorized
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      450
    • Status Whiteboard:
      Hide

      EGEasy5 effort_easy

      Show
      EGEasy5 effort_easy

      Description

      This has been implemented (at least) in Seam (s:selectItems) and MyFaces
      (t:selectItems). Seam implements a more complete version of this control (adds
      itemDisabled, itemLabelEscaped) and I'm more familiar with it, so I'll base this
      proposal on it, but I believe the behaviour of the two is nearly identical.

      I propose the following addition to the value attribute:

      • If the collection is genericised with SelectItem or the array has a
        componentType of SelectItem, or a Map is used then the current text is used to
        define what happens to the value
      • If the value is a collection or array, the values are converted to a
        Collection of selectItems using the algorithm detailed below
      • If the value is of type DataModel, the result of dataModel.getWrappedData() is
        passed to this algorithm

      The following additional fields are defined on f:selectItems, all of which take
      EL. These allow the options specified on <f:selectItem /> to be applied to the
      gerenated SelectItem:

      • var - The request-scope attribute (if any) under which the data object for the
        current row will be exposed when iterating.
      • itemValue - Value to return to the server if this option is selected.
        Optional, by default the var object is used. Can reference the var variable.
      • itemLabel - the label to be used when rendering the SelectItem. Can reference
        the var variable.
      • itemDisabled - if true the SelectItem will be rendered disabled. Can reference
        the var variable.
      • itemDescription - Description of this option, for use in development tools.
        Can reference the var variable.
      • itemLabelEscaped - if false, characters in the label will not be escaped. Can
        reference the var variable.

      The following algorithm is used to convert any collection or array to a
      Collection<SelectItem>:

      For each item in the collection or array, push the object into the request map
      under the name given by the var attribute. Create a SelectItem object using the
      values of itemValue, itemLabel, itemLabelEscaped, itemDisabled, which may
      reference the var object. Each SelectItem created must be added to the returned
      Collection<SelectItem>, with ordering preserved. The object pushed into the
      request map must be removed after the SelectItem has been removed.

        Issue Links

          Activity

          Hide
          Ed Burns added a comment -

          Take back ownership.

          Show
          Ed Burns added a comment - Take back ownership.
          Hide
          Ed Burns added a comment -

          Created an attachment (id=217)
          add noSelectionValue attribute to f:selectItems

          Show
          Ed Burns added a comment - Created an attachment (id=217) add noSelectionValue attribute to f:selectItems
          Hide
          Ed Burns added a comment -

          Fixed

          Show
          Ed Burns added a comment - Fixed
          Hide
          Ed Burns added a comment -

          Prepare to delete api subcomponent

          Show
          Ed Burns added a comment - Prepare to delete api subcomponent
          Hide
          Manfred Riem added a comment -

          Closing resolved issue out

          Show
          Manfred Riem added a comment - Closing resolved issue out

            People

            • Assignee:
              Ed Burns
              Reporter:
              pmuir
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: