I'm trying to learn both GWT-recommended MVP and their Activities & Places API (yes, I know they are two different things, but they seem play nicely into each other).
In a lot of code examples of Activities/Places, I keep seeing the following similar code in the AbstractActivity
impls:
@Override
public void start(AcceptsOneWidget containerWidget, EventBus eventBus) {
view.setPresenter(this);
containerWidget.setWidget(view.asWidget());
}
I believe the first line (view.setPresenter(this);
) is to create bi-directionality between the View and the Presenter. But I'm not sure what the 2nd line (containerWidget.setWidget(view.asWidget());
) accomplishes. So, 2 questions:
- What is
containerWidget
? Where does it come from? Is it what is attached to theRootPanel
? In other words, what is the value of setting our View to it? - Why does the
AbstractActivity#start(...)
method accept anEventBus
arg? Is it required and/or typical to send/receive events to/from the bus from inside this method?