jabref icon indicating copy to clipboard operation
jabref copied to clipboard

Replace all remaining `setStyle` calls with `getStyleClass` except `FontIcon` and `-fx-font-size`

Open Maran23 opened this issue 5 months ago • 19 comments

See also the previous issue: https://github.com/JabRef/jabref/issues/15686

We have multiple occurrences where we use setStyle(..) in JabRef. The problem is that this usually hardcodes colors or styles like insets. Therefore, custom themes (CSS) or other stylesheets like Atlanta will always be overwritten by this inline styles.

Additional context

Image

We have styleclasses for that, e.g. bold that should be used. Otherwise a new one can be created.

Maran23 avatar Jun 09 '26 08:06 Maran23

i am working on this issue

SyedAbd110786 avatar Jun 09 '26 14:06 SyedAbd110786

Hi, I've opened PR #15958 which replaces 7 setStyle calls across 5 Java files with getStyleClass().add(...) and adds the corresponding utility classes (.italic, .bold-italic, .small-bold, .cursor-hand, .dialog-header) to jabref-theme.css. I intentionally left 4 calls unchanged as they use dynamic runtime values or have existing comments explaining why a style class is insufficient.

justinlaf avatar Jun 10 '26 15:06 justinlaf

/assign-me

srinithreddy16 avatar Jun 11 '26 00:06 srinithreddy16

👋 Hey @srinithreddy16, thank you for your interest in this issue! 🎉

We're excited to have you on board. Start by exploring our Contributing guidelines, and set up your local development workspace by following the steps in our workspace setup guidelines to get started smoothly.

For questions on JabRef functionality, you can consult the JabRef Guru. For questions related to the codebase, please start using DeepWiki.

In case you encounter failing tests during development, please check our developer FAQs!

Still facing issues or having more questions? Feel free to ask here on GitHub or on JabRef's Gitter chat. Please don't hesitate to open a (draft) pull request early on to show the direction you are heading towards if unsure.

Happy coding! 🚀

jabref-machine avatar Jun 11 '26 00:06 jabref-machine

/assign-me

nhck3001 avatar Jun 12 '26 02:06 nhck3001

👋 Hey @nhck3001, thank you for your interest in this issue! 🎉

We're excited to have you on board. Start by exploring our Contributing guidelines, and set up your local development workspace by following the steps in our workspace setup guidelines to get started smoothly.

For questions on JabRef functionality, you can consult the JabRef Guru. For questions related to the codebase, please start using DeepWiki.

In case you encounter failing tests during development, please check our developer FAQs!

Still facing issues or having more questions? Feel free to ask here on GitHub or on JabRef's Gitter chat. Please don't hesitate to open a (draft) pull request early on to show the direction you are heading towards if unsure.

Happy coding! 🚀

jabref-machine avatar Jun 12 '26 02:06 jabref-machine

/assign-me

nhck3001 avatar Jun 14 '26 02:06 nhck3001

Thank you for your continued work in JabRef. At this point, you probably already know the basics and the important links. If not, our contributing guidelines is the place you should go to.

At this point in time, you raised 1 pull request(s) of which 0% (0/1) have been merged.

jabref-machine avatar Jun 14 '26 02:06 jabref-machine

I am working on this issue. PR: #15995

Iamsujithd avatar Jun 17 '26 19:06 Iamsujithd

/assign-me

Eng-YasminKotb avatar Jun 17 '26 20:06 Eng-YasminKotb

👋 Hey @Eng-YasminKotb, thank you for your interest in this issue! 🎉

We're excited to have you on board. Start by exploring our Contributing guidelines, and set up your local development workspace by following the steps in our workspace setup guidelines to get started smoothly.

For questions on JabRef functionality, you can consult the JabRef Guru. For questions related to the codebase, please start using DeepWiki.

In case you encounter failing tests during development, please check our developer FAQs!

Still facing issues or having more questions? Feel free to ask here on GitHub or on JabRef's Gitter chat. Please don't hesitate to open a (draft) pull request early on to show the direction you are heading towards if unsure.

Happy coding! 🚀

jabref-machine avatar Jun 17 '26 20:06 jabref-machine

Hi, @Maran23! I started working on this issue but:

I saw that the title mentions FontIcon.setStyle, while the description mentions multiple occurrences where used setStyle(..) in JabRef in general not in specific scope.

I searched the codebase for usages of FontIcon with setStyle but what I could found only one case in InternalMaterialDesignIcon class where a FontIcon uses setStyle dynamically for icon colors.

And yes, I found several other setStyle() usages on different JavaFX components like Label and HBox but, when I checked the previous PRs related to this issue I prefered to make sure I correctly understand the intended scope before opening a PR.

So, could you please clarify: 1.Is the scope of this issue only FontIcon.setStyle() usages or should it cover other static inline setStyle() usages as well?|

2.If the issue is only about FontIcon, should the remaining dynamic color case be changed or is it intentionally kept? Thanks!

Eng-YasminKotb avatar Jun 18 '26 11:06 Eng-YasminKotb

@Eng-YasminKotb I renamed the issue. FontIcon is now excluded because we may replace it at one point. So it is better to ignore it for now and concentrate on the remaining styles.

Maran23 avatar Jun 19 '26 20:06 Maran23

Most important part which all other PRs overlooked: The goal would be to reduce special style classes and rather combine existing ones e.g. for bold

Siedlerchr avatar Jun 19 '26 20:06 Siedlerchr

I want to ask about -fx-padding and -fx-background-color I noticed that changing those will violate the principle of reducing special style as there are different values in two classes for -fx-padding so, Should I replace them as well?

Eng-YasminKotb avatar Jun 19 '26 23:06 Eng-YasminKotb

I want to ask about -fx-padding and -fx-background-color I noticed that changing those will violate the principle of reducing special style as there are different values in two classes for -fx-padding so, Should I replace them as well?

Yes. In this case just create a new styleClass. Give them a good generic name so we could reuse them in the future.

Maran23 avatar Jun 20 '26 09:06 Maran23

/assign-me

Eng-YasminKotb avatar Jun 21 '26 15:06 Eng-YasminKotb

Thank you for your continued work in JabRef. At this point, you probably already know the basics and the important links. If not, our contributing guidelines is the place you should go to.

At this point in time, you raised 1 pull request(s) of which 0% (0/1) have been merged.

jabref-machine avatar Jun 21 '26 15:06 jabref-machine

We think that this issue was fixed. Please head to https://builds.jabref.org/main to download a development build and try it out.

For any feedback, add a comment to the pull request at https://github.com/JabRef/jabref/pull/16022.

github-actions[bot] avatar Jun 27 '26 13:06 github-actions[bot]