Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Booking method

 
joey phillip
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to get the recordNumber when the users selects specfic row in JTable?
I am trying to implement the book method in client side and in my AbstractTableModel class i am using Object [][].
joey
 
Matt DeLacey
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try getSelectedRow() of class JTable.
With Respect,
Matt
 
joey phillip
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Matt !
Thanks for your response

I am talking about DataInfo's recordNumber field(Unique key).

How do you get recorNumber for lock() and unlock()?
joey
[This message has been edited by joey phillip (edited March 27, 2001).]
 
Paul Smiley
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to keep a hash table or something on the client to hold the record numbers
 
joey phillip
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi paul,

Can it be a Vector inside the MyTableModel class ?
read http://www.javaranch.com/ubb/Forum25/HTML/000552.html

Are you storing all db records in the hastable or only the
records which matches searchcriteria?

Thanks
joey
 
Matt DeLacey
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are keeping a vector or some such in your tablemodel, which seems like the way to go to me, then you don't need to explicitly also track the recordnum. You can access it through the DataInfo class. I don't know what you're storing in your Vector, but if you'll just store DataInfos, you can readily access the recordnum. That in conjunction with a getDataAt in your TableModel. Does that answer your question?
With Respect,
Matt
 
Matt DeLacey
Ranch Hand
Posts: 318
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But you'll need to get an updated (i.e. from db.db) version using
the recordnum else the data might be stale.
 
joey phillip
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Matt,
Yes. I am storing DataInfo objects in Vector. after every search the Vector will be updated with new data and will be populated in JTable.
Thanks
joey
 
luis veron
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
I think what joey is trying to point here is when you format your table (tablemodel), were not going to include the record number (visible) in the table itself. Only the values, in this case the array of strings in Datainfo (String[] values).
I was kind of thinking on including the record number but it should only be in the background. as in invisible? So when you select a row, you only need to get the record number. Though, I haven't started implementing this idea. What do you think guys...
regards,
luis
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic