Skip to content

Commit

Permalink
Initial searchall load
Browse files Browse the repository at this point in the history
  • Loading branch information
SugaryLump committed Nov 28, 2024
1 parent 315e7c7 commit 4283ac2
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ public void init(Filter defaultFilter, String allFilter, ClientMessages messages
setWidth("1400px");
addStyleName("wui-dialog-confirm");
setGlassEnabled(true);

doParentSearch();
}

public void resetExcludedInfo() {
Expand Down Expand Up @@ -216,20 +218,19 @@ private void doParentSearch() {
if (selectedUUIDs != null) {
Filter newFilter = new Filter(this.defaultFilter);
newFilter.add(new OneOfManyFilterParameter(ViewerConstants.SOLR_ROWS_DATABASE_UUID, selectedUUIDs));
this.parentSearchPanel.setSearchAllTotalDatabases((long) selectedUUIDs.size());
this.parentSearchPanel.setSearchAllTotalDatabases(String.valueOf(selectedUUIDs.size()));
this.parentSearchPanel.setDefaultFilter(newFilter);
this.parentSearchPanel.doSearch();
} else if (selectedAll || ClientConfigurationManager
.getStringWithDefault(ViewerConstants.SEARCHALL_SELECTEDALL, ViewerConstants.PROPERTY_SEARCHALL_DEFAULTSELECTION)
.equals(ViewerConstants.SEARCHALL_SELECTEDALL)) {
this.parentSearchPanel.setSearchAllTotalDatabases(this.list.getResult().getTotalCount());
this.parentSearchPanel.setSearchAllTotalDatabases("all");
this.parentSearchPanel.setDefaultFilter(defaultFilter);
this.parentSearchPanel.doSearch();
} else {
this.parentSearchPanel.setSearchAllTotalDatabases(0L);
this.parentSearchPanel.setSearchAllTotalDatabases("0");
this.parentSearchPanel.setDefaultFilter(defaultFilter);
this.parentSearchPanel.doSearch();

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
/**
* @author Alexandre Flores <aflores@keep.pt>
*/
public class SearchAllButtonWrapper extends SimplePanel implements HasValueChangeHandlers<Long> {
public class SearchAllButtonWrapper extends SimplePanel implements HasValueChangeHandlers<String> {
private ClientMessages messages;
public Long totalSelectedDatabases;
public String totalSelectedDatabases;

private Button button;
private DatabaseSelectDialog databaseSelectDialog;
Expand All @@ -28,7 +28,7 @@ public void init(Filter defaultFilter, String allFilter, ClientMessages messages
this.messages = messages;
this.button = new Button();
this.button.addStyleName("btn-link-info btn btn-searchall-dialog");
setTotalSelectedDatabases(0L);
setTotalSelectedDatabases("0");
this.databaseSelectDialog = new DatabaseSelectDialog(defaultFilter, allFilter, messages, parentSearchPanel);
this.button.addClickHandler(event -> {
this.databaseSelectDialog.center();
Expand All @@ -37,16 +37,16 @@ public void init(Filter defaultFilter, String allFilter, ClientMessages messages
setWidget(this.button);
}

public Long getTotalSelectedDatabases() {
public String getTotalSelectedDatabases() {
return this.totalSelectedDatabases;
}

@Override
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<Long> handler) {
public HandlerRegistration addValueChangeHandler(ValueChangeHandler<String> handler) {
return addHandler(handler, ValueChangeEvent.getType());
}

public void setTotalSelectedDatabases(Long totalSelectedDatabases) {
public void setTotalSelectedDatabases(String totalSelectedDatabases) {
this.totalSelectedDatabases = totalSelectedDatabases;
this.button
.setHTML(SafeHtmlUtils.fromSafeConstant(messages.manageDatabaseSearchAllSearchingOn(this.totalSelectedDatabases)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ public void bindUIAndInitWidget() {
initWidget(binder.createAndBindUi(this));
}

public void setSearchAllTotalDatabases(Long searchAllTotalDatabases) {
public void setSearchAllTotalDatabases(String searchAllTotalDatabases) {
this.selectedDatabasesButtonWrapper.setTotalSelectedDatabases(searchAllTotalDatabases);
}

public SearchAllButtonWrapper getSearchAllButtonWrapper() {
return this.selectedDatabasesButtonWrapper;
}

public Long getTotalSelected() {
public String getTotalSelected() {
return this.selectedDatabasesButtonWrapper.getTotalSelectedDatabases();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private <T extends IsIndexed> void attachComponents(String objectClassSimpleName
rootPanel.add(searchPanel);

if (!(searchPanel instanceof SearchPanelWithSearchAll)
|| ((SearchPanelWithSearchAll) searchPanel).getTotalSelected() != 0) {
|| !((SearchPanelWithSearchAll) searchPanel).getTotalSelected().equals("0")) {
if (scrollPanelCssClasses != null) {
ScrollPanel scrollPanel = new ScrollPanel(list);
scrollPanel.addStyleName(scrollPanelCssClasses);
Expand Down Expand Up @@ -187,8 +187,8 @@ public Components getComponents() {
return components;
}

public void onSearchAllSelectionChanged(Long totalSelected) {
if (totalSelected == 0) {
public void onSearchAllSelectionChanged(String totalSelected) {
if (totalSelected.equals("0")) {
reattachComponentsWithErrorMessage(
new HTML(SafeHtmlUtils.fromSafeConstant(messages.manageDatabaseSearchAllNoneSelected())));
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/config/i18n/client/ClientMessages.java
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ public interface ClientMessages extends Messages {

String manageDatabasePageDescription();

String manageDatabaseSearchAllSearchingOn(long total);
String manageDatabaseSearchAllSearchingOn(String total);

String manageDatabaseSearchAllNoneSelected();

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config/dbvtk-viewer.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ui.sharedProperties.whitelist.configuration.prefix=ui.viewer
ui.sharedProperties.whitelist.configuration.prefix=ui.disable
ui.sharedProperties.whitelist.configuration.prefix=ui.plugin
ui.sharedProperties.whitelist.configuration.prefix=ui.reference
ui.sharedProperties.whitelist.configuration.prefix=ui.searchAll
ui.sharedProperties.whitelist.configuration.property=lists
ui.sharedProperties.whitelist.configuration.property=ui.lists
ui.sharedProperties.whitelist.messages.prefix=ui.facets
Expand Down

0 comments on commit 4283ac2

Please sign in to comment.