Skip to content

Commit

Permalink
Search-all panel's clear button clears search input
Browse files Browse the repository at this point in the history
  • Loading branch information
SugaryLump committed Jan 15, 2025
1 parent 4667e26 commit 9408f4f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -54,6 +55,7 @@ public class DatabaseSelectDialog extends DialogBox {
private long notSearchable;
private SimplePanel exludedInfo;

private SearchPanelAbstract searchPanel;
private DatabaseSelectList list;

public DatabaseSelectDialog() {
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -197,6 +201,7 @@ private void cancelHandler() {
}

private void clearHandler() {
this.searchPanel.clearSearchInputBox();
this.list.setSelected(new HashSet<>());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ public void clearAdvancedSearchInputBox() {
}
}

public void clearSearchInputBox() {
this.searchInputBox.setText("");
}

public void setSearchAdvancedGoEnabled(boolean enabled) {
searchAdvancedGo.setEnabled(enabled);
}
Expand Down

0 comments on commit 9408f4f

Please sign in to comment.