• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

MVC with multiple models ???

 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello:
I started my design from GUI. I decide to use MVC design pattern for GUI design. I have already had the View done. I have several questions related to the GUI design. I need some comments and helps.
My view is called FlightView. It is composed of:
a) TablePane (derived from JScrollPane) which contains a table.
b) SearchPanel - It has several comboboxes and a search button that allows user to choose and serch the database.
c) ReservePanel - It has textfield and button which allows user to enter the number od seats to reserve.
d) Menubar - Has three menus - File, Connect, and Help
e) Status bar - show the processing result
My question are:
1) Since the View is composed of different panels, should I have separate models for these panels ? Can I design a single model ? How about controller ?
2) How does View get notified of change from model ? I know that Observer design pattern might be a good choice. However, Table model seemingly does not need that.
3) The exam requires user to do the search. In order to allow user to serach, I have to design some method like "getSearchCriteriaData" in the controller to get origin, destination, carrier info from database to populate the combo boxes.
Will this method caused the "lock" and "unlock" to be called ? From the assignment description, it seems that the databse should be locked even the user just do the reading. However, this retrival of information is not caused by user interaction. Can the client get the initial search criteria data by reading the database without locking ?
Please gime me the necessary comments ?
 
ranger
Posts: 17346
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
1. You can design a single model or multiple models it is up to you. As far as controllers go, I'd suggest just one.
Now as far as models go, you will have the TableModel, and the class "Facade" to access the Data class.
2. The controller controls all the dealings going on. So the controller will cause the model to change, know when it is changed and therefore updates or tells the view that the model has changed.
3. No locking is needed when reading. Only lock when you about to modify the data only.
Good Luck
Mark
 
John Chien
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.
I think I am going to implement only one model and one controller. That will make things simpler.
reply
    Bookmark Topic Watch Topic
  • New Topic