File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Still MVC...Please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Still MVC...Please help" Watch "Still MVC...Please help" New topic
Author

Still MVC...Please help

Fred Barnes
Ranch Hand

Joined: Jun 11, 2002
Posts: 62
Hi Guys,
I am still having problems seeing the benefit of have a MVC pattern in the GUI!
With web components like Servlets and JSP it makes prefect sense!
What I understand is that you have one class with all the GUI components and "Hook methods - as Mark explains". Another class which is your controller. And a third class which is your model.
Say for example you decide to extends AbstractTableModel in your model class, that directly links your Model to Swing. Which of these 3 components will you be able to reuses?
The only way I can see reusability is if you want a different GUI, with different layout.
Can anyone explain this to me please?
One last question is whether the View may call methods on the model?
Kind Regards
Fred
Aruna Raghavan
Ranch Hand

Joined: May 14, 2002
Posts: 194
Controller knows about GUI and Model but View should not know anything about the Controller or Model. Also, your table model is not necessarily the same as app model.
As to what other benefits does this offer- a clean separation of functionality and encapsulation of low level connecting, locking etc. Any other ideas?


Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
Fred Barnes
Ranch Hand

Joined: Jun 11, 2002
Posts: 62
Hi Aruna,
Can the GUI calls methods on the Table model class?

Regards
Fred
Aruna Raghavan
Ranch Hand

Joined: May 14, 2002
Posts: 194
Hi Fred,
In my code, view sets up the model initally. But once the controller is called to fetch search results, it updates the model and view gets a tableUpdated event. This is how I've done it.
Aruna.
Fred Barnes
Ranch Hand

Joined: Jun 11, 2002
Posts: 62
Hi Aruna,
Thank you for the reply!
Regards
Fred
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Still MVC...Please help
 
Similar Threads
Design Pattern for GUI implementation
GUI application design
GUIContoller
NX: URLy Bird 1.3.1 Connection Factory Design
MVC for click and drag interface with multiple models