The way (I think) we do it is our View has a method:

<pre>
HasText getSuggestBox(SuggestOracle oracle) {
    if (oracle != this.oracle || this.suggestBox == null)
        //create a new suggest box with the oracle
        createOrReplaceSuggestBox(oracle);
    }
    return suggestBox;
}
</pre>

This way everything stays separate. you can also include a no-args
getSuggestBox method that might call this one with a default, or
simply return the suggestBox field (though that would have the obvious
possibility of returning null.


On Dec 21, 7:52 am, Paul Robinson <ukcue...@gmail.com> wrote:
> Another option is to create a SuggestOracle subclass that delegates
> method calls to another object (perhaps another oracle). Make the first
> oracle have get/set methods to set the delegatee.
>
> FKereki wrote:
> > If I understand it correctly, that poses a chicken-and-egg problem,
> > because the Presenter constructor requires a View, and the View
> > constructor would require something created by the Presenter? With
> > MVP, I first create a View, and then inject it into the Presenter. If
> > the View requires an oracle, then I must create the Presenter first --
> > but in that case I cannot inject the View!?
>
> > I solved this --and am not happy about it-- by (1st) creating the
> > View, WITHOUT the SuggestBox, (2nd) injecting the View into the
> > Presenter, and (3rd) having the Presenter create the oracle and
> > provide it to the View, so the latter can add the missing SuggestBox.
> > While this does work, it goes against UiBinder; the best I can do is
> > to reserve a space for the SuggestBox, and I cannot get to use
> > @UiHandler annotations.

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.


Reply via email to