for example, i'd like to be able to do something like this:
public abstract class BasePanel<Panel extends BasePanel> extends
Composite {
interface Binder<BinderPanel extends BasePanel> extends
UiBinder<Widget, BinderPanel> { }
private static final Binder binder =
GWT.create(Binder<Panel>.class);
public BasePanel() {
initWidget(binder.createAndBindUi(this));
init();
}
}
basically this would allow any child classes to do something like
this:
public MyPanel extends BasePanel<MyPanel> {
//my code here
}
the default constructor would take care of all the code to bind
MyPanel to MyPanel.ui.xml.
basically i want to be lazy and only have to build the interface and
the binder once so that it's done in a common way. thoughts?
thanks in advance.
It would be great if I didn't have to put initWidget() in the
constructor (so that, like you say, unit tests become much easier) but
how would that work then? I suppose you have some sort of init()
method? How does that get called then?
Moreover, in Composite it says "All composites must call initWidget()
in their constructors.". You have encountered no difficulties not
having initWidget() in the constructor?