Here are the examples of the java api com.vaadin.addon.pagination.Pagination taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
5 Examples
19
Source : DemoUI.java
with Apache License 2.0
from basakpie
with Apache License 2.0
from basakpie
private VerticalLayout createContent(Grid grid, Pagination pagination) {
final VerticalLayout layout = new VerticalLayout();
layout.setSizeFull();
layout.setSpacing(true);
layout.addComponents(grid, pagination);
layout.setExpandRatio(grid, 1f);
return layout;
}
18
Source : DemoUI.java
with Apache License 2.0
from basakpie
with Apache License 2.0
from basakpie
public VerticalLayout nativeSublist() {
final int page = 1;
final int limit = 20;
final List<User> users = userList.subList(0, limit);
final long total = Long.valueOf(userList.size());
final Grid grid = createGrid(users);
final Pagination pagination = createPagination(total, page, limit);
pagination.addPageChangeListener(new PaginationChangeListener() {
@Override
public void changed(PaginationResource event) {
log.debug("nativeSublist: {}", event.toString());
grid.sereplacedems(userList.subList(event.fromIndex(), event.toIndex()));
grid.scrollToStart();
}
});
final VerticalLayout layout = createContent(grid, pagination);
return layout;
}
18
Source : DemoUI.java
with Apache License 2.0
from basakpie
with Apache License 2.0
from basakpie
public VerticalLayout jpaPagable() {
final int page = 1;
final int limit = 10;
final Page<User> users = findAll(0, limit);
final long total = users.getTotalElements();
final Grid grid = createGrid(users.getContent());
final Pagination pagination = createPagination(total, page, limit);
pagination.addPageChangeListener(new PaginationChangeListener() {
@Override
public void changed(PaginationResource event) {
log.debug("jpaPagable : {}", event.toString());
Page<User> users = findAll(event.pageIndex(), event.limit());
pagination.setTotalCount(users.getTotalElements());
grid.sereplacedems(users.getContent());
grid.scrollToStart();
}
});
final VerticalLayout layout = createContent(grid, pagination);
return layout;
}
18
Source : DemoUI.java
with Apache License 2.0
from basakpie
with Apache License 2.0
from basakpie
public Component gridFindAll() {
final int page = 1;
final int limit = 50;
final List<User> users = userRepository.findAll();
final long total = users.size();
final Grid grid = createGrid(userList.subList(0, limit));
final Pagination pagination = createPagination(total, page, limit);
pagination.sereplacedemsPerPageVisible(false);
pagination.addPageChangeListener(new PaginationChangeListener() {
@Override
public void changed(PaginationResource event) {
log.debug("gridFindAll : {}", event.toString());
pagination.setTotalCount(users.size());
grid.sereplacedems(users.subList(event.fromIndex(), event.toIndex()));
grid.scrollToStart();
}
});
final VerticalLayout layout = createContent(grid, pagination);
return layout;
}
18
Source : DemoUI.java
with Apache License 2.0
from basakpie
with Apache License 2.0
from basakpie
private Pagination createPagination(long total, int page, int limit) {
final PaginationResource paginationResource = PaginationResource.newBuilder().setTotal(total).setPage(page).setLimit(limit).build();
final Pagination pagination = new Pagination(paginationResource);
pagination.sereplacedemsPerPage(10, 20, 50, 100);
return pagination;
}