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

Preferences cleanup #7849

Merged
merged 6 commits into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
### Changed

- The JabRefHost on Windows now writes a temporary file and calls `-importToOpen` instead of passing the bibtex via `-importBibtex`. [#7374](https://github.com/JabRef/jabref/issues/7374), [JabRef Browser Ext #274](https://github.com/JabRef/JabRef-Browser-Extension/issues/274)
- We merged the barely used ImportSettingsTab and the CustomizationTab in the preferences into one single tab and moved the option to allow Integers in Edition Fields in Bibtex-Mode to the EntryEditor tab. [#7849](https://github.com/JabRef/jabref/pull/7849)

### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
public class EntryEditorPreferences {

private final Map<String, Set<Field>> entryEditorTabList;
private boolean shouldOpenOnNewEntry;
private final boolean shouldOpenOnNewEntry;
private final boolean shouldShowRecommendationsTab;
private final boolean isMrdlibAccepted;
private final boolean shouldShowLatexCitationsTab;
private boolean showSourceTabByDefault;
private boolean enableValidation;
private final boolean showSourceTabByDefault;
private final boolean enableValidation;
private final boolean allowIntegerEditionBibtex;
private double dividerPosition;

public EntryEditorPreferences(Map<String, Set<Field>> entryEditorTabList,
Expand All @@ -23,6 +24,7 @@ public EntryEditorPreferences(Map<String, Set<Field>> entryEditorTabList,
boolean shouldShowLatexCitationsTab,
boolean showSourceTabByDefault,
boolean enableValidation,
boolean allowIntegerEditionBibtex,
double dividerPosition) {

this.entryEditorTabList = entryEditorTabList;
Expand All @@ -32,6 +34,7 @@ public EntryEditorPreferences(Map<String, Set<Field>> entryEditorTabList,
this.shouldShowLatexCitationsTab = shouldShowLatexCitationsTab;
this.showSourceTabByDefault = showSourceTabByDefault;
this.enableValidation = enableValidation;
this.allowIntegerEditionBibtex = allowIntegerEditionBibtex;
this.dividerPosition = dividerPosition;
}

Expand Down Expand Up @@ -63,6 +66,10 @@ public boolean shouldEnableValidation() {
return enableValidation;
}

public boolean shouldAllowIntegerEditionBibtex() {
return allowIntegerEditionBibtex;
}

public double getDividerPosition() {
return dividerPosition;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static FieldEditorFX getForField(final Field field,
databaseContext,
preferences.getFilePreferences(),
journalAbbreviationRepository,
preferences.getGeneralPreferences().shouldAllowIntegerEditionBibtex());
preferences.getEntryEditorPreferences().shouldAllowIntegerEditionBibtex());

boolean isMultiLine = FieldFactory.isMultiLineField(field, preferences.getFieldContentParserPreferences().getNonWrappableFields());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void execute() {
Globals.prefs.getFilePreferences(),
Globals.prefs.getCitationKeyPatternPreferences(),
Globals.journalAbbreviationRepository,
Globals.prefs.getGeneralPreferences().shouldAllowIntegerEditionBibtex());
Globals.prefs.getEntryEditorPreferences().shouldAllowIntegerEditionBibtex());

Task<List<IntegrityMessage>> task = new Task<>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@
import org.jabref.gui.JabRefFrame;
import org.jabref.gui.preferences.appearance.AppearanceTab;
import org.jabref.gui.preferences.citationkeypattern.CitationKeyPatternTab;
import org.jabref.gui.preferences.customization.CustomizationTab;
import org.jabref.gui.preferences.customexporter.CustomExporterTab;
import org.jabref.gui.preferences.customimporter.CustomImporterTab;
import org.jabref.gui.preferences.entryeditor.EntryEditorTab;
import org.jabref.gui.preferences.entryeditortabs.CustomEditorFieldsTab;
import org.jabref.gui.preferences.exporter.ExportCustomizationTab;
import org.jabref.gui.preferences.external.ExternalTab;
import org.jabref.gui.preferences.file.FileTab;
import org.jabref.gui.preferences.general.GeneralTab;
import org.jabref.gui.preferences.groups.GroupsTab;
import org.jabref.gui.preferences.importer.ImportCustomizationTab;
import org.jabref.gui.preferences.importer.ImportSettingsTab;
import org.jabref.gui.preferences.importexport.ImportExportTab;
import org.jabref.gui.preferences.journals.JournalAbbreviationsTab;
import org.jabref.gui.preferences.keybindings.KeyBindingsTab;
import org.jabref.gui.preferences.linkedfiles.LinkedFilesTab;
Expand Down Expand Up @@ -76,14 +75,13 @@ public PreferencesDialogViewModel(DialogService dialogService, PreferencesServic
new JournalAbbreviationsTab(),
new GroupsTab(),
new EntryEditorTab(),
new CustomizationTab(),
new ImportExportTab(),
new CustomEditorFieldsTab(),
new CitationKeyPatternTab(),
new LinkedFilesTab(),
new NameFormatterTab(),
new ImportSettingsTab(),
new ImportCustomizationTab(),
new ExportCustomizationTab(),
new CustomImporterTab(),
new CustomExporterTab(),
new XmpPrivacyTab(),
new NetworkTab(),
new AppearanceTab()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<?import javafx.scene.layout.VBox?>
<fx:root spacing="10.0" type="VBox"
xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml"
fx:controller="org.jabref.gui.preferences.exporter.ExportCustomizationTab">
fx:controller="org.jabref.gui.preferences.customexporter.CustomExporterTab">

<Label styleClass="titleHeader" text="%Custom export formats"/>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jabref.gui.preferences.exporter;
package org.jabref.gui.preferences.customexporter;

import javax.inject.Inject;

Expand All @@ -16,7 +16,7 @@
import com.airhacks.afterburner.views.ViewLoader;
import com.tobiasdiez.easybind.EasyBind;

public class ExportCustomizationTab extends AbstractPreferenceTabView<ExportCustomizationTabViewModel> implements PreferencesTab {
public class CustomExporterTab extends AbstractPreferenceTabView<CustomExporterTabViewModel> implements PreferencesTab {

@FXML private TableView<ExporterViewModel> exporterTable;
@FXML private TableColumn<ExporterViewModel, String> nameColumn;
Expand All @@ -25,7 +25,7 @@ public class ExportCustomizationTab extends AbstractPreferenceTabView<ExportCust

@Inject private JournalAbbreviationRepository repository;

public ExportCustomizationTab() {
public CustomExporterTab() {
ViewLoader.view(this)
.root(this)
.load();
Expand All @@ -38,7 +38,7 @@ public String getTabName() {

@FXML
private void initialize() {
viewModel = new ExportCustomizationTabViewModel(preferencesService, dialogService, repository);
viewModel = new CustomExporterTabViewModel(preferencesService, dialogService, repository);

exporterTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
exporterTable.itemsProperty().bind(viewModel.exportersProperty());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jabref.gui.preferences.exporter;
package org.jabref.gui.preferences.customexporter;

import java.util.List;
import java.util.Optional;
Expand All @@ -16,7 +16,7 @@
import org.jabref.logic.journals.JournalAbbreviationRepository;
import org.jabref.preferences.PreferencesService;

public class ExportCustomizationTabViewModel implements PreferenceTabViewModel {
public class CustomExporterTabViewModel implements PreferenceTabViewModel {

private final ListProperty<ExporterViewModel> exporters = new SimpleListProperty<>(FXCollections.observableArrayList());
private final ListProperty<ExporterViewModel> selectedExporters = new SimpleListProperty<>(FXCollections.observableArrayList());
Expand All @@ -25,7 +25,7 @@ public class ExportCustomizationTabViewModel implements PreferenceTabViewModel {
private final DialogService dialogService;
private final JournalAbbreviationRepository repository;

public ExportCustomizationTabViewModel(PreferencesService preferences, DialogService dialogService, JournalAbbreviationRepository repository) {
public CustomExporterTabViewModel(PreferencesService preferences, DialogService dialogService, JournalAbbreviationRepository repository) {
this.preferences = preferences;
this.dialogService = dialogService;
this.repository = repository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<?import javafx.scene.layout.VBox?>
<fx:root spacing="10.0" type="VBox"
xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml"
fx:controller="org.jabref.gui.preferences.importer.ImportCustomizationTab">
fx:controller="org.jabref.gui.preferences.customimporter.CustomImporterTab">

<Label styleClass="titleHeader" text="%Custom import formats"/>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jabref.gui.preferences.importer;
package org.jabref.gui.preferences.customimporter;

import javafx.fxml.FXML;
import javafx.scene.control.Button;
Expand All @@ -16,15 +16,15 @@
import com.airhacks.afterburner.views.ViewLoader;
import com.tobiasdiez.easybind.EasyBind;

public class ImportCustomizationTab extends AbstractPreferenceTabView<ImportCustomizationTabViewModel> implements PreferencesTab {
public class CustomImporterTab extends AbstractPreferenceTabView<CustomImporterTabViewModel> implements PreferencesTab {

@FXML private TableView<ImporterViewModel> importerTable;
@FXML private TableColumn<ImporterViewModel, String> nameColumn;
@FXML private TableColumn<ImporterViewModel, String> classColumn;
@FXML private TableColumn<ImporterViewModel, String> basePathColumn;
@FXML private Button addButton;

public ImportCustomizationTab() {
public CustomImporterTab() {
ViewLoader.view(this)
.root(this)
.load();
Expand All @@ -37,7 +37,7 @@ public String getTabName() {

@FXML
private void initialize() {
viewModel = new ImportCustomizationTabViewModel(preferencesService, dialogService);
viewModel = new CustomImporterTabViewModel(preferencesService, dialogService);

importerTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
importerTable.itemsProperty().bind(viewModel.importersProperty());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jabref.gui.preferences.importer;
package org.jabref.gui.preferences.customimporter;

import java.io.IOException;
import java.nio.file.Path;
Expand All @@ -25,17 +25,17 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ImportCustomizationTabViewModel implements PreferenceTabViewModel {
public class CustomImporterTabViewModel implements PreferenceTabViewModel {

private static final Logger LOGGER = LoggerFactory.getLogger(ImportCustomizationTabViewModel.class);
private static final Logger LOGGER = LoggerFactory.getLogger(CustomImporterTabViewModel.class);

private final ListProperty<ImporterViewModel> importers = new SimpleListProperty<>(FXCollections.observableArrayList());
private final ListProperty<ImporterViewModel> selectedImporters = new SimpleListProperty<>(FXCollections.observableArrayList());

private final PreferencesService preferences;
private final DialogService dialogService;

public ImportCustomizationTabViewModel(PreferencesService preferences, DialogService dialogService) {
public CustomImporterTabViewModel(PreferencesService preferences, DialogService dialogService) {
this.preferences = preferences;
this.dialogService = dialogService;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
</CheckBox>
<CheckBox fx:id="enableLatexCitationsTab" text="%Show 'LaTeX Citations' tab"/>
<CheckBox fx:id="enableValidation" text="%Show validation messages"/>
<CheckBox fx:id="allowIntegerEdition" text="%Allow integers in 'edition' field in BibTeX mode"/>

<Label styleClass="sectionHeader" text="%Autocompletion"/>
<CheckBox fx:id="enableAutoComplete" text="%Use autocompletion"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class EntryEditorTab extends AbstractPreferenceTabView<EntryEditorTabView
@FXML private CheckBox acceptRecommendations;
@FXML private CheckBox enableLatexCitationsTab;
@FXML private CheckBox enableValidation;
@FXML private CheckBox allowIntegerEdition;
@FXML private CheckBox enableAutoComplete;
@FXML private TextField autoCompleteFields;
@FXML private RadioButton autoCompleteFirstLast;
Expand Down Expand Up @@ -48,6 +49,7 @@ public void initialize() {
acceptRecommendations.selectedProperty().bindBidirectional(viewModel.acceptRecommendationsProperty());
enableLatexCitationsTab.selectedProperty().bindBidirectional(viewModel.enableLatexCitationsTabProperty());
enableValidation.selectedProperty().bindBidirectional(viewModel.enableValidationProperty());
allowIntegerEdition.selectedProperty().bindBidirectional(viewModel.allowIntegerEditionProperty());
enableAutoComplete.selectedProperty().bindBidirectional(viewModel.enableAutoCompleteProperty());
autoCompleteFields.textProperty().bindBidirectional(viewModel.autoCompleteFieldsProperty());
autoCompleteFirstLast.selectedProperty().bindBidirectional(viewModel.autoCompleteFirstLastProperty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class EntryEditorTabViewModel implements PreferenceTabViewModel {
private final BooleanProperty acceptRecommendationsProperty = new SimpleBooleanProperty();
private final BooleanProperty enableLatexCitationsTabProperty = new SimpleBooleanProperty();
private final BooleanProperty enableValidationProperty = new SimpleBooleanProperty();
private final BooleanProperty allowIntegerEditionProperty = new SimpleBooleanProperty();
private final BooleanProperty enableAutoCompleteProperty = new SimpleBooleanProperty();
private final StringProperty autoCompleteFieldsProperty = new SimpleStringProperty();
private final BooleanProperty autoCompleteFirstLastProperty = new SimpleBooleanProperty();
Expand Down Expand Up @@ -59,6 +60,7 @@ public void setValues() {
acceptRecommendationsProperty.setValue(initialEntryEditorPreferences.isMrdlibAccepted());
enableLatexCitationsTabProperty.setValue(initialEntryEditorPreferences.shouldShowLatexCitationsTab());
enableValidationProperty.setValue(initialEntryEditorPreferences.shouldEnableValidation());
allowIntegerEditionProperty.setValue(initialEntryEditorPreferences.shouldAllowIntegerEditionBibtex());

enableAutoCompleteProperty.setValue(initialAutoCompletePreferences.shouldAutoComplete());
autoCompleteFieldsProperty.setValue(initialAutoCompletePreferences.getCompleteNamesAsString());
Expand Down Expand Up @@ -88,6 +90,7 @@ public void storeSettings() {
enableLatexCitationsTabProperty.getValue(),
defaultSourceProperty.getValue(),
enableValidationProperty.getValue(),
allowIntegerEditionProperty.getValue(),
initialEntryEditorPreferences.getDividerPosition()));

// default
Expand Down Expand Up @@ -151,6 +154,10 @@ public BooleanProperty enableValidationProperty() {
return enableValidationProperty;
}

public BooleanProperty allowIntegerEditionProperty() {
return this.allowIntegerEditionProperty;
}

public BooleanProperty enableAutoCompleteProperty() {
return enableAutoCompleteProperty;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
<CheckBox fx:id="inspectionWarningDuplicate"
text="%Warn about unresolved duplicates when closing inspection window"/>
<CheckBox fx:id="confirmDelete" text="%Show confirmation dialog when deleting entries"/>
<CheckBox fx:id="allowIntegerEdition" text="%Allow integers in 'edition' field in BibTeX mode"/>
<CheckBox fx:id="memoryStickMode"
text="%Load and Save preferences from/to jabref.xml on start-up (memory stick mode)"/>
<CheckBox fx:id="collectTelemetry" text="%Collect and share telemetry data to help improve JabRef"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public class GeneralTab extends AbstractPreferenceTabView<GeneralTabViewModel> i
@FXML private ComboBox<BibDatabaseMode> biblatexMode;
@FXML private CheckBox inspectionWarningDuplicate;
@FXML private CheckBox confirmDelete;
@FXML private CheckBox allowIntegerEdition;
@FXML private CheckBox memoryStickMode;
@FXML private CheckBox collectTelemetry;
@FXML private CheckBox showAdvancedHints;
Expand Down Expand Up @@ -77,7 +76,6 @@ public void initialize() {

inspectionWarningDuplicate.selectedProperty().bindBidirectional(viewModel.inspectionWarningDuplicateProperty());
confirmDelete.selectedProperty().bindBidirectional(viewModel.confirmDeleteProperty());
allowIntegerEdition.selectedProperty().bindBidirectional(viewModel.allowIntegerEditionProperty());
memoryStickMode.selectedProperty().bindBidirectional(viewModel.memoryStickModeProperty());
collectTelemetry.selectedProperty().bindBidirectional(viewModel.collectTelemetryProperty());
showAdvancedHints.selectedProperty().bindBidirectional(viewModel.showAdvancedHintsProperty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public class GeneralTabViewModel implements PreferenceTabViewModel {
private final BooleanProperty confirmDeleteProperty = new SimpleBooleanProperty();
private final BooleanProperty memoryStickModeProperty = new SimpleBooleanProperty();
private final BooleanProperty collectTelemetryProperty = new SimpleBooleanProperty();
private final BooleanProperty allowIntegerEditionProperty = new SimpleBooleanProperty();
private final BooleanProperty showAdvancedHintsProperty = new SimpleBooleanProperty();
private final BooleanProperty markOwnerProperty = new SimpleBooleanProperty();
private final StringProperty markOwnerNameProperty = new SimpleStringProperty("");
Expand Down Expand Up @@ -79,7 +78,6 @@ public void setValues() {

inspectionWarningDuplicateProperty.setValue(initialGeneralPreferences.isWarnAboutDuplicatesInInspection());
confirmDeleteProperty.setValue(initialGeneralPreferences.shouldConfirmDelete());
allowIntegerEditionProperty.setValue(initialGeneralPreferences.shouldAllowIntegerEditionBibtex());
memoryStickModeProperty.setValue(initialGeneralPreferences.isMemoryStickMode());
collectTelemetryProperty.setValue(initialTelemetryPreferences.shouldCollectTelemetry());
showAdvancedHintsProperty.setValue(initialGeneralPreferences.shouldShowAdvancedHints());
Expand Down Expand Up @@ -111,7 +109,6 @@ public void storeSettings() {
selectedBiblatexModeProperty.getValue(),
inspectionWarningDuplicateProperty.getValue(),
confirmDeleteProperty.getValue(),
allowIntegerEditionProperty.getValue(),
memoryStickModeProperty.getValue(),
showAdvancedHintsProperty.getValue()));

Expand Down Expand Up @@ -178,10 +175,6 @@ public BooleanProperty collectTelemetryProperty() {
return this.collectTelemetryProperty;
}

public BooleanProperty allowIntegerEditionProperty() {
return this.allowIntegerEditionProperty;
}

public BooleanProperty showAdvancedHintsProperty() {
return this.showAdvancedHintsProperty;
}
Expand Down

This file was deleted.

Loading