In my application I have a panel of widgets (all the same type of widget), and buttons that allow the user to add and remove widgets to the panel. Inside each of the widgets is a GWT RadioButton group. The widget uses the GWT UiBinder, and so in my ui.xml file I give each RadioButton a group name so that they will link together.
This becomes a problem, however, when 2 or more of this widget are added to the panel, because all the RadioButtons in all of the widgets have the same group name. I want each RadioButton group in each of the widgets to be independent of the others. How can I do this?
You can introduce a groupName parameter to your widget constructor, and then use @UiFactory to build the RadioButtons:
makeRadioButton()will be called automatically for all your<g:RadioButton>s you use in the UiBinder xml file.Now you can create each of these widgets with a different radio group name dynamically.