adgfs
adgfs

Reputation: 423

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-client-factory-example/

I will be glad to know other opinions.

Thanks

Upvotes: 4

Views: 1609

Answers (1)

brakebg
brakebg

Reputation: 414

You are not required to use it, for example it's a good practice to user Gin (Dependency injection for client in gwt).

Upvotes: 2

Related Questions