Reputation: 1277
With the following:
public class PromotionTableComposite<T extends Promotion> extends Composite {
@UiField(provided=true)
protected CellTable<T> displayTable;
@UiField(provided=true)
protected SimplePager pager;
And
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder
xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:c="urn:import:com.google.gwt.user.cellview.client">
<g:DockLayoutPanel
unit="EM">
<!-- DataGrid. -->
<g:center>
<c:CellTable
ui:field='displayTable'/>
</g:center>
<!-- Pager. -->
<g:south
size="3">
<g:HTMLPanel>
<table
style="width:100%">
<tr>
<td
align='center'>
<c:SimplePager
ui:field='pager'/>
</td>
</tr>
</table>
</g:HTMLPanel>
</g:south>
</g:DockLayoutPanel>
</ui:UiBinder>
Eclipse gives me the errors:
"Field displayTable has no corresponding field in the template file PromotionTableComposite.ui.xml"
"Field pager has no corresponding field in the template file PromotionTableComposite.ui.xml".
And when I run the project I get the following runtime error:
java.lang.AssertionError: UiField pager with 'provided = true' was null
What have I done wrong? I have checked the build properties so that it includes all source files and excludes non (so that the ui.xml file is included alongside the java file).
Upvotes: 1
Views: 3825
Reputation: 1785
My guess is that in your constructor you didn't initialize displayTable
and pager
before initWidget(uiBinder.createAndBindUi(this));
.
private static PromotionTableCompositeUiBinder uiBinder =
GWT.create(PromotionTableCompositeUiBinder.class);
@UiField(provided=true)
CellTable<T> displayTable;
@UiField(provided=true)
SimplePager pager;
public PromotionTableComposite(){
this.displayTable = new CellTable<T>();
this.pager = new SimplePager();
initWidget(uiBinder.createAndBindUi(this));
...
}
Upvotes: 3