MVP 被动视图 - 复合视图和复合视图复合演示者
我找到了 M. Fowler 关于被动视图模式的文章。我想将其应用到我的应用程序中。我使用 Swing 作为 UI。我花了几个小时搜索如何实现它的教程或示例,但没有发现太多有用的信息。有人可以帮助理解设计或在这里提供好的例子吗? MVP 中的“M”我理解为“领域模型”。
I found M. Fowler article on Passive View pattern. I would like to apply it in my application. I use Swing for UI. I spent several hours searching tutorials or examples how to implement it but not much useful found. Could anybody help to understand the design or provide good examples here? By "M" in MVP I understand "Domain Model".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
MVP = Model View Presenter
基本思想是,将呈现逻辑与 UI(视图)分开,这样您就可以通过简单的 JUnit 测试模拟视图和测试呈现器,而不是弄乱 swing(可能由设计者生成)代码与您的“视图逻辑”(控制 UI 的代码)...
http://www.youtube.com/watch?v=PDuhR18-EdM
Ray Ryan 的演讲非常精彩。他谈论了 GWT,但是 MVP 的想法很好地解释了...
MVP 从 21:30 开始
MVP = Model View Presenter
The basic idea is, that you separate presenting logic from UI (view), so you can mock out the view and test presenter with simple JUnit tests, instead of messing the swing (probably generated by designer) code with your "view logic" (code that controls the UI)...
http://www.youtube.com/watch?v=PDuhR18-EdM
Really nice presentation by Ray Ryan. He talks about GWT, but the idea of MVP is well explained...
MVP starts at 21:30
MVP 可以这样解释:
模型——应用程序的域模型。所有的业务逻辑都在这里。
Presenter——所有视图逻辑都在这里。从模型中检索数据并更新视图。
视图——UI 演示。不包含更新逻辑。在用户交互时向演示者触发事件并侦听来自演示者的事件。
MVP can be explained the following way:
Model -- the domain model of your application. All business logic is here.
Presenter -- All view logic is here. Retrieves data from model and updates the view.
View -- UI presentation. Contains no updating logic. Fires events to the presenter on user interaction something and listens to the events from the presenter.