// Show more button.
showMoreButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
// Display should be non-null, but we check defensively.
HasRows display = getDisplay();
if (display != null) {
Range range = display.getVisibleRange();
int pageSize = Math.min(range.getLength() + increment,
display.getRowCount()
+ (display.isRowCountExact() ? 0 : increment));
display.setVisibleRange(range.getStart(), pageSize);
}
}
});
showLessButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
// Display should be non-null, but we check defensively.
HasRows display = getDisplay();
if (display != null) {
Range range = display.getVisibleRange();
int pageSize = Math.max(range.getLength() - increment, increment);
display.setVisibleRange(range.getStart(), pageSize);
}
}
});
// Add the buttons to the pager.