Search code examples
gwtmvpuibinder

Using an interface inside the xml-file (gwt mvp)


I am using GWT MVP II (with the UiBinder) and I have a question. Let's say I have a widget, which consist of:

  • CoolButtonView.ui.xml - xml for UiBinder

  • CoolButtonView.java - view's interface

  • CoolButtonViewImp.java - implements the CoolButtonView.java and contains a reference into CoolButtonPresenter

  • CoolButtonPresenter.java - presenter's interface

  • CoolButtonPresenterImpl.java - implement the CoolButtonPresenter and contains a reference into CoolButtonView

I am trying to use it inside the other widgets xml via an interface like this: < r:CoolButtonView ui:field="myButton" />, but I am getting an error:

    Invoking generator com.google.gwt.uibinder.rebind.UiBinderGenerator
    Not allowed in an HTML context Element 
    <r:CoolButtonView ui:field='CoolButtonView' />

However if I use my widget via the view, everything is good: < r:CoolButtonViewImpl ui:field="myButton" /> But I think that this isn't correct.

Should I use an interface inside the xml-files? And if I should, what is a correct way?


Solution

  • It should work, but your @UiField should be provided=true.

    See https://code.google.com/p/google-web-toolkit/issues/detail?id=5662 and https://code.google.com/p/google-web-toolkit/issues/detail?id=5879

    Whether you should or should not do it is another story that “will likely solicit debate, arguments, polling, or extended discussion” and StackOverflow is not the place for such questions: see https://stackoverflow.com/faq#close