jQuery in Action, 3rd edition
The moose likes OO, Patterns, UML and Refactoring and the fly likes Model-View Connection in MVC Pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Model-View Connection in MVC Pattern" Watch "Model-View Connection in MVC Pattern" New topic

Model-View Connection in MVC Pattern

Santosh Kumar Raju

Joined: Dec 26, 2006
Posts: 5
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.

[Thumbnail for MVC_Design.jpg]

Count down begins for My SCJP Exam.. Wish me ;-)
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
In your diagram, where is the Controller?
Santosh Kumar Raju

Joined: Dec 26, 2006
Posts: 5
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.)

I agree. Here's the link: http://aspose.com/file-tools
subject: Model-View Connection in MVC Pattern
jQuery in Action, 3rd edition