Skip to content
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

Complete refactor of LibraryProperties to mvvm #6107

Merged
merged 15 commits into from
Mar 22, 2020
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ private MenuBar createMenu() {

new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, new LibraryPropertiesAction(this, dialogService, stateManager)),
factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, new LibraryPropertiesAction(this, stateManager)),
factory.createMenuItem(StandardActions.EDIT_PREAMBLE, new PreambleEditor(stateManager, undoManager, this.getDialogService())),
factory.createMenuItem(StandardActions.EDIT_STRINGS, new BibtexStringEditorAction(stateManager)),
factory.createMenuItem(StandardActions.MANAGE_CITE_KEY_PATTERNS, new BibtexKeyPatternAction(this, stateManager)),
Expand Down
128 changes: 0 additions & 128 deletions src/main/java/org/jabref/gui/SaveOrderConfigDisplayViewModel.java

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/cleanup/CleanupPresetPanel.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.VBox?>
<?import org.jabref.gui.commonfxcontrols.FieldFormatterCleanupsPanel?>
<fx:root xmlns:fx="http://javafx.com/fxml/1" spacing="10.0" type="VBox" xmlns="http://javafx.com/javafx/8.0.121"
fx:controller="org.jabref.gui.cleanup.CleanupPresetPanel">

Expand All @@ -28,6 +29,5 @@
<CheckBox fx:id="cleanUpBibtex"
text="%Convert to BibTeX format (for example, move the value of the 'journaltitle' field to 'journal')"/>

<VBox fx:id="formatterContainer"/>

<FieldFormatterCleanupsPanel fx:id="formatterCleanupsPanel"/>
</fx:root>
16 changes: 9 additions & 7 deletions src/main/java/org/jabref/gui/cleanup/CleanupPresetPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
import java.util.Optional;
import java.util.Set;

import javafx.collections.FXCollections;
import javafx.fxml.FXML;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;

import org.jabref.gui.commonfxcontrols.FieldFormatterCleanupsPanel;
import org.jabref.logic.cleanup.CleanupPreset;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.cleanup.FieldFormatterCleanups;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.metadata.FilePreferences;
Expand All @@ -33,8 +36,7 @@ public class CleanupPresetPanel extends VBox {
@FXML private CheckBox cleanUpUpgradeExternalLinks;
@FXML private CheckBox cleanUpBiblatex;
@FXML private CheckBox cleanUpBibtex;
@FXML private VBox formatterContainer;
private FieldFormatterCleanupsPanel cleanUpFormatters;
@FXML private FieldFormatterCleanupsPanel formatterCleanupsPanel;

public CleanupPresetPanel(BibDatabaseContext databaseContext, CleanupPreset cleanupPreset, FilePreferences filePreferences) {
this.databaseContext = Objects.requireNonNull(databaseContext);
Expand Down Expand Up @@ -63,9 +65,6 @@ private void init(CleanupPreset cleanupPreset, FilePreferences filePreferences)

cleanUpUpgradeExternalLinks.setText(Localization.lang("Upgrade external PDF/PS links to use the '%0' field.", StandardField.FILE.getDisplayName()));

cleanUpFormatters = new FieldFormatterCleanupsPanel(Localization.lang("Run field formatter:"));
formatterContainer.getChildren().setAll(cleanUpFormatters);

String currentPattern = Localization.lang("Filename format pattern")
.concat(": ")
.concat(filePreferences.getFileNamePattern());
Expand All @@ -87,7 +86,8 @@ private void updateDisplay(CleanupPreset preset) {
cleanUpBiblatex.setSelected(preset.isActive(CleanupPreset.CleanupStep.CONVERT_TO_BIBLATEX));
cleanUpBibtex.setSelected(preset.isActive(CleanupPreset.CleanupStep.CONVERT_TO_BIBTEX));
cleanUpISSN.setSelected(preset.isActive(CleanupPreset.CleanupStep.CLEAN_UP_ISSN));
cleanUpFormatters.setValues(preset.getFormatterCleanups());
formatterCleanupsPanel.cleanupsDisableProperty().setValue(!preset.getFormatterCleanups().isEnabled());
formatterCleanupsPanel.cleanupsProperty().setValue(FXCollections.observableArrayList(preset.getFormatterCleanups().getConfiguredActions()));
}

public CleanupPreset getCleanupPreset() {
Expand Down Expand Up @@ -127,6 +127,8 @@ public CleanupPreset getCleanupPreset() {

activeJobs.add(CleanupPreset.CleanupStep.FIX_FILE_LINKS);

return new CleanupPreset(activeJobs, cleanUpFormatters.getFormatterCleanups());
return new CleanupPreset(activeJobs, new FieldFormatterCleanups(
!formatterCleanupsPanel.cleanupsDisableProperty().getValue(),
formatterCleanupsPanel.cleanupsProperty()));
}
}
Loading