How to notify other views by a view in MVC pattern?

I have read some document about MVC pattern, then I used it in a desktop software. The software has many GUIs. When I write the first GUI, I use the MVC pattern to split it to 3 parts. It's easy and clear. But When I add another GUI into this software, I am confused about it:

  • Two views have to communicate with each other. When I click a button in first view(AView), the second view(BView) will be changed. When I click a button in BView, the AView will be changed. How to notify each other using MVC pattern? should the controller(AController) of AView hold a reference of BController?

  • Another question. If the View is nested, How does child view notify its parent? In some articles it was said that the nested view should use the Composite pattern. The parent has responsibility to notify its child, but not reversed. Should the child hold its parent reference? And notify each other without controller?

  • The last question is the location of creating instance. In a general way, the controller will hold the reference of view and model. So it is reasonable to create the instance of view and model in controller. But if the view is nested, parent view will create the child view. How does the child controller get the child view? Should the child controller hold the parent view's reference? I think All of that is unnecessary reference.

  • 链接地址: http://www.djcxy.com/p/50148.html

    上一篇: Java正则表达式提供任何性能优势?

    下一篇: 如何通过MVC模式中的视图通知其他视图?