Skip to content

Improve cleanup UI - Single Cleanup button and UI stays open and fix UI scaling for font #14701

Merged
Siedlerchr merged 13 commits into
mainfrom
improveCleanup
Dec 23, 2025
Merged

Improve cleanup UI - Single Cleanup button and UI stays open and fix UI scaling for font #14701
Siedlerchr merged 13 commits into
mainfrom
improveCleanup

Conversation

@Siedlerchr

@Siedlerchr Siedlerchr commented Dec 23, 2025

Copy link
Copy Markdown
Member

Closes _____

Follow up from #14568

grafik

This removes the usability issue with Apply, and only the selected tab is executed

Somehow also refs #14055

Steps to test

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • I manually tested my changes in running JabRef (always required)
  • [/] I added JUnit tests for changes (if applicable)
  • I added screenshots in the PR description (if change is visible to the user)
  • [/] I described the change in CHANGELOG.md in a way that is understandable for the average user (if change is visible to the user)
  • [.] I checked the user documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request updating file(s) in https://github.com/JabRef/user-documentation/tree/main/en.

@qodo-free-for-open-source-projects qodo-free-for-open-source-projects Bot changed the title Improve cleanup UI - Single Cleanup button and UI stays open Improve cleanup UI - Single Cleanup button and UI stays open Dec 23, 2025
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Dec 23, 2025

Copy link
Copy Markdown
Contributor

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🟡
🎫 #13109
🔴 Add pseudonymization functionality to the CLI
Make org.jabref.logic.pseudonymization.Pseudonymization available on the command line
interface
Provide similar CLI experience to the consistency check
Follow the implementation pattern of `org.jabref.cli.CheckConsistency` class
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
Missing null validation: The event handler does not validate if getContent() returns null before casting to panel
types, which could cause a ClassCastException if the tab content is not one of the
expected panel types.

Referred Code
getDialogPane().lookupButton(cleanUpButton).addEventFilter(ActionEvent.ACTION, event -> {
    Tab selectedTab = tabPane.getSelectionModel().getSelectedItem();
    if (selectedTab != null && selectedTab.getContent() instanceof CleanupSingleFieldPanel panel) {
        viewModel.apply(panel.getSelectedTab());
    } else if (selectedTab != null && selectedTab.getContent() instanceof CleanupFileRelatedPanel panel) {
        viewModel.apply(panel.getSelectedTab());
    } else if (selectedTab != null && selectedTab.getContent() instanceof CleanupMultiFieldPanel panel) {
        viewModel.apply(panel.getSelectedTab());
    }
    event.consume();
});

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Dec 23, 2025

Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Use an interface for cleanup panels
Suggestion Impact:The commit directly implements the suggestion by replacing the if-else if chain (lines 52-56 in the original code) with a single instanceof check for CleanupPanel interface (line 57). This consolidates the three separate instanceof checks into one, exactly as suggested.

code diff:

-            if (selectedTab != null && selectedTab.getContent() instanceof CleanupSingleFieldPanel panel) {
-                viewModel.apply(panel.getSelectedTab());
-            } else if (selectedTab != null && selectedTab.getContent() instanceof CleanupFileRelatedPanel panel) {
-                viewModel.apply(panel.getSelectedTab());
-            } else if (selectedTab != null && selectedTab.getContent() instanceof CleanupMultiFieldPanel panel) {
+            if (selectedTab != null && selectedTab.getContent() instanceof CleanupPanel panel) {
                 viewModel.apply(panel.getSelectedTab());
             }

Refactor the cleanup panel logic by introducing a common interface with a
getSelectedTab() method to replace the if-else if chain of instanceof checks,
thereby improving code extensibility.

jabgui/src/main/java/org/jabref/gui/cleanup/CleanupDialog.java [93-103]

 getDialogPane().lookupButton(cleanUpButton).addEventFilter(ActionEvent.ACTION, event -> {
     Tab selectedTab = tabPane.getSelectionModel().getSelectedItem();
-    if (selectedTab != null && selectedTab.getContent() instanceof CleanupSingleFieldPanel panel) {
-        viewModel.apply(panel.getSelectedTab());
-    } else if (selectedTab != null && selectedTab.getContent() instanceof CleanupFileRelatedPanel panel) {
-        viewModel.apply(panel.getSelectedTab());
-    } else if (selectedTab != null && selectedTab.getContent() instanceof CleanupMultiFieldPanel panel) {
+    if (selectedTab != null && selectedTab.getContent() instanceof CleanupPanel panel) {
         viewModel.apply(panel.getSelectedTab());
     }
     event.consume();
 });

[Suggestion processed]

Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies that the if-else if chain with instanceof checks can be improved by introducing a common interface for the panel classes, which would enhance code maintainability and extensibility.

Low
  • Update

@Siedlerchr Siedlerchr changed the title Improve cleanup UI - Single Cleanup button and UI stays open Improve cleanup UI - Single Cleanup button and UI stays open and fix UI scaling for font Dec 23, 2025
Comment thread jabgui/src/main/java/org/jabref/gui/cleanup/CleanupDialog.java Outdated
@koppor

koppor commented Dec 23, 2025

Copy link
Copy Markdown
Member

tested locally. looked good. Just localiaztion issue.

Comment thread jabgui/src/main/java/org/jabref/gui/cleanup/CleanupDialog.java Outdated
koppor
koppor previously approved these changes Dec 23, 2025
koppor
koppor previously approved these changes Dec 23, 2025
@koppor koppor enabled auto-merge December 23, 2025 20:30
@Siedlerchr Siedlerchr added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Dec 23, 2025
@koppor koppor disabled auto-merge December 23, 2025 20:33
@koppor

koppor commented Dec 23, 2025

Copy link
Copy Markdown
Member

Font size:

Column not expanded - dialog header not larger

image

@koppor

koppor commented Dec 23, 2025

Copy link
Copy Markdown
Member

Change from 15 to 9 leads to exception

java.lang.IndexOutOfBoundsException: toIndex = 2
	at java.base/java.util.AbstractList.subListRangeCheck(AbstractList.java:509)
	at java.base/java.util.AbstractList.subList(AbstractList.java:499)
	at javafx.base@25.0.1/javafx.collections.ModifiableObservableListBase.subList(ModifiableObservableListBase.java:234)
	at javafx.base@25.0.1/com.sun.javafx.binding.ContentBinding$ListContentBinding.onChanged(ContentBinding.java:123)
	at javafx.base@25.0.1/com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:327)
	at javafx.base@25.0.1/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:71)
	at javafx.base@25.0.1/javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:246)
	at javafx.base@25.0.1/javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
	at javafx.base@25.0.1/javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
	at javafx.base@25.0.1/javafx.collections.ObservableListBase.endChange(ObservableListBase.java:210)
	at javafx.base@25.0.1/com.sun.javafx.collections.ObservableListWrapper.clear(ObservableListWrapper.java:157)
	at org.jabref/org.jabref.gui.theme.ThemeManager.installCssImmediately(ThemeManager.java:121)
	at org.jabref/org.jabref.gui.theme.ThemeManager.lambda$installCss$0(ThemeManager.java:129)

@koppor

koppor commented Dec 23, 2025

Copy link
Copy Markdown
Member

Third row badly algined

image

* main:
  Update AI usage policy (#14698)
  Fix handling of DOIs (#14704)
  Handle ohter CrossRef response (#14696)
  Fix condition for processing closed issues/PRs
  Translate the English "change to Chinese(simplified)" to the Chinese in the warning dialog (#14690)
  More performance optimization (#14695)
  Add missing dot (and a link)
  Add link to PR template also if checklist is present, but not OK (#14694)
  Fix typo in IntelliJ code style instructions (#14693)
  Add import into new library to Welcome Tab (#14669)
  Add initial search requirements (#14633)
@Siedlerchr

Copy link
Copy Markdown
Member Author

Font changing issue with theme Manager -> See melting pot. Unrelated to this PR
Cleanup dialog adjusted:

grafik

@Siedlerchr Siedlerchr enabled auto-merge December 23, 2025 20:55
@Siedlerchr Siedlerchr added this pull request to the merge queue Dec 23, 2025
Merged via the queue into main with commit ce5c95b Dec 23, 2025
52 checks passed
@Siedlerchr Siedlerchr deleted the improveCleanup branch December 23, 2025 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: cleanup-ops Review effort 2/5 status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants