开发者

GWT MVP Problem

开发者 https://www.devze.com 2023-01-17 01:32 出处:网络
I am a newbie to GWT .I am trying to implement my code using MVP. So following a tutorial I have created 开发者_Go百科a View,

I am a newbie to GWT .I am trying to implement my code using MVP.

So following a tutorial

  1. I have created 开发者_Go百科a View,
  2. I have created a Presenter,
  3. I created a Display interface inside the presenter,
  4. My view implements my Presenter.Display interface.

Just for the proof of concept I created a Button in the View. In my presenter I wrote the ClickHandler.

Now when I debug this project I can see my view but the functionality I have assigned in my presenter is not implemented. In other words, the View and the Presenter are not binded together.

How do I bind them? Am I missing something?

Thanks


Are you using GIN in your project? Can you post your code of view and presenter and where you are binding them. You cam bind view and presenter using:

 bindPresenter(MyPresenter.class, MyPresenter.Display.class, MyView.class);

Have you added above code in your Presenter module?


Where do you create the view and the presenter? When creating them, pass the view to the presenter for example as an argument in the Presenters constructor. Like this

MyView v = MyView();
Mypresenter p = MyPresenter(v);

then in MyPresenter...

PView view = Display.View; // the display/interface where View is defined.
MyPresenter(Displat view) {
    this.view = v
    bind();
}

bind() {
    view.getThis,GetThat.addClickHandler(...) and so on...
}

Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消