Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
burningtnt committed Aug 11, 2023
1 parent 7e45fe8 commit 5543cd1
Showing 1 changed file with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,14 +346,21 @@ protected ModDownloadListPageSkin(DownloadListPage control) {
sortComboBox.getSelectionModel().select(0);
searchPane.addRow(rowIndex++, new Label(i18n("mods.category")), categoryStackPane, new Label(i18n("search.sort")), sortStackPane);

EventHandler<ActionEvent> searchAction = e -> getSkinnable()
.search(gameVersionField.getSelectionModel().getSelectedItem(),
Optional.ofNullable(categoryComboBox.getSelectionModel().getSelectedItem())
.map(CategoryIndented::getCategory)
.orElse(null),
control.pageOffset.get(),
nameField.getText(),
sortComboBox.getSelectionModel().getSelectedItem());
StringProperty previousSearchFilter = new SimpleStringProperty(this, "Previous Seach Filter", "");
EventHandler<ActionEvent> searchAction = e -> {
if (!previousSearchFilter.get().equals(nameField.getText())) {
control.pageOffset.set(0);
}

previousSearchFilter.set(nameField.getText());
getSkinnable().search(gameVersionField.getSelectionModel().getSelectedItem(),
Optional.ofNullable(categoryComboBox.getSelectionModel().getSelectedItem())
.map(CategoryIndented::getCategory)
.orElse(null),
control.pageOffset.get(),
nameField.getText(),
sortComboBox.getSelectionModel().getSelectedItem());
};

HBox actionsBox = new HBox(8);
GridPane.setColumnSpan(actionsBox, 4);
Expand Down Expand Up @@ -396,10 +403,10 @@ protected ModDownloadListPageSkin(DownloadListPage control) {
});
nextPageButton.setDisable(true);
control.pageOffset.addListener((observable, oldValue, newValue) -> nextPageButton.setDisable(
control.pageCount.get() == -1 || control.pageOffset.get() == control.pageCount.get() - 1
control.pageCount.get() == -1 || control.pageOffset.get() >= control.pageCount.get() - 1
));
control.pageCount.addListener((observable, oldValue, newValue) -> nextPageButton.setDisable(
control.pageCount.get() == -1 || control.pageOffset.get() == control.pageCount.get() - 1
control.pageCount.get() == -1 || control.pageOffset.get() >= control.pageCount.get() - 1
));

JFXButton lastPageButton = FXUtils.newBorderButton(i18n("search.last_page"));
Expand Down

0 comments on commit 5543cd1

Please sign in to comment.