Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.6.3
-
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
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 } ) ) } } }