Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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
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.
I agree. Here's the link:
subject: advice on my data design choice
It's not a secret anymore!