在 MVP GWT 中创建视图层的最佳实践
我红色了有关 MVP 并想询问您如何创建视图层。 假设一个视图上有三个不同的“元素”:树、表和文本。 现在我认为最好的做法是将这三个元素解耦 (我的意思是,如果我不想要 Tree “元素”,在我看来,我会注释该行,例如在代码中的某个地方使用 setTree(...) )。 另外我想使用 UIBinder 来创建每个“元素”
所以我的问题是: 谁应该负责创建像树或表这样的解耦元素(控制器、演示器或可能的视图)
,
谁负责将这些元素设置到视图?
I red google-gwt article about MVP
and would like to ask about how you are creating the view layer.
Suppose you have three different "elements" on one view, the Tree, the Table and Text.
And now I think the best practice is to create these three elements decoupled
(I mean that, if I don't want Tree "element", in my view, I would comment the line, with for instance setTree(...) in code, somewhere).
Also I would like to use UIBinder for creating each of the "element"
So my questions are:
Who should be responsible for creating such decoupled element like Tree or Table (Controller, Presenter or may View)
and
Who is responsible for setting such elements to the View?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
视图应该负责组装它需要的小部件组件。您的视图类将是具有相应 UiBinder 文件的视图类,在该文件中您可以组合树、表和标签(或其他)。
The view should be responsible for assembling the widget components it needs. Your view class will be the one with a corresponding UiBinder file, and in that file you can combine a Tree, Table, and Label (or whatever).