javagwtgwt-activities

GWT Activities & Places - Panel in EntryPoint


Going over the GWT Activities and Places tutorial (here: http://www.gwtproject.org/doc/latest/DevGuideMvpActivitiesAndPlaces.html), a SimplePanel is constructed in onModuleLoad() in the EntryPoint class and then added to the RootPanel. Doesn't this break the MVP pattern or does the EntryPoint technically fall within the view portion of Model-View-Presenter ?

Also, on a related note. I'm not quite clear on what passing the panel to setDisplay() on ActivityManager does. The documentation says "Sets the display for the receiver, and has the side effect of starting or stopping its monitoring the event bus for place change events.". I can't visualize what that means, and looking at setDisplay(), I still can't visualize what they mean.


Solution

  • Activities & Places is not about MVP, it's about navigation within the application, and organization of your code and decoupling. See http://blog.ltgt.net/gwt-21-activities/
    If you want to do MVP in your EntryPoint, you're free to do it; just retrieve your panel (as an IsWidget) out of your view to pass it to your ActivityManager.

    As to setDisplay, it sets the IsWidget that your activities will receive in their start() method.