Starting point:
http://code.google.com/webtoolkit/doc/latest/DevGuideUiBinder.html#Using_an_external_resource
My goal here is simply to bind an image, and update it later on if
necessary. I implemented the following code as a first step, but I
keep getting "Found widget <g:Image resource='{resources.logo}'> in an
HTML context". I'm unsure as to what that means; does the container
need to be initialized somehow?
Any pointers appreciated.
Code:
public class Sandbox implements EntryPoint {
public void onModuleLoad() {
BinderUiTest test = new BinderUiTest();
Document.get().getBody().appendChild(test.getElement());
}
}
public class BinderUiTest extends UIObject {
interface MyUiBinder extends UiBinder<DivElement, BinderUiTest> {}
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
@UiField(provided = true)
final Resources resources = Resources.INSTANCE;
public BinderUiTest() {
setElement(uiBinder.createAndBindUi(this));
}
}
public interface Resources extends ClientBundle {
Resources INSTANCE = GWT.create(Resources.class);
@Source("logo.png")
ImageResource logo();
}
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'>
<ui:with field='resources'
type='test.gwt.sandbox.client.resources.Resources' />
<div>
<g:Image resource='{resources.logo}' />
</div>
</ui:UiBinder>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.