At the moment, you can't set the number of items on an AbstractPageableView without it also calling getRowCount().

The reason for this is that internalSetRowsPerPage(int) calls setCurrentPage(0), and that itself does a check to see if the page index you're setting is out of range, which causes a getRowCount() to be triggered.

There are two reasons I don't like this:

It's an extra call to getRowCount(). Sure, you could cache this count, but I see no reason to check the size if you're setting the current page to zero.

The main reason I don't like it is that it means you need to know the size when you construct your component. This makes it hard to write subclasses that do set-up in their constructor, as the super-constructor will be calling getRowCount() potentially before you've done that set-up in your chained subclass constructor. It's annoying.

So, the question is, would anyone object if I changed AbstractPageableView#setCurrentPage(int) so that if you pass in zero, it doesn't bother doing the getPageCount() check?

Regards,

Al

Reply via email to