This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Application structure...

 
Eric Roy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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
 
friso dejonge
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • 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
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even though you use multiple Frames, one controller should be enough
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic