0

With the Mvp4g architecture, (Only)one instance of the view (injected using @Presenter annotation)is associated with its presenter. In my case, I have a EntityView with its Presenter EntityPresenter. whenever user clicks on an Leaf node of a Navigator tree, I add a new Tab into TabSet. And this new Tab will contain an EntityView. So, I will have as many EntityView as many Tab in the TabSeT.

I have set multiple=true for EntityPresenter. EntityView's constructor accepts one argument.

@Inject
public EntityView(final Record view) {
  //some initialization
}

Question is, where I do (from another presenter):

EntityPresenter presenter = eventBus.addHandler(EntityPresenter.class);

I have one argument Record params which I want to pass to EntityView's constructor, how to do that? and annotating constructor(accepting argument) with @Inject will inject EntityView to EntityPresenter ?

Matt Aldridge
  • 2,037
  • 16
  • 21
Shanta
  • 262
  • 1
  • 4
  • 15
  • have some clue here http://groups.google.com/group/mvp4g/browse_thread/thread/71efe128ec7c9ec3?pli=1 – Shanta Jan 05 '12 at 10:09

1 Answers1

0

I suggest to use an EventHandler - that's a presenter without a view in mvp4g - which get an event showEntity(long key). In the onShowEntity(...) - method you can create the presenter with the statement:

EntityPresenter presenter = eventBus.addHandler(EntityPresenter.class);

With that reference of the instance, you can esaly set the key in the presenter. But keep in mind, you have to manage your presenter instances by yourself, when using multiple=true.

Andro Selva
  • 53,910
  • 52
  • 193
  • 240
El Hoss
  • 3,767
  • 2
  • 18
  • 24