aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Application structure... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Application structure..." Watch "Application structure..." New topic
Author

Application structure...

Eric Roy
Greenhorn

Joined: May 21, 2002
Posts: 4
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

Joined: Jul 11, 2002
Posts: 162

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


swimming certificate (A & B), shoelaces diploma, and some useless java ones.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Even though you use multiple Frames, one controller should be enough
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Application structure...