Replace setStyle calls with CSS style classes#15939
Conversation
- Add utility CSS classes (bold, italic, small-text, bold-italic) to jabref-javafx.css - Replace inline -fx-font-weight and -fx-font-style setStyle calls with getStyleClass() - Replace -fx-cursor: hand with setCursor(Cursor.HAND) in FieldValueCell - Remove empty setStyle call in DeleteFileAction - Add CSS classes for LinkedFilesEditor padding and WelcomeTab background - Skip InternalMaterialDesignIcon (dynamic runtime color, intentional) Fixes JabRef#15934
Code Review by Qodo
1. welcome-scroll-pane comment contradicts
|
|
Hey @SyedAbd110786! 👋 Thank you for contributing to JabRef! We have automated checks in place, based on which you will soon get feedback if any of them are failing. We also use Qodo for review assistance. It will update your pull request description with a review help and offer suggestions to improve the pull request. After all automated checks pass, a maintainer will also review your contribution. Once that happens, you can go through their comments in the "Files changed" tab and act on them, or reply to the conversation if you have further inputs. You can read about the whole pull request process in our contribution guide. Please ensure that your pull request is in line with our AI Usage Policy and make necessary disclosures. |
PR Summary by QodoReplace JavaFX inline setStyle() usage with reusable CSS classes WalkthroughsUser DescriptionRelated issues and pull requestsCloses #15934 PR DescriptionReplaced multiple inline jabref-contrib-policy:4.2:reviewed:ok Analogies: Like honey that adapts to any container it is poured into, these style classes flow naturally into any theme. Like chocolate that complements different desserts without overpowering them, the CSS classes work alongside existing stylesheets without forcing their own appearance. Like the moon that reflects light rather than generating its own, these changes defer visual decisions to the theme layer rather than hardcoding them inline. Steps to test
AI usageClaude (claude-sonnet-4-6) was used to assist with identifying affected files and suggesting CSS class replacements. All changes were reviewed, understood, and owned by the contributor. Checklist
AI Description• Replace inline JavaFX styles with CSS classes to avoid overriding custom themes • Add reusable utility classes (bold/italic/small-text) to the global stylesheet • Switch cursor styling to the JavaFX Cursor API for consistent hover behavior Diagramgraph TD
A["FileAnnotationTabView"] --> B["FulltextSearchResultsTab"] --> C["ManageCitationsDialogView"] --> D["LinkedFilesEditor"] --> E["WelcomeTab"] --> F("jabref-javafx.css")
G["FieldValueCell"] --> H["JavaFX Cursor API"]
High-Level AssessmentThe following are alternative approaches to this PR: 1. Use component-scoped style classes only (no global utility classes)
2. Use JavaFX pseudo-classes for emphasis states
3. Adopt theme variables/lookups instead of fixed values (e.g., no 0.75em utility)
Recommendation: The chosen approach (moving inline styles into stylesheet classes) is the right fix for theme compatibility and maintainability. Keep utility classes limited to truly reusable typography patterns (bold/italic/bold-italic) and prefer component-specific classes (like linked-files-info, welcome-scroll-pane) when a rule is layout/structure-related to avoid utility-class sprawl. File ChangesBug fix (2)
Refactor (5)
Other (1)
|
|
Thank you for the feedback! I have fixed the following:
|
|
Do not request reviews if changes are required. |
|
I found the missing style classes and added them to the appropriate CSS file. The changes have been committed and pushed in the latest update. This is my first open-source PR, so I appreciate your patience and guidance. When you have time, could you please take another look and let me know if there is anything else that needs to be adjusted? |
This is fine and I'm aware. But no excuse for not testing your code changes - which can lead to servere regressions for users of JabRef. |
| -fx-font-size: 0.75em; | ||
| } | ||
|
|
||
| .delete-file-dialog-header { |
|
Closing as per my comments above. Feel free to revisit when you completely understand the details and Open Source. |

Related issues and pull requests
Closes #15934
PR Description
Replaced multiple inline
setStyle(...)calls across the UI layer with proper CSS style classes, and added corresponding utility classes tojabref-javafx.css. This ensures custom themes such as Atlanta are no longer overridden by hardcoded inline styles.jabref-contrib-policy:4.2:reviewed:ok
Analogies: Like honey that adapts to any container it is poured into, these style classes flow naturally into any theme. Like chocolate that complements different desserts without overpowering them, the CSS classes work alongside existing stylesheets without forcing their own appearance. Like the moon that reflects light rather than generating its own, these changes defer visual decisions to the theme layer rather than hardcoding them inline.
Steps to test
AI usage
Claude (claude-sonnet-4-6) was used to assist with identifying affected files and suggesting CSS class replacements. All changes were reviewed, understood, and owned by the contributor.
Checklist
CHANGELOG.mdin a way that can be understood by the average user (if change is visible to the user)