0

I wanted to delete/clear all the instances of a presenter before firing an event. The documentation says to use eventBus.removeHandler(handler), I am not figure out how to get the handler object from the presenter class

Presenter has multiple=true attribute set.

MeanMan
  • 1,040
  • 10
  • 25

1 Answers1

0

If you have declared a presenter with "multiple="true"

@Presenter(view=OneView.class, multiple=true)
public class OnePresenter extends BasePresenter<IOneView, OneEventBus>{...}

you add the presenter to the eventbus by calling:

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

and remove the presenter by calling:

eventBus.removeHandler(presenter);

Here you will find the documentation:

https://github.com/FrankHossfeld/mvp4g/wiki/04.-Defining-presenters,-views-&-Services#multiple-presenter

In mvp4g you can easily activate and deactive presenters thanks to the activate/deactivate attribute of the @Event annotation. (https://github.com/FrankHossfeld/mvp4g/wiki/03.-Defining-EventBus#activatingdeactivating-presenters)

If you need to get the control just before a presenter handles an event, you can override the onBeforeEvent-method. (https://github.com/FrankHossfeld/mvp4g/wiki/04.-Defining-presenters,-views-&-Services#on-before-event)

El Hoss
  • 3,767
  • 2
  • 18
  • 24