Oscar Perez
Oscar Perez

Reputation: 355

GWT: UiBinder and MVP

I am rather new to GWT and been trying to follow Activities and Places tutorial. Everything has worked very well until I had to use SuggestBox. In a SuggestBox you pass the Oracle in the constructor and there is not setOracle method. If I understood correctly, the idea in activities and places tutorial is to have the views just instantiated once since are expensive objects but then that poses a problem. If I want to keep the oracle in the presenter and I create the view BEFORE the presenter, how do I get to work all together? @UiField(provided=true) and instantiate the suggestbox from the presenter wont do since SuggestBox cannot be null when I init the widget... With CellTable is fairly easy since there is a setModel method but with SuggestBox or CellBrowser I have no idea in how to proceed. Am I misunderstanding something?

Upvotes: 2

Views: 474

Answers (1)

Thomas Broyer
Thomas Broyer

Reputation: 64541

There's actually almost no reason to set the SuggestOracle from the presenter.

But if you want it, you can easily make a SuggestOracle that calls back to the presenter, or a SuggestOracle that simply wraps another oracle, one that you could swap at runtime, and thus set from the presenter.

Upvotes: 1

Related Questions