• 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

Application structure...

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I'm currently working on the UI part of my project and have some questions regarding application structure. I'm very familiar with the MVC concept, but I'm not sure how to put it all together. Here's my current situation.
I have a main client application class which instantiates and displays my main frame (Frame subclass). This frame is composed of a menu, toolbar and 3 panels (JPanel subclasses): a search panel, a results panel and a book a seat panel. I designed my GUI this way so that these panels might eventually be reused. Now, I understand that swing components have a models (my results panel has a JTable which has a FlightsTableModel). But my question is should my search, result and book a flight panels have models and controllers as well? At an even higher level, should my main frame contain a controller and model? Perhaps this is overkill?
Any thoughts would be greatly appreciated.
Regards,
Eric
 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I have a main client application class which instantiates and displays my main frame (Frame subclass). This frame is composed of a menu, toolbar and 3 panels (JPanel subclasses): a search panel, a results panel and a book a seat panel. I designed my GUI this way so that these panels might eventually be reused. Now, I understand that swing components have a models (my results panel has a JTable which has a FlightsTableModel). But my question is should my search, result and book a flight panels have models and controllers as well? At an even higher level, should my main frame contain a controller and model? Perhaps this is overkill?


i guess your frame controlls all views (searchpanel, resultspanel and bookpanel) and creates a model (flighttablemodel).
All views are using the same data which is in the model, they just have a different output. One is showing only possible searches, one is showing the output of the search and one is holding (maybe showing the selected item). This does mean they are all using the same model.
Above i am just describing my design. One controller which is a frame, three views which are panels and one model, which is derived from abstractTableModel.
I may be wrong, but i think you are pretty much there.
regards,
friso
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even though you use multiple Frames, one controller should be enough
Mark
 
What? What, what, what? What what tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic