design-patternsmvpenterprisegwt-mvpmultiple-views

MVP: multiple Views one Place


I am currently working on a web application that should implement the MVP design pattern, and I'm a little bit confused:

  1. The app will only have one Place to show composed by three smaller Views, there's no possibility to go in another Place just to interact with the Views(selecting something from one View will require the other two Views to load some different data and let them the possibility to edit it), is it a good idea to use MVP in this case?
  2. Supposing I will continue using the MVP design pattern, is it correct to have only one Place in which I will have three different Views(Activities)?The question rises because all the web applications that I looked over usually have One Place-One Activity relation and it makes sense because when you surf to another page, it represents another Place with its own Activity(not my case).
  3. Furthermore how should I let the Presenters of each View interact with one another? As I need for example on a ClickEvent in the first View, to announce the other two Views that they should load some data depending on the selected item? Should I use only one Presenter to take care of all the business logic in the end?

Solution

  • You could make the view where something is selected the master, containing the other two as sub views. Even so you have a master presenter und two subpresenters. If the selection in the master view changes, the master presenter tells the sub presenters to reload new data. The subviews and subpresenters do not need to know about their masters.