Ok, let me explain with a partial hierarchy of presenters in
PuzzleBazar:
RootPresenter
+-- PuzzlePresenter OR
PagePresenter
+-- TopBarPresenter (PresenterWidget)
+-- SplitMainPresenter
+-- MainPagePresenter OR
| UserSettingsTabPresenter OR
| AdminTabPresenter
+-- LinkColumnPresenter
(First off: it's a little too much. KISS should have dictated that I
leave out SplitMainPresenter until I really needed it.)
So, why LinkColumnPresenter?
1) Why is it a Presenter and not a PresenterWidget
It could have been a PresenterWidget, but I wanted to keep
SplitMainPresenter oblivious to the presenter displayed in its left
slot. Basically, the reasoning was: SplitMainPresenter never has
anything to say to LinkColumnPresenter so it should not discuss with
it and it should not be responsible of managing it.
2) Why not use placeManager.revealPlace?
LinkColumnPresenter is not a place, it is not something you can
navigate to on its own. MainPagePresenter is (and other presenters
under UserSettingsTabPresenter and AdminTabPresenter), but it wouldn't
make sense to bookmark, say, #link_column. Moreover, doing it this way
would be asking for trouble. The call sequence would look something
like:
- User navigates to #main
- MainPagePresenter reveals itself in SplitMainPresenter
- SplitMainPresenter.onReveal is called, so it knows something is
needed in its left slot
- It calls placeManager.revealPlace(...) with #link_column
- The place manager updates the browser url to #link_column
You can see this is fishy. Using an event, the two last steps become:
- It fires RevealDefaultLinkColumnEvent
- LinkColumnPresenter gets the event and reveals itself
Hope it helps!
Philippe