GWT MVP 问题

发布于 2024-09-24 17:49:35 字数 439 浏览 1 评论 0原文

我是 GWT 的新手。我正在尝试使用 MVP 实现我的代码。

因此,按照教程,

  1. 我创建了一个 View
  2. 创建了一个 Presenter
  3. 在演示者内部创建了一个 Display 界面,
  4. 我的视图实现了我的Presenter.Display 接口。

只是为了概念证明,我在视图中创建了一个 Button。在我的演示器中,我编写了 ClickHandler
现在,当我调试这个项目时,我可以看到我的视图,但我在演示者中分配的功能尚未实现。换句话说,View 和 Presenter 并没有绑定在一起。

我如何绑定它们?我错过了什么吗?

谢谢

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

So following a tutorial

  1. I have created 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

成熟稳重的好男人 2024-10-01 17:49:35

你的项目中使用GIN吗?
您可以发布您的视图和演示者代码以及绑定它们的位置吗?
您可以使用以下方式绑定视图和演示者:

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

您是否在演示者模块中添加了上述代码?

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?

夏至、离别 2024-10-01 17:49:35

您在哪里创建视图和演示者?创建它们时,将视图传递给演示者,例如作为演示者构造函数中的参数。像这样

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

在 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...
}

希望这会有所帮助。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文