I have this in my ui.xml file:
<g:Button ui:field="saveButton"/>
This is in my view class:
@UiField
Button saveButton;
@Inject
public MyView() {
saveButton.setText("Save");
initWidget(binder.createAndBindUi(this));
}
If I run it as is, I get blank screen. But if I remove the saveButton.setText("Save");
the button will come up but without any text in it. BTW I'm using mvp4g
开发者_高级运维Any idea why this is happening?
@UiField without provided have to go under the initWidget call and @UiField(provided = true) has to go above the initWidget call.
@Inject
public MyView() {
// here go all UiFields with provided=true
initWidget(binder.createAndBindUi(this));
// here go all UiFields without provided
saveButton.setText("Save");
}
精彩评论