This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes JTable Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "JTable Question" Watch "JTable Question" New topic
Author

JTable Question

Aruna Raghavan
Ranch Hand

Joined: May 14, 2002
Posts: 194
Hi,
I have implemented the gui such that my controller contains and updates the table model when search data comes back from the server. this is automatically updating my gui table without the gui having to process 'tabledChanged" or any other kind of events. Is this how the table model works?
Thanks,
Aruna.


Aruna A. Raghavan<br />SCJP, SCJD, SCWCD
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

I have implemented the gui such that my controller contains and updates the table model when search data comes back from the server. this is automatically updating my gui table without the gui having to process 'tabledChanged" or any other kind of events. Is this how the table model works?

Sounds like your table model acts as an application model in your MVC. I would actually have a separate class to be a model, which in turn can call the methods on table model. The reason for that is to make your models coherent: your table model responsibility should only be setting the data in JTable, while your application model responsibility is to implement business logic, such as searchFlights() and bookFlights() methods.
The key here is that all methods of a class (any class) should be on the same level of hierarchy. So if you see a class something like below, something is wrong:

Eugene.
Aruna Raghavan
Ranch Hand

Joined: May 14, 2002
Posts: 194
Eugene,
I should have been more descriptive-
I have a View, Controller and a Model for the app.
I have separate classes for TableModel, CellRenderer and CellEditor.
Controller calls the app Model to fetch data from the Server. Then the controller sets data in the TableModel which causes the GUI to update the view.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTable Question
 
Similar Threads
Questions about MVC
Problem Updating JTable
Is this MVC?
Is MVC Pattern Overkill?
Question about initial dispaly of table