Skip to content

Instantly share code, notes, and snippets.

@niloc132
Created May 9, 2013 16:57
Show Gist options
  • Save niloc132/5548820 to your computer and use it in GitHub Desktop.
Save niloc132/5548820 to your computer and use it in GitHub Desktop.
public class Sample implements IsWidget {
private final Binder binder = GWT.create(Binder.class);
private Widget root;
@UiField(provided=true) MyBundle bundle = GWT.create(MyBundle.class);
public Sample() {
//first, provided items
bundle.myCss().ensureInjected();
//then, run the uibinder
root = binder.createAndBind(this);
}
public Widget asWidget() {
return root;
}
}
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' ...>
<!-- because we call it bundle here... -->
<ui:with type="package.to.my.client.MyBundle" field="bundle" />
<!-- ... we can reference it here -->
<g:Widget addStyleName="{bundle.myCss.style}"... />
</ui:UiBinder>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment