Add support to search for custom store attributes

This commit is contained in:
crschnick 2024-02-28 14:12:35 +00:00
parent ac1fcf821d
commit 37dae87a2f
2 changed files with 13 additions and 1 deletions

View file

@ -212,7 +212,15 @@ public class StoreEntryWrapper {
}
public boolean shouldShow(String filter) {
return filter == null || nameProperty().getValue().toLowerCase().contains(filter.toLowerCase());
if (filter == null || nameProperty().getValue().toLowerCase().contains(filter.toLowerCase())) {
return true;
}
if (entry.getValidity().isUsable() && entry.getProvider().getSearchableTerms(entry.getStore()).stream().anyMatch(s -> s.toLowerCase().contains(filter.toLowerCase()))) {
return true;
}
return false;
}
public Property<String> nameProperty() {

View file

@ -49,6 +49,10 @@ public interface DataStoreProvider {
return e.orElse("?");
}
default List<String> getSearchableTerms(DataStore store) {
return List.of();
}
default boolean shouldEdit() {
return false;
}