my dog learned polymorphism*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes advice on my data design choice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "advice on my data design choice " Watch "advice on my data design choice " New topic

advice on my data design choice

Nate Johnson
Ranch Hand

Joined: May 13, 2002
Posts: 301
I am trying to find a good way to get different sets of data back into the JTable. I have a model that has a reference to data (indirectly through an interface so it works the same locally and remotely) and I can get ALL of the data just fine. I am having trouble trying to figure out how to get a subset of the data (after a search) back into my model. My model is an extention of AbstractTableModel.
I am thinking of adding a local DataInfo array to the model and using that instead of data.getRecord()... in the getValueAt(row, col) method. Then just set that array every time a search is performed.
Does that sound like a good idea or not?

scwcd, scjd, scjp<br /><a href="" target="_blank" rel="nofollow"></a><br /><a href="" target="_blank" rel="nofollow"></a>
Gosling Gong
Ranch Hand

Joined: Jun 20, 2002
Posts: 51
I am doing the same, I don't like the table model to ask data directly from database, I put that in the mediator/controller to do so and then set the data for the table model, and the model will fire tabledatachanged event to refresh the table view.
jQuery in Action, 2nd edition
subject: advice on my data design choice