groovy
  1. groovy
  2. GROOVY-3453

ComboBox#selectedItem synthetic property ignores converter on first update

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.6
    • Fix Version/s: 1.6.2
    • Component/s: Swing
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      The following code fails with an exception: Cannot cast object 'Red' with class 'java.lang.String' to class 'java.awt.Color' instead of showing the frame. The initial update of the property should insure that the validator and converter are called.

      All synthetic binding properties should be checked for such errors as well.

      import java.awt.Color
      import groovy.swing.SwingBuilder
      
      sb = new SwingBuilder()
      
      sb.frame(pack:true, show:true) {
      panel {
      
      
      def colors = [Red:   Color.RED,
                    Green: Color.GREEN,
                    Blue:  Color.BLUE]
      
      label('Look at my colors!', id:'lbl')
      
      comboBox(items:colors.collect {k, v-> k}, id:'combo',
        selectedItem: bind (target:lbl, 'foreground',
          converter: {v -> println v; colors[v]}))
      }
      }
      

        Activity

          People

          • Assignee:
            Danno Ferrin
            Reporter:
            Danno Ferrin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: