This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Model-View Connection in MVC Pattern

 
Santosh Kumar Raju
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I feel what i will be working for is good candidate for MVC Design Pattern.
However I am held up with my "Model" and ways to update the "View" decision.
(I refered to other posts related to MVC and found out that "Model" design is something always interesting and bit difficult/confusing to start with).

Heres what the application does:
Its a "Multi-level" UI based application (ie one UI Screen for getting data from Producer for populating the screen and other UI for configuring the Producer state etc. Please read on for more info on "Producer").
I have no problem with "View" and "Controller" part since Swings implements the MVC Patterns itself.
However here is my "real hang":
User modifies an UI Element (lets say check box is clicked), "Controller" picks up the change in state and this info is passed on to "Producer" which is another system over ethernet link. The "Producer" replies back and based on reply the UI Element state is changed (ie to keep the checkbox selected or not, update JLabel content etc).
Refer attachement for Pictorial Representation (I truly belive "Picture speaks thousand words" ;-) )
The UI Application has no state of itself and everything depends on what is received from the "Producer".
Dreaded (atleast for me) question: Based on the attached picture "Worker" becomes my "Model" of MVC. However, what would be best way of updating the "View" whenever "Producer" Posts a change in state to the Application or User does a change and this change needs to be updated on view(based on reply from "Producer").
I guess what i am looking for is a good way to inform my "View" from my "Model" that you need update your view state.

I personally feel it would not be a good to have a reference of all the UI Frames in "Worker" and update accordingly.

Please let meknow in if my doubt isnt clear, i have tried my best to put forward in good way.
MVC_Design.jpg
[Thumbnail for MVC_Design.jpg]
Refered Attachment
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your diagram, where is the Controller?
 
Santosh Kumar Raju
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi James,

Extremely sorry for not having replied soon.
Was down with health related probs
Hale and kicking now.

The controllers are the "associated Action Listeners" for user interface elements (ie check box etc.)

regards,
Santosh.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic