uibinder - How to call method of @UiField field in GWT -
here classes
public class personview extends composite{ private person person; @uifield firstnameview firstnameview; @uifield lastnameview lastnameview; public personview(person person) { setdata(person); } public void setdata(person person) { firstnameview.setdata(person.getfirstname()); lastnameview.setdata(person.getlastname()); } } public class firstnameview extends composite{ private firstname firstname; @uifield textbox firstnametextbox; public firstnameview() { } public void setdata(firstname firstname) { firstnametextbox.setvalue(firstname.getfirstname()); } } public class lastnameview extends composite{ private lastname lastname; @uifield textbox lastnametextbox; public lastnameview() { } public void setdata(lastname lastname) { lastnametextbox.setvalue(lastname.getlastname()); } }
my problem when call method setdata(person)
, following error
java.lang.nullpointerexception: null in line `firstnameview.setdata(person.getfirstname())`
i think @uifield firstnameview firstnameview
(and lastnameview
too) doesn't create object. don't understand how gwt works in case. me please resolve , set data.
@uifield
s "injected" when call initandbindui
on uibinder
instance, passing instance @uifield
s argument.
in other words, personview
constructor should begin initializing uibinder
instance , calling binder.initandbindui(this)
before can call setdata()
.
Comments
Post a Comment