Suppose I'am writting a GUI desktop application which has a main window with a corresponding presenter. This main windows may host one or multiple panels which each also have their own presenter. The main window has a an input field where the user can set a global option. The panel sub views need to react to a change of the global option. When the user changes the global option the main presenter is called, stores the value and notifies its view (the main window) of the data change.
Now, my question is: How do I inform these panel sub views respectively their controllers of the changed global plot duration in a clean way respecting the pattern? I see multiple options but none really feels like a clean solution:
The view notifies all the panel sub view of the changed gobal option after it was called by the presenter.
The problem with this is, that the view is now handling the logic of informing the panels, even though the main window controller already knows that there are sub panels (To be specific: The main window controller does not have any object references to the panel view objects or their controller objects, only an id). This reduces testability in my opinion and, while working, doesn't feel clean.
There could be a shared model between the main presenter and the presenters of the panel sub views.
If a new panel is created a reference to the main model would have to be passed into the panel presenter. The model would also need to have an observer approach to inform all the presenters of the data change. Until now I thought it's not typical that the model emits events when the data changes in MVP
The presenter informs the panel presenters of the change.
For this the presenter would need to have a reference to each panel presenter which is currently not needed. This would complicate the data flow a bit and the moment of passing the panel presenter to the main presenter would be unclear to me, because the panel views create their presenters and the panel views themselves are created as a reaction of the presenter notifying the view to create a new panel.
May be I am missing an approach or you have any Idea how to structure this in a better way.