-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Add tabs to Clean Up Entries dialog #13852
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
base: main
Are you sure you want to change the base?
Conversation
- Removed trivial comments - Renamed PDF-related variables - Updated methods to return Optional - Used Optional property for FieldFormatterCleanups
- Removed trivial comments - Fixed CHANGELOG.md
e8093f7 to
14fde53
Compare
- Removed trivial comments - Improved Optional checks - Perform null check for other parameters
calixtus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First impression after skimming through your changes: looks good, right track. Just set your PR to rfr as soon as you think we should review it.
jablib/src/test/java/org/jabref/logic/cleanup/CleanupPreferencesTest.java
Outdated
Show resolved
Hide resolved
jabgui/src/main/java/org/jabref/gui/cleanup/CleanupFileRelatedPanel.java
Outdated
Show resolved
Hide resolved
calixtus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for your PR,
the code itself looks fine to me.
However, I think with the refactoring to the tabbed dialog, there is now a logical gap:
You use the strategy pattern to configure the preferences to use in the calling CleanupAction and the currently selected tab as part of the configuration, what action should be called: single / multi ... I dont think that this is a good and intuitive ui pattern.
We discussed this shortly on JabCon. We think the solution would be the following ():
- Dismiss returning configuration from the dialog, and pull the logic from the action into a viewmodel of the cleanupDialog.
- Move the ok/cleanup button in the ui inside each tab
- Leave a close/cancel button at the bottom of the dialog.
Hopefully this will relax the complexity of the code and wont mean too much refactoring.
(@koppor @Siedlerchr wdyt?)
| if (button.getButtonData() == ButtonBar.ButtonData.OK_DONE) { | ||
| Tab selectedTab = tabPane.getSelectionModel().getSelectedItem(); | ||
| CleanupPanel panel = (CleanupPanel) selectedTab.getContent(); | ||
| return panel.getCleanupPreferences(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is weird for this dialog.
Split Class org.jabref.gui.cleanup.CleanupPresetPanel split to [org.jabref.gui.cleanup.CleanupFileRelatedPanel, org.jabref.gui.cleanup.CleanupMultiFieldPanel]
|
Hi, thank you for the review! I understand that moving the cleanup logic into a ViewModel per tab will simplify the UI. Just to confirm, is the enum refactor okay? I will return a CleanupPreferences from the ViewModel containing the preferences from the currently selected tab, and in CleanupAction I will update the initial preferences by replacing the category with the preferences returned from the tab. I will also move the Apply button into each tab and leave a global Close button at the bottom. |
|
About View and ViewModel: Every piece of logic should go into the ViewModel. You have a button on each tab, calling a different function in the viewmodel. So there should be no need for the enum anymore. See https://devdocs.jabref.org/code-howtos/javafx.html#architecture-model---view---controller---viewmodel-mvcvm |
- Create new ViewModel, pull logic from Action and SingleAction into ViewModel - Move Apply button to each tab - Remove categories from ENUM and keep enums of all jobs in each respective tab to be used for cleanup
* Fix non record comments by carl # Conflicts: # jabgui/src/main/java/org/jabref/gui/edit/automaticfiededitor/MoveFieldValueAction.java # jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/cell/sidebuttons/ToggleMergeUnmergeButton.java # jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/CommentMerger.java # jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/FieldMerger.java # jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/FileMerger.java # jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/GroupMerger.java # jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/KeywordMerger.java # jablib/src/main/java/org/jabref/logic/layout/format/HTMLChars.java # jablib/src/main/java/org/jabref/model/entry/identifier/ArXivIdentifier.java # jablib/src/main/java/org/jabref/model/entry/identifier/EprintIdentifier.java * Add file exceptions * Remove shebang line * Remove shebang line * Remove shebang line * Expand variables & rename class --------- Co-authored-by: Oliver Kopp <[email protected]>
- Introduced ViewModels to encapsulate state and logic for panels. - Replaced direct UI manipulation with bidirectional bindings. - Ensures cleaner UI logic, easier maintenance
jabgui/src/main/java/org/jabref/gui/cleanup/CleanupMultiFieldViewModel.java
Show resolved
Hide resolved
jabgui/src/main/java/org/jabref/gui/cleanup/CleanupMultiFieldViewModel.java
Show resolved
Hide resolved
jabgui/src/main/java/org/jabref/gui/cleanup/CleanupFileRelatedPanel.java
Show resolved
Hide resolved
268d29d to
0ee7d35
Compare
|
@trag-bot didn't find any issues in the code! ✅✨ |
|
Hi, this PR is ready for review :) |
|
We will look into it asap, but it could take a few days, as we are currently all very busy with our day jobs. Please excuse our tight schedule. |
|
I think RefactoringMiner is needed for review. Reason: Need to check which code is new and which code was just moved. |
koppor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two micro comment; one minor comment, then it should be good to go.
| if (tabSupplier != null) { | ||
| tabSupplier.get().markBaseChanged(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| BibEntry entry, | ||
| NamedCompoundEdit compoundEdit, | ||
| List<JabRefException> failures) { | ||
| // Create and run cleaner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment can be removed. Follows from the code below.
|
|
||
| List<FieldChange> changes = cleaner.cleanup(preset, entry); | ||
|
|
||
| // Register undo action |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment can be removed. Follows from the code below.
| private void cleanup(CleanupPreferences cleanupPreferences, List<BibEntry> entries) { | ||
| List<JabRefException> failures = new ArrayList<>(); | ||
|
|
||
| String editName = entries.size() == 1 ? Localization.lang("Clean up entry") : Localization.lang("Clean up entries"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use entry(s) as form - see https://devdocs.jabref.org/code-howtos/localization.html#general-hints for the hint (last bullet point).
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
|
||
| class CleanupTabSelectionTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reads nice. Thank you for this.

Closes #13819
This PR adds three tabs to the "Clean up entries" dialog: Single-field, File-related, and Multi-field, representing different types of formatters.
Pressing Apply applies the selected actions of the currently active tab, and Close closes the dialog.
Steps to test
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)