Using JCTable with an AbstractDataSource model. The JCTable lets the user show and hide rows, and also sort the rows by columns. Problem is, when the user asks to show a row, we cannot obtain the actual data in the hidden rows. (We want to show those data values to the user so he can pick which row to show. He doesn't think in terms of row numbers.) The JCTable provides us row numbers in table coordinates, but in order to get the data from the model we need to know the equivalent data coordidate - they are not the same because of the sorting. How can we do this conversion? Or is there another way to get the entry in a particular column of a row, when the row is both hidden and sorted?
Get the data from the model, not the table.
The key is to realize that you can implement JCSortListener, and it gives you a callback after the table is sorted, which includes an integer array providing the mapping between the sorted rows and the datasource. You can then use that integer array to provide the mapping between the table rows and the datasource rows, even for the hidden rows.
OS: windows Xp
java version 1.5.2.