GWT 活动 - 地点 =>对话框?
我正在尝试使用 GWT Activity &地点模型,但我有一些 为如何使用我的活动而烦恼。
我有一个 LoginActivity 可以将用户驱动到另一个活动: 需求活动。
我的 DemandsActivity 管理一个视图(“DemandsView”),该视图显示 简单的需求列表(使用 CellTable)。 整体运作良好。
我希望能够显示需求的详细信息 我的单元格表的选定行,通过显示 包含信息的对话框。 我想我可以再用一个 执行此操作的活动:DemandDetailsActivity。 但我不知道该怎么做。
或者说我从一开始就错了。也许我应该在我的活动中放置几个演示者(显示器)?一个演示者显示我的 CellTable,另一个演示者在对话框中显示我的 CellTable 的选定元素,而不更改 Place ?
你对此有何看法?
谢谢
I'm trying to use the GWT Activity & Place model, but I'm having some
troubles with it about how to use my activities.
I've got a LoginActivity which drives the user to another activity :
DemandsActivity.
My DemandsActivity manages a view ("DemandsView") which displays a
simple list of demands (with a CellTable).
The whole works fine.
I would like to be able to show the details of a demand, from a
selected line of my cellTable, by displaying
a DialogBox with the informations.
I thought I could use one more
activity to do that : DemandDetailsActivity.
But I don't know how to do that.
Or I've been wrong from the beginning. Maybe should I put several presenters (displays) into my activity ? One presenter to display my CellTable, and another one to display a selected element of my CellTable in a DialogBox, without changing Place ?
What do you think of that ?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您想要做的事情称为主从视图。人们已经用 GWT 实现了它,只需 google 一下即可。
附带说明:用 MVP 的说法,活动是演示者,视图是显示,因此当您说
将多个演示者(显示)放入我的活动中
时,这确实没有任何意义。演示者应该对应一个地方并处理业务逻辑。他们不应该关心显示部分。它们应该是可测试的,这意味着它们应该在桌面/服务器 JRE 上运行,而不依赖于 GWT 客户端。
因此,所有 GUI 构建部分都应该位于视图内。而且,是的,如果有意义的话,每个活动可以有多个视图。但是,就我个人而言,我会选择一个在 Activity 指示时显示详细信息(可能是对话框)的视图。
What you are trying to do is called master-detail view. People have been implementing it with GWT, just google around.
On a side note: in MVP parlance Activities are presenters and Views are displays, so when you say
put several presenters (displays) into my activity
it really makes no sense.Presenters should correspond to a place and handle business logic. They should not be concerned with the display part. And they should be testable, which means they should run on desktop/server JRE without GWT client dependencies.
So, all the GUI building part should be inside Views. And, yes, you could have multiple Views per Activity if this makes sense. BUt, personally, I'd go with one View that shows details (possibly dialog) when Activity instructs it to.
通常,地点和活动之间应该具有一对一的关系,但每个给定的活动可能有许多视图。在我当前正在进行的项目中,我们为每个 Presenter 及其关联的 View 创建一个接口,然后让我们的 Activity 为其需要显示的视图实现任何 Presenter。
You should normally have a one to one relationship between Places and Activities but you may have many Views per a given Activity. In the project I'm currently working on we create an interface per Presenter and its associated View and then have our Activities implement any Presenters for the Views it needs to display.