The correct way to structure a GWT app
I am embarking on my first GWT app and I am using GWT Platform which is based on the talk开发者_如何学Pythons Ray Ryan gave at Google IO about MVP. I am trying to structure my app the correct way. My understanding is that I have a presenter for every view in the app and every view is essentially a page in the app.
Where I get confused is how to handle non-dynamic pages. Like say you have just an 'About' page(like the one on Stack Overfliw) which has no interactivity at all. Would you still define a presenter and view for that?
The other part of this question is do you only ever have one html file in the app that all the compiled javascript is loaded into?
yes, for the second question. only one html page. all you do is switch panels inside that html. when you do a RootPanel.get( ['id'] ).add() you're actually changing only a part of the page.
as for about page, not really needed to implement a presenter. a presenter defines 'events' that will happen on your view, so your view can call those methods on your controller. if the view does not have any events happening, it doesnt need a controller. no point implementing nothing :)
精彩评论