In clients' displaying table, I can easily get the selected row number, but that number is not recNo which I need to pass into book(int recNo). How to transit selected row number to recNo? Thanks for your help.
I tweaked the method in my remote interface (but not the method in the Data class) to also return the long recNo to the calling program along with all the other data. Because I am going to need the long recNo in case I want to lock, unlock, update, etc..
SCJP - 1.4
SCJD - (B&S) Used 1.5 And It Runs On Solaris10
SCWCD - Thanks to HFSJ!!
Joined: Jan 25, 2006
My present solution is like that: in HotelBusiness' search(String name, String city) method, I return a String value named records = new String[v.size()]; v is an Vector object which stores the name and city exact matched records. Every record has 7 items and I want to let the recNo to be the 8th item. "String records " will be passed to HotelRemote and finally to BusinessClient in client layer, and right there it will translate to a String that will be passed into my AbstractTableModel's subclass.
that's pretty much how I do it. I've packed the data (including the record number) in a class with more natural names for the fields. My TableModel just maps those fields to columns, and doesn't return the record number as the JTable has nothing to do with it.
I've added a method to the TableModel to retrieve that object complete (so including the record number) for passing to for example the booking dialog.
The search function returns from the database engine with a Map of string arrays using the record number as key (I wrapped the DB interface in another interface to achieve that effect, adding a few methods. That interface in turn is wrapped in another interface which adds the networking exceptions).
subject: How to get the recNo from client's record displaying talbe?