• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Still MVC...Please help

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Fred Barnes
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Aruna,
Can the GUI calls methods on the Table model class?

Regards
Fred
 
Aruna Raghavan
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Aruna,
Thank you for the reply!
Regards
Fred
 
reply
    Bookmark Topic Watch Topic
  • New Topic