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

Fix Preferences Search #6946

Merged
merged 7 commits into from
Sep 28, 2020
Merged

Conversation

fabiojavamarcos
Copy link
Contributor

Updated fxml files from the preferences package to appear in preference search.

The preferences search was unable to find some visual components because they are not a direct child from one of the preferences tab.
So, the method getPrefsTabLabelMap in PreferencesSearchHandler cannot find them. I moved some components that were inside tags to let them "visible" to their parents in the mentioned method. It does not change the UI. Most of the components could be moved. Some could not because they have many parents until the tab and it could impact the UI.

Fixes #6866

  • 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.

image

updated fxml file to be able to appear in preference search.
@calixtus
Copy link
Member

Hi @fabiojavamarcos ,
thanks for your efforts, but I believe this won't fix the underlying problem.

I think a different approach would be to design a tree walker in PreferencesSearchHandler::getPrefsTabLabelMap, which collects all Labeled nodes in each node and it's subnodes.
Maybe this example of walking through a directory tree can help?
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/file-system/how-to-iterate-through-a-directory-tree

@calixtus calixtus added the status: changes required Pull requests that are not yet complete label Sep 26, 2020
@Siedlerchr
Copy link
Member

Agree with @calixtus , a simple recursive appraoch https://stackoverflow.com/a/13011616 should work

@fabiojavamarcos
Copy link
Contributor Author

Ok. I am going to take a look!

Created a recursive method to find all child node from each tab in preferences search
@fabiojavamarcos
Copy link
Contributor Author

Now I think it is better! Thanks for the suggestion.

@calixtus
Copy link
Member

calixtus commented Sep 26, 2020

With this recursive approach you should be able to put all the Labeled nodes in the fxml files back into the hboxes.
I think you can also make the new method scanImputControls static.

If you like to look a bit around in the JabRef sources, you could also think of moving this recursive search init stuff into a background task, if the preferences dialog takes too long to load now, and grey the search box out as long as the preferences are indexed (probably not much more than a fracture of a second). But maybe this too much for this PR. The most important thing is now that the issue has been fixed.

@fabiojavamarcos
Copy link
Contributor Author

Ok. Doing that!

Here the indexing was fast. But... you know... I am fixing the HBox and you decide if is better to finish or not. Maybe finish it and open another issue can be ok. And I can start looking at the new one as well. Thanks!

rollback controls inside HBoxes and changing to static scanInputControls
@@ -89,7 +89,7 @@ private void clearSearch() {
return filteredPreferenceTabs;
}

private void scanInputControls(Parent parent, ArrayListMultimap<PreferencesTab, Labeled> prefsTabLabelMap, PreferencesTab preferencesTab) {
private static void scanInputControls(Parent parent, ArrayListMultimap<PreferencesTab, Labeled> prefsTabLabelMap, PreferencesTab preferencesTab) {
Copy link
Member

Choose a reason for hiding this comment

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

Please give ths method a more meaningful name. You are scanning for label controls.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

method name updated to: scanLabeledControls
@@ -24,7 +24,7 @@
<CheckBox fx:id="displayGroupCount" text="%Display count of items in group"/>

<HBox spacing="4" alignment="CENTER_LEFT">
<Label text="%Keyword separator"/>
<Label text="%Keyword seperator"/>
Copy link
Member

Choose a reason for hiding this comment

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

Typo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

@calixtus calixtus left a comment

Choose a reason for hiding this comment

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

One question left, rest lgtm

<?import javafx.scene.layout.VBox?>
<?import org.jabref.gui.commonfxcontrols.SaveOrderConfigPanel?>
<?import javafx.scene.control.ToggleGroup?>
Copy link
Member

Choose a reason for hiding this comment

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

Is there any system in reordering the imports in the fxmls? If not, why not leave it alphabetically like every other import in the .Java files...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it!

ordering javafx imports
Copy link
Member

@calixtus calixtus left a comment

Choose a reason for hiding this comment

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

Im afraid the code style issues are still remaining. See:
https://github.com/JabRef/jabref/pull/6946/files

But don't mind, we can fix this before merging it.
Changes to PreferencesSearchHandler look good to me.

@fabiojavamarcos
Copy link
Contributor Author

I have no idea why they changed their positions because I did not change them! Anyway, I checked again and manually put it in alphabetical order.

Copy link
Member

@calixtus calixtus left a comment

Choose a reason for hiding this comment

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

Looks very good to me. Since @Siedlerchr already approved it, I think I'm going to merge it.
Thank you very much for this PR. We are happy to welcome you to the contributors of JabRef. Even if our remarks sometimes sound a bit lit nitpicking, it's because we try to lift the code style standards in JabRef for some months now. But open source is always about learning something new and working together for something good. We hope you liked working on JabRef an you consider to return for another issue to fix or feature to implement!
So thanks again!

@calixtus calixtus merged commit 694a876 into JabRef:master Sep 28, 2020
@fabiojavamarcos
Copy link
Contributor Author

I am really having fun, learning with the process, with your experience, and happy! I am going to check more issues. Thanks for your orientation and patience!

@fabiojavamarcos fabiojavamarcos deleted the fix-issue-6866 branch September 28, 2020 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: changes required Pull requests that are not yet complete
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preferences: Search: Many items are not found
3 participants