Results 1 to 2 of 2
Thread: MVC question
- 08-12-2010, 11:21 AM #1Member
- Join Date
- Aug 2010
- Rep Power
Hi I've been reading up on MVC recently, and it makes sense to me. Until I start to get more than one MVC triad.
After reading this: How to use Model-View-Controller (MVC)
I understand the idea of subviews and the hierarchy but in practice I'm getting confused.
Let's take a simple scenario, I have a subview (e.g. a progress bar) which is showing the progress of a file download. Obviously all the processing is being done in the related model.
Using the observer pattern, the view can be notified of updates.
This is all fine, makes perfect sense and works well.
My problem, then, is how do I put the progress % into the parent view's window title.
The window is it's own MVC triad. How does this:
Firstly, access the information of its subview (it seems that it should be reading from the model of the subview rather than the view itself). Should its own model have access to the subview's model? Should the subview have access to its parent and tell that to update when it's updated itself?
Secondly, know when to update?
I think I understand the general concept behind MVC but once I have two (or more) triads which need to share information I get confused.
Thanks for any help!
The "parent" has to have its own controller, its own listener, to listen to the model. It will respond the the listener's notification and will update accordingly.
- By orchid in forum Advanced JavaReplies: 9Last Post: 12-19-2010, 09:49 AM
- By Kam in forum JDBCReplies: 0Last Post: 01-07-2010, 07:11 PM
- By Java_Fanatic in forum New To JavaReplies: 10Last Post: 10-13-2009, 11:18 PM
- By jameela in forum New To JavaReplies: 4Last Post: 10-13-2008, 12:38 PM
- By javaplus in forum New To JavaReplies: 0Last Post: 12-24-2007, 11:18 AM