I've struggled with the go(RootPanel.get()) function as well, but
discounted the idea of casting my Presenter.Display interface to a
Widget as it removes an amount of type safety from the presenter and
somewhat defeats the purpose of having a nice generic Display
interface for the Presenter to interact with. One solution I've tried,
which I think is promising, is to add a method to the Display
interface that accepts the Panel object presented to the go function.
For example,

class ContactViewer{
  interface Display {
    ...
    void showDisplay( Panel panel );
  }
  ...
  public void go( Panel panel ) {
    this.display.showDisplay(panel);
  }
}

Using this method, a Widget based ContactViewer.Display can add itself
to the supplied Panel object and Mocks can ignore the parameter for
testing purposes. As showing the Display object would be part of UI
testing anyway, this shouldn't effect test cases for the Presenter.

Cheers,

Jason

On Jun 29, 4:19 pm, mabogie <mabo...@gmail.com> wrote:
> check this out:
>
> http://www.webspin.be/
>
> I left out the model (Phone class here) and the command pattern, since
> I'm not using it yet.
>
> For your comment on the casting: I'm having trouble with that too.
> When I want to attach the widgets to the root panel or whatever other
> panel, I can't do anything but cast them. But nobody seems to have a
> good solution...
>
> On 29 jun, 23:13, Daniel Jue <teamp...@gmail.com> wrote:
>
> > Does anyone have a working MVP/Eventbus sample of something simple
> > like the PhoneEditor?
> > I don't think I'm doing it right.  The code from the IO presentation
> > leaves out enough details so that I'm not sure what to do.
> > For instance, in my Presenter.class,
>
> > I have something like this:
> > public class Presenter {
> > ...
> > private Display display;
> >         interface Display {
> >                 HasClickHandlers getSaveButton();
> >                 HasClickHandlers getCancelButton();
> >                 HasClickHandlers getNumberField();
> >                 HasClickHandlers getLabelPicker();
> >         }
> >         void editPhone(Phone phone) {
> >                 this.phone = Phone.from(phone);
> >                 display.getNumberField().setValue(phone.getNumber());
> >                 display.getLabelPicker().setValue(phone.getLabel());
> >         }
> > ...}
>
> > Obviously, a HasClickHandlers object doesn't have a setValue method.
> > It doesn't feel like I should be casting to the widget here, since we
> > went through all the trouble of using the Display interface.
>
> > I started looking at Mvp4g, but it seems to go off on a tangent with a
> > code generation class to wire up presenters and views via 
> > xml.http://code.google.com/p/mvp4g/
> > It's also intertwined with some mvc4g classes.
>
> > I just want something basic that works, so I can seed my project from
> > there.  A minimalist, working command style RPC example would be nice
> > too.
> > Anyone?  If you're in the DC area, I'll buy you a drink!
--~--~---------~--~----~------------~-------~--~----~
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-Toolkit@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