// you get "1-1 of 0") and "1 of 1" when there is only one record
// (otherwise you get "1-1 of 1"). Not internationalised (but
// neither is SimplePager). There's also a special case if the
// final page is empty: we get "> 10 of 10" instead of "11 of 10".
NumberFormat formatter = NumberFormat.getFormat("#,###");
HasRows display = getDisplay();
Range range = display.getVisibleRange();
int pageStart = range.getStart() + 1;
int size = range.getLength();
int dataSize = display.getRowCount();
int endIndex = Math.min(dataSize, pageStart + size - 1);
endIndex = Math.max(pageStart, endIndex);
boolean exact = display.isRowCountExact();
if (dataSize == 0) {
return "0 of 0";
} else if (pageStart == endIndex) {
if (pageStart > dataSize) {
// This is better than "11 of 10" if the final page is empty