• Post Reply Bookmark Topic Watch Topic
  • New Topic

MVP - how to inform another presenter for changed data  RSS feed

 
olze oli
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a MVP Triad which is used for a jpane with 2 buttons: start download, stop download - i call the triad StartStopMVP.
I also have a JTable which should display the current state of the downloads (progress bar etc.) - can someone tell me how i can access this information without breaking mvp?
I thought in mvp a model should only know its presenter, a view should only know its presenter. the presenter coordinates.
My StartStopMVPs Model has a library which handles the downloads, there is also the information about the state of each download.
How can i access this when i create a new MVP for the jtable, without at least reference StartStopMVP-Presenter in the JTableMVP-Presenter ?
Is there another way than message bus? Or is the usage of the library in the wrong place and i should do that in a static class?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Traditionally the approach I used to follow was use the application JFrame instance as a central broker.
Child panel 1 does something. It then informs the JFrame parent about the status. The parent the further disburses the information as required.
From inside any panel (even nested ones) it is easy to obtain the parent JFrame instance via

However this is not real loose binding.
For that nowadays I prefer an EventBus
https://github.com/google/guava/wiki/EventBusExplained
 
olze oli
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, but thats a passive view. There is no information which is stored in the UI. Its all in the library which is used in the model. I use presenter first so i dont need UI tests
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!