FilteredRowSet size



Hello,

I'm working on a Swing app. I want to show a pair of parent/child
JTables so that selection within the parent drives filtering in the
child. It seemed to me that FilteredRowSet would be ideal for this.
So I wrote a TableModel on top of a FilteredRowSet. I can vary the
filter and get different sets of information in the JTable.

It almost works. The problem is in my implementation of getRowCount.
It seems that FilteredRowSet doesn't override the CachedRowSet
implementation of size() to tell me how many rows are in the filtered
subset. calling last() and getRow() doesn't work cause I get the row
number relative to the superset of results.

The only way I see to make it work is to first() and next() till the
end and count the rows myself. That seems insane and terribly
inefficient. Am I wrong? Please tell me that there's a better way.

Thanks

.



Relevant Pages

  • Re: FilteredRowSet size
    ... JTables so that selection within the parent drives filtering in the ... It seemed to me that FilteredRowSet would be ideal for this. ... The problem is in my implementation of getRowCount. ...
    (comp.lang.java.databases)
  • Re: FilteredRowSet size
    ... getRowCount function in my model to decide how many rows to draw and ... are in the filtered subset. ... JTables so that selection within the parent drives filtering in the ... It seemed to me that FilteredRowSet would be ideal for this. ...
    (comp.lang.java.databases)