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 ?
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