[英]Why should i use ClientFactory in MVP GWT project?
It's obviously im new in GWT, so im wondering when and why ClientFactory could/must be use?这显然是 GWT 中的新功能,所以我想知道何时以及为什么可以/必须使用 ClientFactory? I will be glad if anyone explain me.
如果有人解释我,我会很高兴。 Also is Activities and Places are tied with ClientFactory?
活动和地点是否也与 ClientFactory 相关联? Can i use them without implementing ClientFactory?
我可以在不实现 ClientFactory 的情况下使用它们吗? Actually i know that Places could be use because i did it but what about Places?
实际上,我知道可以使用 Places,因为我这样做了,但是 Places 呢? I'm quite confusing about all this staff.
我对所有这些员工感到很困惑。
PS all is in MVP. PS一切都在MVP中。
Let me give some example:让我举个例子:
I hava a AppController which takes care for the app navigation我有一个负责应用导航的 AppController
public class AppController implements net.customware.gwt.presenter.client.Presenter, PlaceRequestHandler
@Inject
public AppController(EventBus eventBus, MyGinjector ginjector)
{
this.eventBus = eventBus;
this.ginjector = ginjector;
bind();
}
...
public void onPlaceRequest(PlaceRequestEvent event)
{
String id = event.getRequest().getPlace().getId();
if (id != null)
{
;
if (id.equalsIgnoreCase(Presenter1.PLACE.getId()))
{
presenter = ginjector.getPrsenter1();
}
else if (id.equalsIgnoreCase(Presenter2.PLACE.getId()))
{
presenter = ginjector.getPresenter2();
}
refreshDisplay();
}
}
...........
but i have read this article http://www.bright-creations.com/blog/gwt-2-1-mvp-client-factory-example/但我读过这篇文章http://www.bright-creations.com/blog/gwt-2-1-mvp-client-factory-example/
I will be glad to know other opinions.我很高兴知道其他意见。
Thanks谢谢
You are not required to use it, for example it's a good practice to user Gin (Dependency injection for client in gwt).您不需要使用它,例如使用 Gin(gwt 中客户端的依赖注入)是一个很好的做法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.