为什么两种实现界面的方法(视图和演示者)都使用 GWT-MVP 教程?
我的问题基于 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是风格问题。 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.