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

Html code in the tooltip of the search field #3381

Closed
jonasstein opened this issue Oct 31, 2017 · 10 comments
Closed

Html code in the tooltip of the search field #3381

jonasstein opened this issue Oct 31, 2017 · 10 comments

Comments

@jonasstein
Copy link

jonasstein commented Oct 31, 2017

JabRef 4.1-dev--snapshot--2017-10-31--master--42ea6bc9c
Linux 4.12.12-gentoo+ amd64 
Java 1.8.0_152

There is html code in the tooltip of the search field (click to enlarge the screenshot)

jabref_376

@tobiasdiez tobiasdiez changed the title 4.0 html code in the tooltip of the search field Html code in the tooltip of the search field Nov 1, 2017
@jupf
Copy link
Contributor

jupf commented Nov 4, 2017

Hey, I looked into this issue and would be glad to take it.

It's possible to display a WebView inside the Tooltip which renders the HTML as a graphic. Or was there any other solution intended?

Does anyone know why the background of the search field tooltip is black-ish? Shouldn't it be grey or light blue? Seems strange to me and I couldnt find out why.

This is my first approach to contribute in an open source project, i already read your contributing guide. Is there something else to consider?

@jonasstein
Copy link
Author

As user I would expect plain text with proper line break

@jupf
Copy link
Contributor

jupf commented Nov 4, 2017

It would be text, but with the possibility to make some words e.g. bold

@Siedlerchr
Copy link
Member

Hi, thanks for your interest in this issue. Both javafx and swing support html toolips out of the box.
See https://docs.oracle.com/javafx/2/ui_controls/tooltip.htm
. Regarding the color, I think it depends on the look and feel you choose.

Some General Tipps for contributing, make sure to set up your IDE accordingly so that you have the code formatter rules we use.
Just create a new branch and add a PR. If you have questions or need help, just ask

@Siedlerchr
Copy link
Member

I think you should use the html option, to make sure the author names are shown correctly

@tobiasdiez
Copy link
Member

@jupf Thanks for your interest in contributing!

JavaFX actually does not support HTML in its controls and I think this is a good design. Instead of using a webview (which would work in principle), JavaFX introduced the TextFlow to support rich text.
Thus I would propose to change

to return a TextFlow instead of String. Note that as a consequence of this the search/rules/describer/ package should move to gui instead. If you feel not yet comfortable enough to do this refactoring, it is no problem - we can help you with it or take over this final step.
If you have any questions, feel free to ask them here (or open a PR with your initial progress).

@jupf
Copy link
Contributor

jupf commented Nov 5, 2017

Okay, I will open a PR as soon as there is progress to discuss

@Siedlerchr
Copy link
Member

@jupf Any updates on this?

@jupf jupf mentioned this issue Nov 18, 2017
6 tasks
@jupf
Copy link
Contributor

jupf commented Nov 18, 2017

I have a few open questions after making the main changes proposed from @tobiasdiez. I detailed them in the pull request. Sorry this took so long

tobiasdiez pushed a commit that referenced this issue Nov 27, 2017
* the SearchDescribers now return a TextFlow

* moved the search.rules.describer package from logic to gui package
  because the SearchDescriber now creates TextFlow Elements

* moved the tests accordingly

* modified creation of Tooltip in GlobalSearchBar to display the
  TextFlow created by the SearchDescribers

* SearchQuery now stores a TextFlow as description

* Added a stub for compatibility in GroupDialog because it uses the
  SearchQuery to get the description and needs an HTML string for
  its Swing Tooltip

* Styled the SearchBar Tooltip for readability

It uses an own style class to not change any other styled elements.
Styling was choosen to look like the other (swing) tooltips.

* refactor for better readability

* removed description member of SearchQuery class

because the description of a SearchQuery is a gui element, it is not
stored any more in this class. Everywhere the description is needed it
is generated

* add method to create HTML string from javafx Text

* create HTML string from description for compat.

* fixed formatting for style

* created tests for TextUtil class

* modified the SearchDescriber Implementations tests

now they work properly again and check the created Texts inside
the description TextFlow

* split up testcases into single methods

* using old localized strings again

these old localized strings containing html tags are broken up and
converted to Text objects to use in javafx TextFlow

* added and modified tests

* added changelog entry

* changed syntax for getting SearchDescriber

now a whole SearchQuery object is sufficient to get a corresponding
SearchDescriber

* refactored for better style

* javafx tooltips styled per css

also refactored the GlobalSearchBar tooltip to use this new styling

* modified and restructured tests

It was necessary to modify the tests of the SearchDescriber
Implementations and the TooltipTextUtil class because of the new css
styling for tooltips. Also refactored for better style
@tobiasdiez
Copy link
Member

This should be fixed in the latest development version thanks to @jupf. Could you please check the build from http://builds.jabref.org/master/. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants