简体   繁体   English

GWT活动-位置=>对话框?

[英]GWT Activity - Places => DialogBox?

I'm trying to use the GWT Activity & Place model, but I'm having some troubles with it about how to use my activities. 我正在尝试使用GWT活动和地点模型,但是在如何使用活动方面遇到了一些麻烦。

I've got a LoginActivity which drives the user to another activity : DemandsActivity. 我有一个LoginActivity,它将用户带到另一个活动:DemandsActivity。

My DemandsActivity manages a view ("DemandsView") which displays a simple list of demands (with a CellTable). My DemandsActivity管理一个视图(“ DemandsView”),该视图显示简单的需求列表(带有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. 我希望能够通过显示包含信息的DialogBox从我的cellTable的选定行中显示需求的详细信息。 I thought I could use one more activity to do that : DemandDetailsActivity. 我以为我可以再使用一种活动: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 ? 一个演示者显示我的CellTable,另一个演示者在对话框中显示我的CellTable的选定元素,而无需更改Place?

What do you think of that ? 你对那个怎么想的 ?

Thanks 谢谢

What you are trying to do is called master-detail view. 您尝试执行的操作称为主从视图。 People have been implementing it with GWT, just google around. 人们一直在用GWT来实现它,只是在Google周围。

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. 附带说明一下:用MVP的话来说,活动是演示者,视图是显示,所以当您说put several presenters (displays) into my activity这确实没有任何意义。

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. 而且它们应该是可测试的,这意味着它们应该在没有GWT客户端依赖性的桌面/服务器JRE上运行。

So, all the GUI building part should be inside Views. 因此,所有GUI构建部件都应位于View内部。 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. 但是,就我个人而言,我将使用一个在Activity指示时显示详细信息(可能是对话框)的视图。

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. 在我目前正在从事的项目中,我们为每个Presenter及其关联的View创建一个接口,然后让我们的Activity为需要显示的View实现任何Presenter。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM