为什么两种实现界面的方法(视图和演示者)都使用 GWT-MVP 教程?

发布于 2024-09-18 06:23:34 字数 841 浏览 2 评论 0原文

我的问题基于 GWT 教程 http://code.google.com/webtoolkit/articles/mvp- Architecture-2.html

这里我们有两对视图和演示者。

在 EditContactPresenter 中,我们在演示者类中定义视图接口

EditContactPresenter implements Presenter{  
  public interface Display {
    HasClickHandlers getSaveButton();
    ....
  }
}

,而在 Contact Presenter 中,我们在 View 类中定义演示者接口

public interface ContactsView<T> {
  public interface Presenter<T> {
    void onAddButtonClicked();
    .....
  }
}

。为什么会这样呢?本教程试图通过这个来传达什么......?

我计划将演示者界面保留在单独的类中(不在视图内),因为我最终可能会为同一演示者(移动/网络)制作多个视图,并将其保留在一个视图中可能不太可维护

第二,我计划一些基于演示格式或模板的标准化演示者接口,例如显示列表的一个,其他具有表单类型的演示......所以我不会为每个模型类制作演示者接口,它将被分组......任何建议

My question is based on GWT Tutorial
http://code.google.com/webtoolkit/articles/mvp-architecture-2.html

Here we have two pair of view and presenter

In EditContactPresenter we are defining the view interface inside the presenter class

EditContactPresenter implements Presenter{  
  public interface Display {
    HasClickHandlers getSaveButton();
    ....
  }
}

and in case of Contact Presenter we define the presenter interface inside the View class

public interface ContactsView<T> {
  public interface Presenter<T> {
    void onAddButtonClicked();
    .....
  }
}

Why is it so? what this tutorial is trying to communicate by this....?

I am planning to keep presenter interface in separate class (not inside the view) because I may end up making multiple view for the same presenter (mobile / web) and keeping it in one view may not be that maintainable

Second, I am planning of some standardize presenter interfaces on the basic of presentation formats or template, like one which displays the list other which has Form kind of presentation.... so i will not make presenter interface per model class it would be grouped...any suggestion

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

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

发布评论

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

评论(1

删除→记忆 2024-09-25 06:23:34

这是风格问题。 GWT 是开源的,因此这可能是由 2 个人编辑造成的。此外,他们可能试图表明无论哪种方式都可以。

It's a matter of style. GWT is open source so it is possible that this was caused by 2 people editing it. Also, they might be trying to show that either way is fine.

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