use of com.google.gwt.view.client.HasRows in project blogwt by billy1380.
the class SimplePager method createText.
/**
* Get the text to display in the pager that reflects the state of the pager.
*
* @return the text
*/
protected String createText() {
// Default text is 1 based.
NumberFormat formatter = NumberFormat.getFormat("#,###");
HasRows display = getDisplay();
Range range = display.getVisibleRange();
int pageStart = range.getStart() + 1;
int pageSize = range.getLength();
int dataSize = display.getRowCount();
int endIndex = Math.min(dataSize, pageStart + pageSize - 1);
endIndex = Math.max(pageStart, endIndex);
boolean exact = display.isRowCountExact();
return formatter.format(pageStart) + "-" + formatter.format(endIndex) + (exact ? " of " : " of over ") + formatter.format(dataSize);
}
use of com.google.gwt.view.client.HasRows in project rstudio by rstudio.
the class Pager method createText.
@Override
protected String createText() {
final HasRows display = getDisplay();
if (display.getVisibleRange().getStart() == display.getRowCount())
return "";
String text = super.createText();
if (display.isRowCountExact())
return "Commits " + text;
else {
int pos = text.indexOf(" of ");
return "Commits " + (pos >= 0 ? text.substring(0, pos) : text);
}
}
use of com.google.gwt.view.client.HasRows in project rstudio by rstudio.
the class Pager method setPageStart.
@Override
public void setPageStart(int index) {
HasRows display = getDisplay();
if (display != null) {
Range range = display.getVisibleRange();
int pageSize = range.getLength();
index = Math.max(0, index);
if (index != range.getStart()) {
display.setVisibleRange(index, pageSize);
}
}
}
use of com.google.gwt.view.client.HasRows in project blogwt by billy1380.
the class SimplePager method onRangeOrRowCountChanged.
@Override
protected void onRangeOrRowCountChanged() {
HasRows display = getDisplay();
elLabel.setInnerHTML(createText());
// Update the prev and first buttons.
setPrevPageButtonsDisabled(!hasPreviousPage());
// Update the next and last buttons.
if (isRangeLimited() || !display.isRowCountExact()) {
setNextPageButtonsDisabled(!hasNextPage());
setFastForwardDisabled(!hasNextPages(getFastForwardPages()));
}
}
Aggregations