Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

advice on my data design choice  RSS feed

 
Nate Johnson
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
Thanks,
 
Gosling Gong
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!