MyFaces Trinidad
  1. MyFaces Trinidad
  2. TRINIDAD-387

Converter getAsString isn't called in af:selectBooleanCheckBox

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.0.0-incubating-core
    • Fix Version/s: 1.0.0-incubating-core
    • Component/s: None
    • Labels:
      None

      Description

      I use in a page this tag:

      <af:selectBooleanCheckbox label="test boolean"
      value="#

      {test.boolean}

      "
      converter="#

      {test.booleanConverter}

      "/>

      I have a String representation of boolean in my bean (getBoolean return "0" if false end "1" if true)
      My converter convert in getAsString "0" into "false" and "1" into "true" and vice versa (getAsObject).

      Checkbox is never checked when getBoolean return "1", so I have debugged my application
      in converter:

      • getAsString is never called.
      • getAsObject is called normally when my form is submitted String param in getAsObject is "false" if my checkbox isn't checked and "true" if my checkbox is checked.

      selectBooleanCheckbox working isn't "symetric" so I think it is a trinidad bug.

      I have checked source code in
      SimpleSelectBooleanRenderer.encodeAllAsElement
      and SimpleSelectBooleanRenderer.encodeAllAsNonElement

      I have replaced code

      Object value = getSubmittedValue(bean);
      if ( value == null)
      value = getValue(bean);

      by this one
      Object value = getSubmittedValue(bean);
      if ( value == null)

      { value = getValue(bean); }

      if(!(value instanceof Boolean))

      { value=Boolean.valueOf(getConvertedString(context, component, bean)); }

      this "patch" works in af:selectBooleanCheckbox value can be boolean or String "true " or "false" and converter can be used to convert custom boolean representation, but I don't know if it is right place to correct this trinidad bug

        Activity

        Arnaud MERGEY created issue -
        Arnaud MERGEY made changes -
        Field Original Value New Value
        Status Open [ 1 ] Patch Available [ 10002 ]
        Hide
        Pierre-Luc Archambault added a comment -

        I created a patch file for the solution A. Mergey provided in text.

        After testing his solution, I got the same working result with this patch provided. Up to a commiter to review this!

        thx

        Show
        Pierre-Luc Archambault added a comment - I created a patch file for the solution A. Mergey provided in text. After testing his solution, I got the same working result with this patch provided. Up to a commiter to review this! thx
        Pierre-Luc Archambault made changes -
        Attachment SimpleSelectBooleanRenderer.patch [ 12336818 ]
        Adam Winer made changes -
        Assignee Adam Winer [ adamwiner ]
        Hide
        Adam Winer added a comment -

        Checked in to SVN revision 421664. Thanks!

        Show
        Adam Winer added a comment - Checked in to SVN revision 421664. Thanks!
        Adam Winer made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Matthias Weßendorf made changes -
        Affects Version/s 1.0.0-incubating-core [ 12312336 ]
        Fix Version/s 1.0.0-incubating-core [ 12312336 ]
        Jeff Turner made changes -
        Fix Version/s 1.0.0-incubating-core [ 12312336 ]
        Affects Version/s 1.0.0-incubating-core [ 12312336 ]
        Key ADFFACES-38 TRINIDAD-387
        Project MyFaces ADF-Faces [ 12310300 ] MyFaces Trinidad [ 12310661 ]
        Jeff Turner made changes -
        Affects Version/s 1.0.0-incubating-core [ 12312492 ]
        Fix Version/s 1.0.0-incubating-core [ 12312492 ]
        Matthias Weßendorf made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Adam Winer
            Reporter:
            Arnaud MERGEY
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development