Creating dynamic view in GWT using MVP Arch
开发者_如何学运维I am starting new project using GWT but in this project view will be dynamic. I will read all metadata from XML configuration files and create view according to this metadata. I want to use MVP architecture with GWT but I need to know how I can use MVP for dynamic view, because all samples I see have static contents. Do you have any suggestions?
The whole point of MVP is to have a very thin View and all application logic inside Presenters, so that Presenters can be unit tested locally without a View (which needs a browser).
Usually there is one View for one Presenter. In your case Views are going to be generated dynamically, which means there would be one DynamicView (loading different XML) and various Presenters each corresponding to one XML. It would make sense that Presenters are starting the DynamicView with the correct XML.
Google just released GWT 2.1 which introduces new MVP functionality: http://code.google.com/webtoolkit/doc/trunk/DevGuideMvpActivitiesAndPlaces.html
精彩评论