Skip to content

Commit

Permalink
Grand unified preferences dialog (#7384)
Browse files Browse the repository at this point in the history
Co-authored-by: Siedlerchr <siedlerkiller@gmail.com>
  • Loading branch information
calixtus and Siedlerchr authored Feb 1, 2021
1 parent c951877 commit 5a11412
Show file tree
Hide file tree
Showing 98 changed files with 997 additions and 1,115 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- The JabRef specific meta-data content in the main field such as priorities (prio1, prio2, ...) are migrated to their respective fields. They are removed from the keywords. [#6840](https://github.com/jabref/jabref/issues/6840)
- We fixed an issue where groups generated from authors' last names did not include all entries of the authors' [#5833](https://github.com/JabRef/jabref/issues/5833)
- The export to MS Office XML now uses the month name for the field `MonthAcessed` instead of the two digit number [#7354](https://github.com/JabRef/jabref/issues/7354)
- We included some standalone dialogs from the options menu in the main preference dialog and fixed some visual issues in the preferences dialog. [#7384](https://github.com/JabRef/jabref/pull/7384)

### Fixed

Expand Down
15 changes: 0 additions & 15 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
import org.jabref.gui.contentselector.ManageContentSelectorAction;
import org.jabref.gui.copyfiles.CopyFilesAction;
import org.jabref.gui.customentrytypes.CustomizeEntryAction;
import org.jabref.gui.customizefields.SetupGeneralFieldsAction;
import org.jabref.gui.desktop.JabRefDesktop;
import org.jabref.gui.dialogs.AutosaveUiManager;
import org.jabref.gui.documentviewer.ShowDocumentViewerAction;
Expand All @@ -75,7 +74,6 @@
import org.jabref.gui.entryeditor.PreviewSwitchAction;
import org.jabref.gui.exporter.ExportCommand;
import org.jabref.gui.exporter.ExportToClipboardAction;
import org.jabref.gui.exporter.ManageCustomExportsAction;
import org.jabref.gui.exporter.SaveAction;
import org.jabref.gui.exporter.SaveAllAction;
import org.jabref.gui.exporter.SaveDatabaseAction;
Expand All @@ -90,15 +88,12 @@
import org.jabref.gui.help.SearchForUpdateAction;
import org.jabref.gui.importer.ImportCommand;
import org.jabref.gui.importer.ImportEntriesDialog;
import org.jabref.gui.importer.ManageCustomImportsAction;
import org.jabref.gui.importer.NewDatabaseAction;
import org.jabref.gui.importer.NewEntryAction;
import org.jabref.gui.importer.actions.OpenDatabaseAction;
import org.jabref.gui.importer.fetcher.LookupIdentifierAction;
import org.jabref.gui.integrity.IntegrityCheckAction;
import org.jabref.gui.journals.AbbreviateAction;
import org.jabref.gui.journals.ManageJournalsAction;
import org.jabref.gui.keyboard.CustomizeKeyBindingAction;
import org.jabref.gui.keyboard.KeyBinding;
import org.jabref.gui.keyboard.KeyBindingRepository;
import org.jabref.gui.libraryproperties.LibraryPropertiesAction;
Expand All @@ -108,7 +103,6 @@
import org.jabref.gui.metadata.PreambleEditor;
import org.jabref.gui.preferences.ShowPreferencesAction;
import org.jabref.gui.preview.CopyCitationAction;
import org.jabref.gui.protectedterms.ManageProtectedTermsAction;
import org.jabref.gui.push.PushToApplicationAction;
import org.jabref.gui.push.PushToApplicationsManager;
import org.jabref.gui.search.GlobalSearchBar;
Expand Down Expand Up @@ -851,15 +845,6 @@ private MenuBar createMenu() {

new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.SETUP_GENERAL_FIELDS, new SetupGeneralFieldsAction()),
factory.createMenuItem(StandardActions.MANAGE_CUSTOM_IMPORTS, new ManageCustomImportsAction()),
factory.createMenuItem(StandardActions.MANAGE_CUSTOM_EXPORTS, new ManageCustomExportsAction()),
factory.createMenuItem(StandardActions.MANAGE_JOURNALS, new ManageJournalsAction()),
factory.createMenuItem(StandardActions.CUSTOMIZE_KEYBINDING, new CustomizeKeyBindingAction()),
factory.createMenuItem(StandardActions.MANAGE_PROTECTED_TERMS, new ManageProtectedTermsAction()),

new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.MANAGE_CONTENT_SELECTORS, new ManageContentSelectorAction(this, stateManager)),
factory.createMenuItem(StandardActions.CUSTOMIZE_ENTRY_TYPES, new CustomizeEntryAction(stateManager, Globals.entryTypesManager))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.util.Collection;

import javax.inject.Inject;

import javafx.beans.property.ListProperty;
import javafx.beans.property.ObjectProperty;
import javafx.fxml.FXML;
Expand All @@ -27,23 +29,25 @@ public class CitationKeyPatternPanel extends TableView<CitationKeyPatternPanelIt
@FXML public TableColumn<CitationKeyPatternPanelItemModel, String> patternColumn;
@FXML public TableColumn<CitationKeyPatternPanelItemModel, EntryType> actionsColumn;

@Inject private PreferencesService preferences;

private CitationKeyPatternPanelViewModel viewModel;

private long lastKeyPressTime;
private String tableSearchTerm;

public CitationKeyPatternPanel(PreferencesService preferences, Collection<BibEntryType> entryTypeList, AbstractCitationKeyPattern keyPattern) {
public CitationKeyPatternPanel() {
super();

viewModel = new CitationKeyPatternPanelViewModel(preferences, entryTypeList, keyPattern);

ViewLoader.view(this)
.root(this)
.load();
}

@FXML
private void initialize() {
viewModel = new CitationKeyPatternPanelViewModel(preferences);

this.setEditable(true);

entryTypeColumn.setSortable(true);
Expand Down Expand Up @@ -80,8 +84,8 @@ private void initialize() {
this.itemsProperty().bindBidirectional(viewModel.patternListProperty());
}

public void setValues() {
viewModel.setValues();
public void setValues(Collection<BibEntryType> entryTypeList, AbstractCitationKeyPattern keyPattern) {
viewModel.setValues(entryTypeList, keyPattern);
}

public void resetAll() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,14 @@ public class CitationKeyPatternPanelViewModel {

private final ListProperty<CitationKeyPatternPanelItemModel> patternListProperty = new SimpleListProperty<>();
private final ObjectProperty<CitationKeyPatternPanelItemModel> defaultItemProperty = new SimpleObjectProperty<>();
private final AbstractCitationKeyPattern initialKeyPattern;
private final Collection<BibEntryType> bibEntryTypeList;

private final PreferencesService preferences;

public CitationKeyPatternPanelViewModel(PreferencesService preferences, Collection<BibEntryType> entryTypeList, AbstractCitationKeyPattern initialKeyPattern) {
public CitationKeyPatternPanelViewModel(PreferencesService preferences) {
this.preferences = preferences;
this.bibEntryTypeList = entryTypeList;
this.initialKeyPattern = initialKeyPattern;
}

public void setValues() {
public void setValues(Collection<BibEntryType> entryTypeList, AbstractCitationKeyPattern initialKeyPattern) {
String defaultPattern;
if ((initialKeyPattern.getDefaultValue() == null) || initialKeyPattern.getDefaultValue().isEmpty()) {
defaultPattern = "";
Expand All @@ -58,17 +55,17 @@ public void setValues() {
patternListProperty.setValue(FXCollections.observableArrayList());
patternListProperty.add(defaultItemProperty.getValue());

bibEntryTypeList.stream()
.map(BibEntryType::getType)
.forEach(entryType -> {
String pattern;
if (initialKeyPattern.isDefaultValue(entryType)) {
pattern = "";
} else {
pattern = initialKeyPattern.getPatterns().get(entryType).get(0);
}
patternListProperty.add(new CitationKeyPatternPanelItemModel(entryType, pattern));
});
entryTypeList.stream()
.map(BibEntryType::getType)
.forEach(entryType -> {
String pattern;
if (initialKeyPattern.isDefaultValue(entryType)) {
pattern = "";
} else {
pattern = initialKeyPattern.getPatterns().get(entryType).get(0);
}
patternListProperty.add(new CitationKeyPatternPanelItemModel(entryType, pattern));
});
}

public void setItemToDefaultPattern(CitationKeyPatternPanelItemModel item) {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 5a11412

Please sign in to comment.