Add button to jump to first page

This commit is contained in:
0xboobface 2020-04-23 18:32:14 +02:00
parent a30d4ed463
commit a4d517aa25
1 changed files with 10 additions and 0 deletions

View File

@ -106,6 +106,7 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
ScrollPane scrollPane = new ScrollPane();
boolean loginRequired;
TextField pageInput = new TextField(Integer.toString(1));
Button pageFirst = new Button("1");
Button pagePrev = new Button("");
Button pageNext = new Button("");
private volatile boolean updatesSuspended = false;
@ -194,12 +195,20 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
BorderPane.setMargin(scrollPane, new Insets(5));
pagination = new HBox(5);
pagination.getChildren().add(pageFirst);
pagination.getChildren().add(pagePrev);
pagination.getChildren().add(pageNext);
pagination.getChildren().add(pageInput);
BorderPane.setMargin(pagination, new Insets(5));
pageInput.setPrefWidth(50);
pageInput.setOnAction(e -> handlePageNumberInput());
pageFirst.setTooltip(new Tooltip("First Page"));
pageFirst.setOnAction(e -> {
pageInput.setText(Integer.toString(1));
updateService.setPage(1);
restartUpdateService();
});
pagePrev.setTooltip(new Tooltip("Previous Page"));
pagePrev.setOnAction(e -> {
int page = updateService.getPage();
page = Math.max(1, --page);
@ -207,6 +216,7 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
updateService.setPage(page);
restartUpdateService();
});
pageNext.setTooltip(new Tooltip("Next Page"));
pageNext.setOnAction(e -> {
int page = updateService.getPage();
page++;