开发者

Why should i use ClientFactory in MVP GWT project?

It's obviously i m new in GWT , so i m wondering when and why ClientFactory could/must be use? I will be glad if anyone explain me. Also is Activities and Places are tied with ClientFactory ? Can i use them without implementing ClientFactory? Actually i know that Places could be use because i did it but what about Places? I'm quite confusing about all this staff.

P.S all is in MVP.

Let me give some example:

I hava a AppController which takes care for the app navigation

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-c开发者_运维百科lient-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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜