Skip to content
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

Rework search bar #6682

Merged
merged 9 commits into from
Jul 17, 2020
Merged

Rework search bar #6682

merged 9 commits into from
Jul 17, 2020

Conversation

calixtus
Copy link
Member

@calixtus calixtus commented Jul 12, 2020

picturemessage_3ata4qts chg

fixes #6625

  • Change in CHANGELOG.md described (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked documentation: Is the information available and up to date? If not created an issue at https://github.com/JabRef/user-documentation/issues or, even better, submitted a pull request to the documentation repository.

@@ -325,7 +322,7 @@ private void updateResults(int matched, TextFlow description, boolean grammarBas
}

private void setHintTooltip(TextFlow description) {
if (Globals.prefs.getBoolean(JabRefPreferences.SHOW_ADVANCED_HINTS)) {
if (preferencesService.getGeneralPreferences().shouldShowAdvancedHints()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make sense to add it to the search preferences as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally the idea about the advanced hints options was to make it reusable for other hints as well. But in fact, it has only been used also for another (somewhat silly) hint in the network tab in the preferences dialog. So im not sure about this... Maybe in the future, we could evolve that feature to some annoying tip of the day feature? 😉

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no strong opinion on this. So then just leave it as is

@calixtus calixtus marked this pull request as ready for review July 13, 2020 19:43
@calixtus calixtus added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jul 13, 2020
Copy link
Member

@tobiasdiez tobiasdiez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good to me. The only concern that I have is that the search bar is now really small. Thus, while editing a more complex query, it is no longer possible to see the complete query (and "scrolling" in a text field is rather tedious). This was the main reason for the "extend on focus" mode. I'm not particularly attached to the extend animation but it should be still possible to comfortably edit more complex queries.

public int getSeachDialogWidth() {
return preferences.getInt(SEARCH_DIALOG_WIDTH);
}
public static class Builder {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the builder really necessary? I think the with* methods can be added directly to the main class without any problems.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change it, I originally just wanted to stick close to the builder pattern, as I don't have much experience on it, so this was somewhat a study project for me 😉

@calixtus
Copy link
Member Author

The changes look good to me. The only concern that I have is that the search bar is now really small. Thus, while editing a more complex query, it is no longer possible to see the complete query (and "scrolling" in a text field is rather tedious). This was the main reason for the "extend on focus" mode. I'm not particularly attached to the extend animation but it should be still possible to comfortably edit more complex queries.

I'm not quite sure I understand what you mean about the small search bar... I removed the previous restriction of the searchbar to expand to the right, so now it's always extended. The empty space still showing between the searchbar and the toolbar buttons is left over from before and shows "Found X entries". I did not yet had a good idea what to do with this message, so i did not touch it (except adding 4 pixels distance to the searchbar).

For comparison: This is how the master branch looks right now:
grafik

@tobiasdiez
Copy link
Member

Ah ok, then I misread the code and the first screenshot - I thought that's now the size of the search bar.

searchDisplayMode = SearchDisplayMode.valueOf(get(SEARCH_DISPLAY_MODE));
} catch (IllegalArgumentException ex) {
// Should only occur when the searchmode is set directly via preferences.put and the enum was not used
searchDisplayMode = SearchDisplayMode.valueOf((String) defaults.get(SEARCH_DISPLAY_MODE));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The get() Method already returns the default if no value:

 public String get(String key) {
        return prefs.get(key, (String) defaults.get(key));
    }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I just copied the logic from the former searchpreferences.class. Fixing the missing consistency is one of the big projects in the future...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the only issue I found so far,the rest looks good!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... I thought about this: what if the returned stored value is defect, but not the default value?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should that happen? the Prefernces.get says:

the value associated with key, or def if no value is associated with key, or the backingstore is inaccessible.

@calixtus
Copy link
Member Author

Maybe the stored value is corrupt and not parseable by value of...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Settings in Searching: suggest to separate these from autocompletion
3 participants