Magnolia 5.7 reached extended end of life on May 31, 2022. Support for this branch is limited, see End-of-life policy. Please note that to cover the extra maintenance effort, this EEoL period is a paid extension in the life of the branch. Customers who opt for the extended maintenance will need a new license key to run future versions of Magnolia 5.7. If you have any questions or to subscribe to the extended maintenance, please get in touch with your local contact at Magnolia.
Magnolia uses the model-view-presenter pattern. The separation of views and presenters is done consistently throughout the application on server and client and within complex components. The presenter reacts on events raised by user interaction, driving the view by populating it with data to display.
Magnolia uses a model view presenter pattern to handle UI events.
- The View does not implement business logic or communicate with the Model. The view provides the interface to the end user and reacts on and informs the Presenter about user actions (input).
- The View and Presenter communicate together.
- The Presenter uses the Model to fetch data and implements business logic, informing the View to display content (such as a form).
- The View interface defines a Listener interface that is implemented by the Presenter. The purpose of the Listener interface is to ensure that the view does not inadvertently communicate to the Presenter.
- The Listener methods are implemented by the Presenter; the callback methods from the view to the Presenter.
Presenteronly knows about the
View's Interface; this ensures that the
Presenteris not bypassing the pattern and cannot directly communicate to the
MVP and the app framework
Here we look at an example of how the MVP pattern is employed in a subapp.
- The View's interface defines an inline
Listenerinterface with the method
2. The Presenter (subclass) implements:
Viewinline listener interface and the
greetUser(String user)callback method. The method is called by the View (via the listener) on user input through the UI.
- The interface type of the View is determined by the
The Presenterregisters itself as the
View's Listener using the
- In the
View calls the
Presenter via the