java - How to add a list of TextBox widgets to a Panel widget declared using UiBinder (GWT)? -
i use uibinder define page element in sinple gwt application.
"login.ui.xml" defined belows.
<ui:uibinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:gwt='urn:import:com.google.gwt.user.client.ui'> <gwt:htmlpanel> <div align="center"> <gwt:verticalpanel ui:field="mymeasuresboxespanel"> </gwt:verticalpanel> </div> </gwt:htmlpanel>
the login class defined as:
public class login extends composite { private static loginuibinder uibinder = gwt.create(loginuibinder.class); /* * @uitemplate not mandatory allows multiple xml templates used * same widget. default file loaded <class-name>.ui.xml */ @uitemplate("login.ui.xml") interface loginuibinder extends uibinder<widget, login> { } @uifield verticalpanel mymeasuresboxespanel; public login() { this.mymeasuresboxespanel.getelement().setid("mymeasuresboxespanel"); for(int = 0; < 10; ++) { textbox newmeasuretextbox = new textbox(); newmeasuretextbox.settext(string.valueof(i)); this.mymeasuresboxespanel.add(newmeasuretextbox); } initwidget(uibinder.createandbindui(this)); } }
i mymeasuresboxespanel verticalpanel initialized list of 10 textbox widgets user enter info.
the code compiled fine web page didn't display textboxes empty table rendered verticalpanel.
i found answer. calling initwidget(uibinder.createandbindui(this));
before adding textbox widgets panel solved problem.