GWT MVP Problem
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 have created a
Presenter
, - I created a
Display
interface inside the presenter, - 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
.
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.
精彩评论