-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: implement search filter in show preferences #4759
Feature: implement search filter in show preferences #4759
Conversation
Add a search box in show preferences window to allow users to filter preference options. Resolves #1019
} | ||
|
||
List<JabRefPreferencesFilter.PreferenceOption> filteredOptions = auxillaryPreferenceOptions.stream() | ||
.filter(p -> p.getKey().toLowerCase().contains(searchText)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better use LOCALE.ROOT as second parameter for the toLowerCase function to avoid unexpected problems:
https://garygregory.wordpress.com/2015/11/03/java-lowercase-conversion-turkey/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood, I have made the necessary changes.
Codewise lgtm. Could you please provide a screenshot how it looks like when the search matched/text is found? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR. The code looks good and works, but can still be a bit improved using a FilteredList
(which encapsulates some of the things you had to implement your own).
@@ -22,6 +23,12 @@ | |||
<Label fx:id="count"/> | |||
</HBox> | |||
</bottom> | |||
<top> | |||
<HBox> | |||
<TextField fx:id="searchField" promptText="Search"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use %Search
so that the text get localized properly.
@@ -22,6 +26,7 @@ | |||
|
|||
private final JabRefPreferencesFilter preferencesFilter; | |||
private final ObservableList<JabRefPreferencesFilter.PreferenceOption> preferenceOptions; | |||
private final List<JabRefPreferencesFilter.PreferenceOption> auxillaryPreferenceOptions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use the FilteredList
, then the code gets somewhat cleaner (as you don't need to manage two lists on your own). Have a look here:
jabref/src/main/java/org/jabref/gui/maintable/MainTableDataModel.java
Lines 29 to 33 in b39ed7b
entriesFiltered = new FilteredList<>(entriesViewModel); | |
entriesFiltered.predicateProperty().bind( | |
Bindings.createObjectBinding(() -> this::isMatched, | |
Globals.stateManager.activeGroupProperty(), Globals.stateManager.activeSearchQueryProperty()) | |
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the suggestions! I have made the necessary changes.
@Siedlerchr I have added a screenshot now. |
|
Yeah! That's cool, looks good, I would move the checkbox to the top next to the search field. |
But the |
On moving the checkbox to the top next to the search field, what are your opinion on it @tobiasdiez @Siedlerchr ? |
Yep, that is exactly what I meant'! Looks good! And thanks for fixing this longstanding issue ;) |
I am glad it came out as expected! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! The code looks good and I like the idea of having the count bound to the actual number of entries displayed.
…erbibtexkey * upstream/master: (827 commits) [#4306] Disable renaming (#4727) Feature: implement search filter in show preferences (#4759) Enable import button only if entry selected (#4761) Improve Remote messaging (#4760) Add changelog entry for #4520 Modifications to improve contrast of UI elements (#4758) Rework external changes dialog in JavaFX (#4693) Changes the title of Group Dialog to Add subgroup when adding a new subgroup (#4757) Optimize data fetching (#4520) Adds a browse button next to the path text field for aux-based groups (#4743) Saving changes and exiting application (#4729) Code optimized and created a reusable method to get writer output (#4750) Bump mvvmfx from 1.7.0 to 1.8.0 (#4747) Bump guava from 27.0.1-jre to 27.1-jre (#4748) Bump mvvmfx-validation from 1.7.0 to 1.8.0 (#4749) Remove obsolete swing components in Preferences and OpenOffice (#4740) Move library specific key pattern dialog call to library menu (#4744) Revert "Revert "Fix: bibkey generated does not handle diacritics" (#4741)" (#4742) Revert "Fix: bibkey generated does not handle diacritics" (#4741) Rename method to removeUnwantedCharacters ...
Add a search box in show preferences window to allow users to filter
preference options.
Resolves #1019