I need to convert the following AngularJS application to a GWT application (though the question applies to any angular application). I would like to use the MVC pattern and UiBinder as suggested in the documentation but I'm unsure as to how the components of the angular application should correspond to the GWT one.
I've given it some thought already and here's my understanding - I'd be grateful if someone could say if I've got it right
- Each module should become a presenter
- One view per presenter
- Services must be initialised in the AppController and passed to the relevant presenters (similarly to how an eventBus is implemented in the MVC description)
Now I don't know how to put multiple presenters together, though, so that they create one page. Should I create a main view that would correspond to the AppController and then pass the relevant parts of that view to each presenter?
Also, what's the best way to handle modal dialogs? Should I just include them in the view, bind to the presenter and keep them hidden initially?
I would recommend to use either Activities and Places or a fully fledged MVP framework like GWTP.
Regarding your questions:
PresentersIt depends if you use
Activities and PlacesorGWTP.GWTPhas the conecept ofPresenterWidgetthat can be nested inPresenters. ForActivities and Placesyou can follow Thomas Broyer's recommendation.In general I think
Presentersand their correspondingViewsshould be standalone components that are usually associated with aPlace.GWTPhas the concept ofSlots(i.e. side navigation, etc) wherePresenterscan reveal themselves.Communication between
Presentersshould be done via theEventBus.GWTPhas a concept ofPopupPresentersbut typically I think modal dialogs should be included in theViewand handled by the parentPresenter(unless it contains a lot of business logic).