From 9408f4f234b6e260dea63fb29b63efb0795252bc Mon Sep 17 00:00:00 2001 From: Alexandre Flores Date: Wed, 15 Jan 2025 13:48:13 +0000 Subject: [PATCH] Search-all panel's clear button clears search input --- .../common/client/common/dialogs/DatabaseSelectDialog.java | 5 +++++ .../common/client/common/search/SearchPanelAbstract.java | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/main/java/com/databasepreservation/common/client/common/dialogs/DatabaseSelectDialog.java b/src/main/java/com/databasepreservation/common/client/common/dialogs/DatabaseSelectDialog.java index fe3df598..d0aff225 100644 --- a/src/main/java/com/databasepreservation/common/client/common/dialogs/DatabaseSelectDialog.java +++ b/src/main/java/com/databasepreservation/common/client/common/dialogs/DatabaseSelectDialog.java @@ -12,6 +12,7 @@ import com.databasepreservation.common.client.common.lists.DatabaseSelectList; import com.databasepreservation.common.client.common.lists.utils.AsyncTableCellOptions; import com.databasepreservation.common.client.common.lists.utils.ListBuilder; +import com.databasepreservation.common.client.common.search.SearchPanelAbstract; import com.databasepreservation.common.client.common.search.SearchPanelWithSearchAll; import com.databasepreservation.common.client.common.search.SearchWrapper; import com.databasepreservation.common.client.index.FindRequest; @@ -54,6 +55,7 @@ public class DatabaseSelectDialog extends DialogBox { private long notSearchable; private SimplePanel exludedInfo; + private SearchPanelAbstract searchPanel; private DatabaseSelectList list; public DatabaseSelectDialog() { @@ -99,6 +101,8 @@ public void init(Filter defaultFilter, String allFilter, ClientMessages messages this.defaultFilter = defaultFilter; this.messages = messages; this.databasesSearchWrapper = new SearchWrapper(false).createListAndSearchPanel(databaseMetadataList, false); + this.searchPanel = this.databasesSearchWrapper.getComponents() + .getSearchPanel(databaseMetadataList.getOptions().getListId()); Button clearButton = new Button(messages.clear()); clearButton.addStyleName("btn btn-danger"); clearButton.addClickHandler(event -> clearHandler()); @@ -197,6 +201,7 @@ private void cancelHandler() { } private void clearHandler() { + this.searchPanel.clearSearchInputBox(); this.list.setSelected(new HashSet<>()); } diff --git a/src/main/java/com/databasepreservation/common/client/common/search/SearchPanelAbstract.java b/src/main/java/com/databasepreservation/common/client/common/search/SearchPanelAbstract.java index d7da88b7..8aa360d0 100644 --- a/src/main/java/com/databasepreservation/common/client/common/search/SearchPanelAbstract.java +++ b/src/main/java/com/databasepreservation/common/client/common/search/SearchPanelAbstract.java @@ -277,6 +277,10 @@ public void clearAdvancedSearchInputBox() { } } + public void clearSearchInputBox() { + this.searchInputBox.setText(""); + } + public void setSearchAdvancedGoEnabled(boolean enabled) { searchAdvancedGo.setEnabled(enabled); }