If I have the following class com.mywebapp.client.ui.MyWidget:
public class MyWidget extends Composite {
interface MyWidgetUiBinder extends UiBinder<Widget, MyWidget>{}
private static MyWidgetUiBinder uiBinder = GWT.create(MyWidgetUiBinder.class);
...
}
And it’s corresponding UiBinder:
<!-- MyWidgetUiBinder.ui.xml -->
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<!-- ... -->
</ui:UiBinder>
Then:
- Where (what package or folder) does
MyWidgetUiBinder.ui.xmlgo? Does GWT allow you to make this configurable or does it require that you place it somewhere specifically? - How granular should UiBinder snippets be? For every Widget? For every display region? 1 per “page”/screen?
Thanks in advance!
UiBinder looks for a file named after the enclosing class of the interface (if any, otherwise the interface name), in the same package as that class.
In your case, it’ll look for a
com/mywebapp/client/ui/MyWidget.ui.xml.This is the default, and can be overridden using
@UiTemplate. See https://developers.google.com/web-toolkit/doc/latest/DevGuideUiBinder#Apply_different_xmlAs for the granularity, UiBinder templates should be kept an implementation detail of a widget.