Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3647

Vetoable and Bindable properties cause rendering bug when PropertyVetoException is raised

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.3
    • 1.6.4, 1.7-beta-1
    • Swing
    • None

    Description

      If a String property is annotated as @Vetoable and @Bindable, the rendering goes wrong when the PropertyVetoException is raised

      I have pasted an example here

      http://gist.github.com/156104

      Type some text into the text box, and press the button. It prints the current value in the model (which is correct), but as you can see all chars after the invalid char are printed in reverse order

      Code pasted here also for completeness:

      import java.beans.*
      import java.awt.BorderLayout as BL
      import groovy.beans.Vetoable
      import groovy.beans.Bindable
      import groovy.swing.SwingBuilder
      import javax.swing.WindowConstants as WC
       
      class Details {
        @Vetoable @Bindable String aString
      }
      def details = new Details()
      details.vetoableChange = { PropertyChangeEvent pce ->
        if( pce.newValue ==~ /.*[ ]+.*/ ) {
          throw new PropertyVetoException( "No spaces allowed", pce )
        }
      }
      SwingBuilder.build {
        frame( title:'Login', id:'mainFrame', pack: true, show: true, defaultCloseOperation:WC.HIDE_ON_CLOSE ) {
          panel( layout:new BL() ) {
            label( id:'title', constraints:BL.WEST, text:"Try typing spaces to see a rendering bug?" )
            textField( id:'tf', text:details.aString, columns:20, constraints:BL.CENTER )
            bean( details, aString:bind { tf.text } )
            button( constraints:BL.SOUTH, action:action( name:'Click this to see the value of aString', closure:{ println details.aString } ) )
          }
        }
      }
      

      Attachments

        Activity

          People

            shemnon Daniel Ferrin
            tim_yates Tim Yates
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: