ok 0 vor getPageCount() and then -1 for not displaying pages
What to do if PageCount > 0 and currentPage == -1 (then don't display
pages but everything, because you don't want to see a page?)
johan
Christian Essl wrote:
I think pagecount should be able to be 0 (if really no data is
there.. you are displaying the list yes,, but does it display a page??)
Yes I think so too.
if pagecount == 0 then currentPage should just be also 0 (setting it
to -1 can be done in pageablelistview but it will directly be
converted to 0 then)
I think the problem with the current implementation is that if you
call ie setCurrentPage(1) and the pageCount == 0. Than in
setCurrentPage()
if ((currentPage > 0) && (currentPage >= pageCount))
{
currentPage = pageCount - 1;
}
get's executed, which will set the currentPage to -1 (and will also
return it from getCurrentPage()).
In IPageable if getPageCount() does return 0 and getCurrentPage()
should than also return 0 this should be realy documented, because it
is not what someone would excpect.
I'd say returning -1 from getCurrentPage() would fit better. -1 would
just indicate that there is no current page, because there are no
pages. Similar to InputStream.read() or String.indexOf() etc.
Christian
johan
Christian Essl wrote:
Thanks Johan foor providing IPageable, it looks realy good.
I just tried to implement it and had a border-line question:
In case the list size is 0 should getPageCount() return 0 and
getCurrentPage() return -1. Or does getPageCount() have to always
return at least 1 and getCurrentPage() at least 0?.
To figure this out I was looking into PabeableListView, which
implements:
int getPageCount(){
return ((getList().size() + rowsPerPage) - 1) / rowsPerPage;
}
First I think if rowsPerPage is 0 than this will throw an Exception.
Otherwise if list.size == 0 than it always returns 0. Ok. But than I
think the bounding in setCurrentPage() sets the currentPage either
to 0 or -1 depending on the argument.
As said it is a border-line question and as such not so important,
but a clarifying word maybe in the javadoc of IPageable would help me.
Thanks,
Christian
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle
Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing
& QA
Security * Process Improvement & Measurement *
http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user