Hi all,
I am still struggling with the GUI implementation. In my first thougts, I considered the TableModel as the "model" in the MVC architecture.
But in fact, the TableModel is tightly coupled with a JTable component and therefore part of the Swing-based view.
If the application should be extended, for example, having a Web-based interface, we have nothing to do with a JTable and the corresponding TableModel. The view now would be a
servlet or
JSP page...
Therefore, I think that the TableModel class should be considered as part of the View. A separate FlightDataModel class would then be necessary.
The same counts for implementing the Controller actions using the javax.swing.Action class. This class is useful when we want to attach the same functionality to menu items and (toolbar)buttons, but again is completly bounded to the use of a Swing gui.
So my question is, can we assume that only Swing clients are used for the application, or should we make the Controller and Model classes completly swing-independent ? If we do, we can still use the swing Action classes, but these would be part of the View instead of the Controller.
The Controller now should contain methods for searcing and booking flights, which recieve some GuiInterface parameter to obtain the search/booking info from the Gui.
View:
MainWindow class, Action classes, TableModel class
Controller class:
Methods for searching and booking flights, recieving a ViewInterface parameter and filling the Model.
Model class:
Contains a private array variable containing the records that may be viewed (= a subset of all records after a search action), a getter method which returns these records, and a method that notifies the Views (called by the controller).
Am I right in my considerations ? Please give my any feedback... :-)
Regards, Klaas
[ August 01, 2004: Message edited by: Klaas van Gelder ]