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

Searchbar across all bib files instead each having its own #1549

Merged
merged 24 commits into from
Sep 11, 2016
Merged

Searchbar across all bib files instead each having its own #1549

merged 24 commits into from
Sep 11, 2016

Conversation

chriba
Copy link
Contributor

@chriba chriba commented Jul 5, 2016

Implemented #825.
The SearchBar is now in the top Toolbar instead of each Tab having its own (always at the right).
On Tab change the Tab gets updated.
The Autocomplete is bound to the current Tab (maybe extend this one in another PR?).
The old global Search (opening all findings in a new Window) is gone, do we really need it?

jabref_globalsearch

  • Change in CHANGELOG.md described
  • Tests created for changes
  • Screenshots added (for bigger UI changes)

BasePanel currentBasePanel = getCurrentBasePanel();
if (currentBasePanel == null) {
globalSearchBar.setVisible(false);
globalSearchBar.setAutoCompleter(null);
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This only disables the global search bar when the last database will be closed. But the search bar will be shown when one is starting jabref with no open database.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, I'll fix it quickly

@boceckts
Copy link
Contributor

boceckts commented Jul 5, 2016

Good work 👍

@boceckts boceckts added status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers and removed stupro-ready-for-internal-review labels Jul 5, 2016
@teertinker
Copy link
Contributor

I am really happy that you are working on this. Is it correct, that the "global search" window will be abandoned? I have no idea whether it is causing any conflict with the current implementation of the search mechanism, but I am one of those who is using it rather extensively.

There are two scenarios, where a global search is useful:

  1. Often I create a separate bib file for a project (e.g. a journal article), where I put all related papers. Some of them are of interest just for this project and are not supposed to be part of my database core (e.g. newspaper articles). Hence, I often use search queries that include results of the core and project related file
  2. I have a bib file for papers which I use in a certain context, but that haven't been read thoroughly yet. Some of them will eventually be moved to the 'core database'. Also in this case I use a global search to find results within both bib-files.

Both scenarios could be managed by creating groups, and if global search gets abandoned, I will certainly do. However, I like the tab based style of several bib files very much, because I don't have the feeling that my project related articles get lost in my huge database with thousands of entries

@koppor
Copy link
Member

koppor commented Jul 7, 2016

👍 for keeping the global search window. Please readd it. @bartsch-dev There are many JabRef users having more than 10 bib files. They do not want to click through all 10 files for each search.

@koppor koppor removed the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jul 7, 2016
@matthiasgeiger
Copy link
Member

Another aspect: What happens if the horiztonal space is not enough to display all icons and the search bar? Will the searchbar be displayed beneath the icon bar?

@oscargus
Copy link
Contributor

oscargus commented Jul 8, 2016

Based on another issue the minimum width of the window is already around 1000 pixels (depending on look-an-feel, OS, etc), so it is crucial that it will fold.

But it indeed looks promising!

@chriba
Copy link
Contributor Author

chriba commented Jul 13, 2016

if the window is too small for the toolbar it will now wrap between the normal buttons and the searchbar.

The search result Dialog will now remember its location; the global search has a shortcut (ctrl+shift+f, #573); enter in the result dialog will select the entry in the BasePanel (#617); the Reuslt window is cloasable with ctrl+w if fdocused (#573 (comment)); and the result dialog won't stay at top anymore if the MainFrame is focused and they are on top of each other.

REPLACE_STRING("Replace string", Localization.lang("Replace string"), "ctrl R"),
RESOLVE_DUPLICATE_BIBTEX_KEYS("Resolve duplicate BibTeX keys", Localization.lang("Resolve duplicate BibTeX keys"), "ctrl shift D"),
SAVE_ALL("Save all", Localization.lang("Save all"), "ctrl alt S"),
SAVE_DATABASE("Save database", Localization.lang("Save database"), "ctrl S"),
SAVE_DATABASE_AS(
"Save database as ...", Localization.lang("Save database as..."), "ctrl shift S"),
SAVE_DATABASE_AS("Save database as ...", Localization.lang("Save database as..."), "ctrl shift S"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Please do not change the format of lines you didn't modify.

@boceckts
Copy link
Contributor

Please resolve conflicts.

@@ -90,7 +93,7 @@ public GlobalSearchBar() {

openCurrentResultsInDialog.setToolTipText(Localization.lang("Show search results in a window"));
openCurrentResultsInDialog.addActionListener(ae -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please rename the variable "ae", same goes for the other listeners named "l"

@boceckts
Copy link
Contributor

boceckts commented Jul 15, 2016

enter in the result dialog will select the entry in the BasePanel

  • I have two databases open and search for a keyword
  • I open the global search and it finds my result entries from both databases
  • I press enter on an entry and it focuses the correct tab but it always selects the first entry in this tab

EDIT: It does focus the correct entry if I am already in the right tab, but if it has to focus a different tab it always selects the first entry.

Did I missunderstand the sentence or is this a bug?

private final JTextFieldWithUnfocusedText searchField = new JTextFieldWithUnfocusedText(Localization.lang("Search") + "...");
private final JButton clearSearchButton = new JButton(IconTheme.JabRefIcon.CLOSE.getSmallIcon());
private final JButton openCurrentResultsInDialog = new JButton(IconTheme.JabRefIcon.OPEN_IN_NEW_WINDOW.getSmallIcon());
private final JButton globalSearch = new JButton(Localization.lang("Search globally"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you find an icon for this as well? Toolbars shouldn't include buttons with large strings.

@chriba
Copy link
Contributor Author

chriba commented Jul 15, 2016

Should be fixed now!

toolBar.add(new HelpAction(HelpFiles.SEARCH));

toolBar.addSeparator();
toolBar.add(currentResults);
Copy link
Contributor

Choose a reason for hiding this comment

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

This will cause the toolbar to jump around when typing and clearing a search query. To fit the searchbar in the first row I need to use full screen mode and than there is no space to the right at all. So once I start typing the result text will be displayed and the searchbar jumps to the second row, when I clear the search it jumps back to the 1st row since the text is invisible. In my opinion the text with the number of found results should be somewhere else.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've set the preffered size of the lable to 100px which contains the standard Found X entries-Message.

@koppor
Copy link
Member

koppor commented Jul 18, 2016

Is it possible to work on the global search in this PR, too?

  • The shortcut ctrl+shift+f should focus the search field if it is empty (instead of doing a globally searching the empty string)
  • ESC in the global search should focus the search field. Currently, the focus just stays where it was
  • The global search popup should show the bib file name

- The search result Window will now show which entry belongs to which bib file
- The search result Window will now remember its location
- The search result Window won't stay on top anymore if the main Window is focused and will be present in the taskbar
- The User can jump from the searchbar to the maintabel with `ctrl + enter`
Copy link
Member

Choose a reason for hiding this comment

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

fix typos user, maintable

Copy link
Member

Choose a reason for hiding this comment

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

Keyboard shortcuts should be rendered consistenly without space before and after +

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@koppor
Copy link
Member

koppor commented Sep 8, 2016

Searchbar disappers at certain occaisions. Please try to increase/decrease the width of JabRef and you'll see that at some point, it disappears:

grabbed_20160908-224223

grabbed_20160908-224233

It also happens during the search if "no results found" is appended. Then, the searchbar disapears after having nothing found:

grabbed_20160908-224028

grabbed_20160908-224043

@chriba
Copy link
Contributor Author

chriba commented Sep 10, 2016

fixed

@koppor
Copy link
Member

koppor commented Sep 11, 2016

Tested with bce1bf5 - not fixed:

jabref-global-search

@koppor koppor merged commit 543c176 into JabRef:master Sep 11, 2016
@chriba chriba deleted the globalSearch branch September 11, 2016 10:25
Siedlerchr added a commit that referenced this pull request Sep 11, 2016
* master:
  Remove obsolete wrapper task
  Added error dialog when setting invalid main file directory (#1921)
  Add filteringCharset = 'UTF-8' (#1945)
  Include https://github.com/grimes2
  Searchbar across all bib files instead each having its own (#1549)
  Some OO/LO cleanups (#1927)
  Update link
  Removed external dependency in logic (#1934)
Siedlerchr added a commit to Siedlerchr/jabref that referenced this pull request Sep 11, 2016
* master:
  Remove obsolete wrapper task
  Added error dialog when setting invalid main file directory (JabRef#1921)
  Add filteringCharset = 'UTF-8' (JabRef#1945)
  Include https://github.com/grimes2
  Searchbar across all bib files instead each having its own (JabRef#1549)
  Some OO/LO cleanups (JabRef#1927)
  Update link
  Removed external dependency in logic (JabRef#1934)
stefan-kolb added a commit that referenced this pull request Sep 14, 2016
stefan-kolb added a commit that referenced this pull request Sep 14, 2016
zesaro pushed a commit to zesaro/jabref that referenced this pull request Nov 22, 2016
zesaro pushed a commit to zesaro/jabref that referenced this pull request Nov 22, 2016
zesaro pushed a commit to zesaro/jabref that referenced this pull request Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.