Details
-
Bug
-
Resolution: Done
-
Neutral
-
None
-
None
-
None
-
None
Description
Draft page on MVP needs completion: http://documentation.magnolia-cms.com/display/DOCS/Model-view-presenter+pattern
- History: Google/GWT and Vaadin recommend using an MVP pattern
- Reasons why you should follow MVP:
- Separate business logic from rendering. The logic is in the presenter. View doesn't know about the model.
- Flexible: You can easily change the view implementation. We don't do it in Magnolia but in theory you can.
- It is easier to test when logic is separated from rendering. Better testability.
- Simple use case: creating your own view
- When creating your own UI, you need to:
- Define a view MyCustomView by creating a view interface which extends the ContentView interface which is provided by Magnolia. Add an inner interface called Listener.
- Implement your own presenter MyCustomPresenter. It must implement ContentPresenter which is provided by Magnolia and MyCustomView.Listener.
- Create a real view implementation which implements MyCustomView = this would then be MyCustomViewImpl
- The draft document shows the workbench view which is very complex. Instead, show a simple UI: SampleApp
- Change the code snippets
- Change the diagrams to show the code example
- Does the event bus belong to the MVP topic?
- Check which diagrams we need and labels
- Annotate the diagrams
Checklists
Acceptance criteria