Your web application can be seen as a tree of Presenters. Walking the tree from bottom to top, onBind
will be called on each Presenter. Once all Presenters are bound, onReveal
will be called on each Presenter, from the top to the bottom of the tree. The prepareFromRequest
method will be called before onReveal
.
So, onBind
will be called first on ChildPresenter, then onBind
will be called on ParentPresenter, then onReveal
will be called on ParentPresenter, and finally onReveal
will be called on ChildPresenter.
There's no risk that ChildPresenter will not be initialized when ParentPresenter checks the session.
To communicate from the ParentPresenter to the ChildPresenter, I suggest 2 approaches:
When the session is fetched by ParentPresenter, ParentPresenter fires a
SessionLoadedEvent
through theEventBus
, and ChildPresenter registers to that event and reacts to itWhen the session is fetched by ParentPresenter, ParentPresenter calls
childPresenter.onSessionFetched(sessionData)
directly. ChildPresenter will do whatever he wants withsessionData
inside theonSessionFetched
method.
You can also see this https://github.com/ArcBees/GWTP/wiki/Presenter-Lifecycle