Search code examples
javagoogle-app-enginegwtgwt-mvp

Based on the MVP (Model View Presenter) how should I implement this?


I have a app on Google App Engine and I'm using GWT, and when the user goes to www.myapp.com/#show I need to show a graph, and in that page there is a button to search and add nodes to that graph, when the search Button is clicked I need to show a popup with the search form (it has several functions and dialogs).

Can I create a view for that page and another view for the popup and use the same presenter for both?

or What is the best way to implement that based on the pattern MVP?


Solution

  • MVC(Model View Controller) style tells that you have this three packages for Entities, UI, Controller classes. This help you organize your code and break it to plugins.

    As for your question it is better if you can implement a CustomPopUp class in the View(UI) package and make it abstact. So PopUp could have as parameters the message the context or everything it needs to show the approprate message.

    And you can pass CustomPopUp as private delegator to your UI classes who need to show popup messages.