I'm trying to hook up the typeahead widget to the NavSearch. I would like to do:
<b:Typeahead ui:field="typeahead">
<b:NavSearch ui:field="navSearch"></b:NavSearch>
</b:Typeahead>
And then call typeahead.setWidget(navsearch.getTextBox())
but it throws the error "Typeahead should be set to TextBoxBase childs". I understand this is caused at compile time when I call ui_binder.createAndBindUi(this)
.
I've been able to workaround this by switching the navsearch for a TextBox
which I then style appropriately but I was hoping for a more elegant solution.
The setWidget of Typeahead specifically checks for a widget of type TextBoxBase so i guess there is no alternative!! Sad but Reality!
public void setWidget(Widget w) {
if (!(w instanceof TextBoxBase || w instanceof com.google.gwt.user.client.ui.TextBoxBase)) {
throw new IllegalArgumentException("Typeahead should be set TextBoxBase childs");
}
super.setWidget(w);
}