-
-
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
Open
alexsukhin
wants to merge
34
commits into
JabRef:main
Choose a base branch
from
alexsukhin:13819-add-dialog-tabs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
400c6b0
Add cleanup dialog tabs with individual tab preferences
alexsukhin dd2f74c
Fixed indentation and added commenting
alexsukhin 033201c
Fix Trag-bot review issues
alexsukhin 14fde53
Fix Trag-bot review issues
alexsukhin 9c44aad
Merge branch 'main' into 13819-add-dialog-tabs
alexsukhin 0c5939e
Fix Trag-bot review issues
alexsukhin 757514e
Avoid nested Optionals, returning Optional<CleanupPreferences> directly
alexsukhin a60f696
Refactor CleanupPreferences by keeping one assertion per test
alexsukhin 43c981b
Converted tests to assertEquals
alexsukhin 56b6164
Maintain consistent naming conventions
alexsukhin 4f2ed12
Returns CleanupPreferences directly since value is always present
alexsukhin 1d2f991
Initial review refactor draft
alexsukhin c8c3d42
Merge branch 'main' into 13819-add-dialog-tabs
alexsukhin 7276eb0
fix import error!
alexsukhin 9ed570f
Reformat codebase (more carefully) (#13885)
subhramit 55c02c2
fix import error & merge
alexsukhin b0c4f6a
Apply OpenRewrite Cleanup
alexsukhin 651f5ef
Refactor Cleanup Tabs
alexsukhin d280c21
Merge remote-tracking branch 'upstream/main' into 13819-add-dialog-tabs
alexsukhin 161e36f
Fix getDisplayName method
alexsukhin 2dfb7a7
Fix formatting
alexsukhin 84d7716
Trag-bot review and fix en properties
alexsukhin 442a623
fix indentation plssss
alexsukhin 6606e59
format properly and change to observablelist
alexsukhin f90923a
fix formatting entriestoprocess (please)
alexsukhin 9073361
Updated names and changed optional dependencies back to nullable
alexsukhin a8d371e
Merge branch 'main' into 13819-add-dialog-tabs
alexsukhin 074242e
Merge branch 'main' into 13819-add-dialog-tabs
Siedlerchr 8714141
Refactored panels to use separate ViewModels
alexsukhin f35319f
Moved ALL_JOBS to respective ViewModels, small naming changes
alexsukhin 0ee7d35
Merge upstream/main, fix submodules
alexsukhin b24af6b
Replaced requireNotNull to @NotNull following https://github.com/JabR…
alexsukhin b7f4594
Merge branch 'main' into 13819-add-dialog-tabs
alexsukhin 9c9f202
Merge branch 'main' into 13819-add-dialog-tabs
alexsukhin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 75 additions & 23 deletions
98
jabgui/src/main/java/org/jabref/gui/cleanup/CleanupDialog.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,87 @@ | ||
package org.jabref.gui.cleanup; | ||
|
||
import javafx.scene.control.ButtonType; | ||
import javafx.scene.control.ScrollPane; | ||
import java.util.List; | ||
import java.util.function.Supplier; | ||
|
||
import javax.swing.undo.UndoManager; | ||
alexsukhin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
import javafx.fxml.FXML; | ||
import javafx.scene.control.Tab; | ||
import javafx.scene.control.TabPane; | ||
|
||
import org.jabref.gui.DialogService; | ||
import org.jabref.gui.LibraryTab; | ||
import org.jabref.gui.StateManager; | ||
import org.jabref.gui.util.BaseDialog; | ||
import org.jabref.logic.FilePreferences; | ||
import org.jabref.logic.cleanup.CleanupPreferences; | ||
import org.jabref.logic.l10n.Localization; | ||
import org.jabref.logic.preferences.CliPreferences; | ||
import org.jabref.logic.util.TaskExecutor; | ||
import org.jabref.model.database.BibDatabaseContext; | ||
import org.jabref.model.entry.BibEntry; | ||
|
||
import com.airhacks.afterburner.views.ViewLoader; | ||
|
||
public class CleanupDialog extends BaseDialog<Void> { | ||
alexsukhin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@FXML private TabPane tabPane; | ||
|
||
private final CleanupDialogViewModel viewModel; | ||
|
||
// Constructor for multiple-entry cleanup | ||
public CleanupDialog(BibDatabaseContext databaseContext, | ||
CliPreferences preferences, | ||
DialogService dialogService, | ||
StateManager stateManager, | ||
UndoManager undoManager, | ||
Supplier<LibraryTab> tabSupplier, | ||
TaskExecutor taskExecutor) { | ||
|
||
this.viewModel = new CleanupDialogViewModel( | ||
databaseContext, preferences, dialogService, | ||
stateManager, undoManager, tabSupplier, taskExecutor | ||
); | ||
|
||
init(databaseContext, preferences); | ||
} | ||
|
||
public class CleanupDialog extends BaseDialog<CleanupPreferences> { | ||
public CleanupDialog(BibDatabaseContext databaseContext, CleanupPreferences initialPreset, FilePreferences filePreferences) { | ||
// Constructor for single-entry cleanup | ||
public CleanupDialog(BibEntry targetEntry, | ||
BibDatabaseContext databaseContext, | ||
CliPreferences preferences, | ||
DialogService dialogService, | ||
StateManager stateManager, | ||
UndoManager undoManager) { | ||
|
||
this.viewModel = new CleanupDialogViewModel( | ||
databaseContext, preferences, dialogService, | ||
stateManager, undoManager, null, null | ||
); | ||
|
||
viewModel.setTargetEntries(List.of(targetEntry)); | ||
alexsukhin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
init(databaseContext, preferences); | ||
} | ||
|
||
private void init(BibDatabaseContext databaseContext, CliPreferences preferences) { | ||
setTitle(Localization.lang("Clean up entries")); | ||
getDialogPane().setPrefSize(600, 650); | ||
getDialogPane().getButtonTypes().setAll(ButtonType.OK, ButtonType.CANCEL); | ||
|
||
CleanupPresetPanel presetPanel = new CleanupPresetPanel(databaseContext, initialPreset, filePreferences); | ||
|
||
// placing the content of the presetPanel in a scroll pane | ||
ScrollPane scrollPane = new ScrollPane(); | ||
scrollPane.setFitToWidth(true); | ||
scrollPane.setFitToHeight(true); | ||
scrollPane.setContent(presetPanel); | ||
|
||
getDialogPane().setContent(scrollPane); | ||
setResultConverter(button -> { | ||
if (button == ButtonType.OK) { | ||
return presetPanel.getCleanupPreset(); | ||
} else { | ||
return null; | ||
} | ||
}); | ||
|
||
ViewLoader.view(this) | ||
.load() | ||
.setAsDialogPane(this); | ||
|
||
CleanupPreferences initialPreset = preferences.getCleanupPreferences(); | ||
FilePreferences filePreferences = preferences.getFilePreferences(); | ||
|
||
CleanupSingleFieldPanel singleFieldPanel = new CleanupSingleFieldPanel(initialPreset, viewModel); | ||
CleanupFileRelatedPanel fileRelatedPanel = new CleanupFileRelatedPanel(databaseContext, initialPreset, filePreferences, viewModel); | ||
CleanupMultiFieldPanel multiFieldPanel = new CleanupMultiFieldPanel(initialPreset, viewModel); | ||
|
||
tabPane.getTabs().setAll( | ||
new Tab(Localization.lang("Single field"), singleFieldPanel), | ||
new Tab(Localization.lang("File-related"), fileRelatedPanel), | ||
new Tab(Localization.lang("Multi-field"), multiFieldPanel) | ||
); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.