How to inform presenters of sub views of a main window about global data change in an MVC or MVP GUI app?


Loading ....
 

Software https://softwareengineering.stackexchange.com/questions/387708/how-to-inform-presenters-of-sub-views-of-a-main-window-about-global-data-change

Suppose I”m writting a GUI desktop program that has a window with an presenter. This windows may host one or panels that each have their presenter.
The main window has a an input field.
The panel sub viewpoints will need to respond to an alteration of this option.
When the user alters the international option the major presenter is called, stores the value and informs its view (the main window) of the data change.

My issue is: How can I inform these panel sub viewpoints their controls of the changed global plot length at a way?
I see multiple options but none really feels like a clean answer:

  1. The view notifies all of the panel sub conscious view of the changed gobal choice after it had been called from the presenter.
    The issue with this is, that the view is presently handling the logic of informing the panels, even though the principal window control already knows there are sub panels (To be certain: The most important window control does not have any product references to the panel perspective objects or their control objects, just an id). This lowers the in my view and does not feel fresh.
  2. There could be a shared model between the primary presenter and the presenters of the panel sub views.
    If there has been a panel that is brand new created a reference to the model would need to be passed to the panel presenter. The version would must have an observer strategy to inform each of the presenters of this data change. Until now I thought it is not normal that the version emits events when the data changes in MVP

  3. The presenter advises the board presenters of the change.
    With this particular speaker would have to have a reference to each panel presenter which is not needed. This could complicate the data flow a bit and the moment of passing the board to the principal presenter will be uncertain to me, since the panel viewpoints create their presenters along with the panel perspectives themselves are made as a response of the presenter telling the opinion to make a new weapon.

May be I am missing a strategy or you have any Idea how to structure this into a method that is better.

 


Loading ....
 

Be the first to comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.