Description
The following code throws an exception
import groovy.swing.SwingBuilder def model = [word:""] as ObservableMap new SwingBuilder().edt { frame( title: "BindTest", pack: true, visible: true ) { tabbedPane { panel( title: "a") { borderLayout() textField( id: 'wordValue', columns: 20) button( "Click me", actionPerformed: { println model.word }, constraints: context.SOUTH) } bean( model, word: bind{ wordValue.text } ) } } }
Exception thrown: No signature of method: java.util.ArrayList.containsKey() is applicable for argument types: (java.lang.String) values:
{value}groovy.lang.MissingMethodException: No signature of method: java.util.ArrayList.containsKey() is applicable for argument types: (java.lang.String) values: {value}
at ConsoleScript3$_run_closure1_closure2_closure3.doCall(ConsoleScript3:15)
at ConsoleScript3$_run_closure1_closure2_closure3.doCall(ConsoleScript3)
at ConsoleScript3$_run_closure1_closure2.doCall(ConsoleScript3:7)
at ConsoleScript3$_run_closure1_closure2.doCall(ConsoleScript3)
at ConsoleScript3$_run_closure1.doCall(ConsoleScript3:6)
That is because tabbedPane expects all its children to supply tab friendly properties, like title:, which in this case bean() does not provide. A workaround is to place bean() in another context, but the error and the reason why it happens is not intuitive. TabbedPane could be smarter and filter out those child nodes that do not conform to the rules, for example those that do not return a Component.