Skip to content

Presenter state

Ahmad K. Bawaneh edited this page Nov 7, 2021 · 1 revision

We can make a presenter to fire an event when ever it is activated/deactivated to track its state from other parts of the application, we do this using the @OnStateChange annotation which takes a single argument that represent the event class that extends from ActivationEvent, if we add such annotation to the presenter, the event will be auto fired when the presenter is activated/deactivated.

import org.dominokit.domino.api.client.annotations.presenter.OnStateChanged;

@PresenterProxy
@AutoRoute(token = "home")
@Slot("content")
@AutoReveal
@OnStateChanged(HomeActivationEvent.class)
public class HomeProxy extends ViewBaseClientPresenter<HomeView> implements HomeView.HomeUiHandlers {

}

Later when we discuss Events we will see how we can listen to and use such events.