From 72c022e02d98bdba12ea9077a5753ca140178084 Mon Sep 17 00:00:00 2001 From: Gena928 Date: Sun, 5 Apr 2020 18:35:01 +0300 Subject: [PATCH 01/58] Adjusted GroupNodeViewModel.java. Now it's responsible for count if items in group (enable / disable, based on user preferences) --- .../jabref/gui/groups/GroupNodeViewModel.java | 16 ++++++++++++---- .../org/jabref/gui/groups/GroupTreeView.java | 4 +--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java index a20278ae64f..1cffe63046c 100644 --- a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java @@ -6,6 +6,8 @@ import java.util.Optional; import java.util.stream.Collectors; +import javax.inject.Inject; + import javafx.beans.binding.Bindings; import javafx.beans.binding.BooleanBinding; import javafx.beans.property.SimpleBooleanProperty; @@ -37,6 +39,8 @@ import org.jabref.model.groups.GroupEntryChanger; import org.jabref.model.groups.GroupTreeNode; import org.jabref.model.strings.StringUtil; +import org.jabref.preferences.JabRefPreferences; +import org.jabref.preferences.PreferencesService; import com.google.common.base.Enums; import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon; @@ -59,6 +63,7 @@ public class GroupNodeViewModel { private final CustomLocalDragboard localDragBoard; private final ObservableList entriesList; private final DelayTaskThrottler throttler; + @Inject private PreferencesService preferencesService; public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager stateManager, TaskExecutor taskExecutor, GroupTreeNode groupNode, CustomLocalDragboard localDragBoard) { this.databaseContext = Objects.requireNonNull(databaseContext); @@ -66,6 +71,7 @@ public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager state this.stateManager = Objects.requireNonNull(stateManager); this.groupNode = Objects.requireNonNull(groupNode); this.localDragBoard = Objects.requireNonNull(localDragBoard); + this.preferencesService = JabRefPreferences.getInstance(); displayName = new LatexToUnicodeFormatter().format(groupNode.getName()); isRoot = groupNode.isRoot(); @@ -229,10 +235,12 @@ private void calculateNumberOfMatches() { // We calculate the new hit value // We could be more intelligent and try to figure out the new number of hits based on the entry change // for example, a previously matched entry gets removed -> hits = hits - 1 - BackgroundTask - .wrap(() -> groupNode.calculateNumberOfMatches(databaseContext.getDatabase())) - .onSuccess(hits::setValue) - .executeWith(taskExecutor); + if (preferencesService.getDisplayGroupCount()) { + BackgroundTask + .wrap(() -> groupNode.calculateNumberOfMatches(databaseContext.getDatabase())) + .onSuccess(hits::setValue) + .executeWith(taskExecutor); + } } public GroupTreeNode addSubgroup(AbstractGroup subgroup) { diff --git a/src/main/java/org/jabref/gui/groups/GroupTreeView.java b/src/main/java/org/jabref/gui/groups/GroupTreeView.java index 0e96156f96d..06d397338cc 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTreeView.java +++ b/src/main/java/org/jabref/gui/groups/GroupTreeView.java @@ -134,9 +134,7 @@ public void initialize() { group.allSelectedEntriesMatchedProperty()); } Text text = new Text(); - if (preferencesService.getDisplayGroupCount()) { - text.textProperty().bind(group.getHits().asString()); - } + text.textProperty().bind(group.getHits().asString()); text.getStyleClass().setAll("text"); node.getChildren().add(text); node.setMaxWidth(Control.USE_PREF_SIZE); From 1f4e4ad28100bb83657229469ba9ce58e543d017 Mon Sep 17 00:00:00 2001 From: Gena928 Date: Mon, 6 Apr 2020 16:31:15 +0300 Subject: [PATCH 02/58] Adjusted GroupNodeViewModel. In case we can't use PreferencesService injection, I propose to create a property (displayItemsCount) and set this property from outside (from GroupTreeView) as True/False. True - need get count, False - NO need to get count of items. Also I found method "onDatabaseChanged" - it fires when you delete/add new items to group. So we need "displayItemsCount" to restrict calculation in this case also. By default displayItemsCount = False --- .../jabref/gui/groups/GroupNodeViewModel.java | 16 ++++++++++++---- .../org/jabref/gui/groups/GroupTreeView.java | 5 ++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java index 1cffe63046c..33f334799c4 100644 --- a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java @@ -63,7 +63,7 @@ public class GroupNodeViewModel { private final CustomLocalDragboard localDragBoard; private final ObservableList entriesList; private final DelayTaskThrottler throttler; - @Inject private PreferencesService preferencesService; + private boolean displayItemsCount; public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager stateManager, TaskExecutor taskExecutor, GroupTreeNode groupNode, CustomLocalDragboard localDragBoard) { this.databaseContext = Objects.requireNonNull(databaseContext); @@ -71,7 +71,7 @@ public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager state this.stateManager = Objects.requireNonNull(stateManager); this.groupNode = Objects.requireNonNull(groupNode); this.localDragBoard = Objects.requireNonNull(localDragBoard); - this.preferencesService = JabRefPreferences.getInstance(); + this.displayItemsCount = false; displayName = new LatexToUnicodeFormatter().format(groupNode.getName()); isRoot = groupNode.isRoot(); @@ -89,7 +89,6 @@ public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager state hasChildren = new SimpleBooleanProperty(); hasChildren.bind(Bindings.isNotEmpty(children)); hits = new SimpleIntegerProperty(0); - calculateNumberOfMatches(); expandedProperty.set(groupNode.getGroup().isExpanded()); expandedProperty.addListener((observable, oldValue, newValue) -> groupNode.getGroup().setExpanded(newValue)); @@ -235,7 +234,8 @@ private void calculateNumberOfMatches() { // We calculate the new hit value // We could be more intelligent and try to figure out the new number of hits based on the entry change // for example, a previously matched entry gets removed -> hits = hits - 1 - if (preferencesService.getDisplayGroupCount()) { + if (displayItemsCount) { + System.out.println("calculating...."); BackgroundTask .wrap(() -> groupNode.calculateNumberOfMatches(databaseContext.getDatabase())) .onSuccess(hits::setValue) @@ -340,4 +340,12 @@ public void draggedOn(GroupNodeViewModel target, DroppingMouseLocation mouseLoca private int getPositionInParent() { return groupNode.getPositionInParent(); } + + public void setDisplayItemsCount(boolean displayItemsCount) { + this.displayItemsCount = displayItemsCount; + + if (displayItemsCount) { + calculateNumberOfMatches(); + } + } } diff --git a/src/main/java/org/jabref/gui/groups/GroupTreeView.java b/src/main/java/org/jabref/gui/groups/GroupTreeView.java index 06d397338cc..cafd31de78f 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTreeView.java +++ b/src/main/java/org/jabref/gui/groups/GroupTreeView.java @@ -134,7 +134,10 @@ public void initialize() { group.allSelectedEntriesMatchedProperty()); } Text text = new Text(); - text.textProperty().bind(group.getHits().asString()); + if (preferencesService.getDisplayGroupCount()) { + group.setDisplayItemsCount(preferencesService.getDisplayGroupCount()); + text.textProperty().bind(group.getHits().asString()); + } text.getStyleClass().setAll("text"); node.getChildren().add(text); node.setMaxWidth(Control.USE_PREF_SIZE); From ebd628477cff64749481ac9ebb04916320d1626b Mon Sep 17 00:00:00 2001 From: Gennadiy Date: Mon, 6 Apr 2020 16:38:32 +0300 Subject: [PATCH 03/58] Update GroupNodeViewModel.java --- src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java index 33f334799c4..aef726c1c21 100644 --- a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java @@ -235,7 +235,6 @@ private void calculateNumberOfMatches() { // We could be more intelligent and try to figure out the new number of hits based on the entry change // for example, a previously matched entry gets removed -> hits = hits - 1 if (displayItemsCount) { - System.out.println("calculating...."); BackgroundTask .wrap(() -> groupNode.calculateNumberOfMatches(databaseContext.getDatabase())) .onSuccess(hits::setValue) From c0990dcaab45b6ad5f32540b5ab64c167b5e8aaf Mon Sep 17 00:00:00 2001 From: Gena928 Date: Sat, 11 Apr 2020 16:51:51 +0300 Subject: [PATCH 04/58] Injected PreferencesService using a constructor call. --- .../jabref/gui/groups/GroupNodeViewModel.java | 30 +++++++------------ .../org/jabref/gui/groups/GroupTreeView.java | 1 - .../jabref/gui/groups/GroupTreeViewModel.java | 6 ++-- .../gui/groups/GroupNodeViewModelTest.java | 7 +++-- .../gui/groups/GroupTreeViewModelTest.java | 6 ++-- 5 files changed, 20 insertions(+), 30 deletions(-) diff --git a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java index aef726c1c21..9ee98c0b4cb 100644 --- a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java @@ -6,8 +6,6 @@ import java.util.Optional; import java.util.stream.Collectors; -import javax.inject.Inject; - import javafx.beans.binding.Bindings; import javafx.beans.binding.BooleanBinding; import javafx.beans.property.SimpleBooleanProperty; @@ -39,7 +37,6 @@ import org.jabref.model.groups.GroupEntryChanger; import org.jabref.model.groups.GroupTreeNode; import org.jabref.model.strings.StringUtil; -import org.jabref.preferences.JabRefPreferences; import org.jabref.preferences.PreferencesService; import com.google.common.base.Enums; @@ -63,15 +60,15 @@ public class GroupNodeViewModel { private final CustomLocalDragboard localDragBoard; private final ObservableList entriesList; private final DelayTaskThrottler throttler; - private boolean displayItemsCount; + private final PreferencesService preferencesService; - public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager stateManager, TaskExecutor taskExecutor, GroupTreeNode groupNode, CustomLocalDragboard localDragBoard) { + public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager stateManager, TaskExecutor taskExecutor, GroupTreeNode groupNode, CustomLocalDragboard localDragBoard, PreferencesService preferencesService) { this.databaseContext = Objects.requireNonNull(databaseContext); this.taskExecutor = Objects.requireNonNull(taskExecutor); this.stateManager = Objects.requireNonNull(stateManager); this.groupNode = Objects.requireNonNull(groupNode); this.localDragBoard = Objects.requireNonNull(localDragBoard); - this.displayItemsCount = false; + this.preferencesService = preferencesService; displayName = new LatexToUnicodeFormatter().format(groupNode.getName()); isRoot = groupNode.isRoot(); @@ -89,6 +86,7 @@ public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager state hasChildren = new SimpleBooleanProperty(); hasChildren.bind(Bindings.isNotEmpty(children)); hits = new SimpleIntegerProperty(0); + calculateNumberOfMatches(); expandedProperty.set(groupNode.getGroup().isExpanded()); expandedProperty.addListener((observable, oldValue, newValue) -> groupNode.getGroup().setExpanded(newValue)); @@ -103,16 +101,16 @@ public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager state allSelectedEntriesMatched = BindingsHelper.all(selectedEntriesMatchStatus, matched -> matched); } - public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager stateManager, TaskExecutor taskExecutor, AbstractGroup group, CustomLocalDragboard localDragboard) { - this(databaseContext, stateManager, taskExecutor, new GroupTreeNode(group), localDragboard); + public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager stateManager, TaskExecutor taskExecutor, AbstractGroup group, CustomLocalDragboard localDragboard, PreferencesService preferencesService) { + this(databaseContext, stateManager, taskExecutor, new GroupTreeNode(group), localDragboard, preferencesService); } - static GroupNodeViewModel getAllEntriesGroup(BibDatabaseContext newDatabase, StateManager stateManager, TaskExecutor taskExecutor, CustomLocalDragboard localDragBoard) { - return new GroupNodeViewModel(newDatabase, stateManager, taskExecutor, DefaultGroupsFactory.getAllEntriesGroup(), localDragBoard); + static GroupNodeViewModel getAllEntriesGroup(BibDatabaseContext newDatabase, StateManager stateManager, TaskExecutor taskExecutor, CustomLocalDragboard localDragBoard, PreferencesService preferencesService) { + return new GroupNodeViewModel(newDatabase, stateManager, taskExecutor, DefaultGroupsFactory.getAllEntriesGroup(), localDragBoard, preferencesService); } private GroupNodeViewModel toViewModel(GroupTreeNode child) { - return new GroupNodeViewModel(databaseContext, stateManager, taskExecutor, child, localDragBoard); + return new GroupNodeViewModel(databaseContext, stateManager, taskExecutor, child, localDragBoard, preferencesService); } public List addEntriesToGroup(List entries) { @@ -234,7 +232,7 @@ private void calculateNumberOfMatches() { // We calculate the new hit value // We could be more intelligent and try to figure out the new number of hits based on the entry change // for example, a previously matched entry gets removed -> hits = hits - 1 - if (displayItemsCount) { + if (preferencesService.getDisplayGroupCount()) { BackgroundTask .wrap(() -> groupNode.calculateNumberOfMatches(databaseContext.getDatabase())) .onSuccess(hits::setValue) @@ -339,12 +337,4 @@ public void draggedOn(GroupNodeViewModel target, DroppingMouseLocation mouseLoca private int getPositionInParent() { return groupNode.getPositionInParent(); } - - public void setDisplayItemsCount(boolean displayItemsCount) { - this.displayItemsCount = displayItemsCount; - - if (displayItemsCount) { - calculateNumberOfMatches(); - } - } } diff --git a/src/main/java/org/jabref/gui/groups/GroupTreeView.java b/src/main/java/org/jabref/gui/groups/GroupTreeView.java index cafd31de78f..0e96156f96d 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTreeView.java +++ b/src/main/java/org/jabref/gui/groups/GroupTreeView.java @@ -135,7 +135,6 @@ public void initialize() { } Text text = new Text(); if (preferencesService.getDisplayGroupCount()) { - group.setDisplayItemsCount(preferencesService.getDisplayGroupCount()); text.textProperty().bind(group.getHits().asString()); } text.getStyleClass().setAll("text"); diff --git a/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java index d0b77597aad..e9f9c4bcb49 100644 --- a/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java @@ -126,13 +126,13 @@ private void onActiveDatabaseChanged(Optional newDatabase) { GroupNodeViewModel newRoot = newDatabase .map(BibDatabaseContext::getMetaData) .flatMap(MetaData::getGroups) - .map(root -> new GroupNodeViewModel(newDatabase.get(), stateManager, taskExecutor, root, localDragboard)) - .orElse(GroupNodeViewModel.getAllEntriesGroup(newDatabase.get(), stateManager, taskExecutor, localDragboard)); + .map(root -> new GroupNodeViewModel(newDatabase.get(), stateManager, taskExecutor, root, localDragboard, preferences)) + .orElse(GroupNodeViewModel.getAllEntriesGroup(newDatabase.get(), stateManager, taskExecutor, localDragboard, preferences)); rootGroup.setValue(newRoot); selectedGroups.setAll( stateManager.getSelectedGroup(newDatabase.get()).stream() - .map(selectedGroup -> new GroupNodeViewModel(newDatabase.get(), stateManager, taskExecutor, selectedGroup, localDragboard)) + .map(selectedGroup -> new GroupNodeViewModel(newDatabase.get(), stateManager, taskExecutor, selectedGroup, localDragboard, preferences)) .collect(Collectors.toList())); } else { rootGroup.setValue(null); diff --git a/src/test/java/org/jabref/gui/groups/GroupNodeViewModelTest.java b/src/test/java/org/jabref/gui/groups/GroupNodeViewModelTest.java index 90af41c477c..4b7b35e19e0 100644 --- a/src/test/java/org/jabref/gui/groups/GroupNodeViewModelTest.java +++ b/src/test/java/org/jabref/gui/groups/GroupNodeViewModelTest.java @@ -20,6 +20,7 @@ import org.jabref.model.groups.GroupHierarchyType; import org.jabref.model.groups.GroupTreeNode; import org.jabref.model.groups.WordKeywordGroup; +import org.jabref.preferences.PreferencesService; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -160,7 +161,7 @@ public void entriesAreAddedCorrectly() { BibEntry entry = new BibEntry(); databaseContext.getDatabase().insertEntry(entry); - GroupNodeViewModel model = new GroupNodeViewModel(databaseContext, stateManager, taskExecutor, group, new CustomLocalDragboard()); + GroupNodeViewModel model = new GroupNodeViewModel(databaseContext, stateManager, taskExecutor, group, new CustomLocalDragboard(), mock(PreferencesService.class)); model.addEntriesToGroup(databaseContext.getEntries()); assertEquals(databaseContext.getEntries(), model.getGroupNode().getEntriesInGroup(databaseContext.getEntries())); @@ -168,10 +169,10 @@ public void entriesAreAddedCorrectly() { } private GroupNodeViewModel getViewModelForGroup(AbstractGroup group) { - return new GroupNodeViewModel(databaseContext, stateManager, taskExecutor, group, new CustomLocalDragboard()); + return new GroupNodeViewModel(databaseContext, stateManager, taskExecutor, group, new CustomLocalDragboard(), mock(PreferencesService.class)); } private GroupNodeViewModel getViewModelForGroup(GroupTreeNode group) { - return new GroupNodeViewModel(databaseContext, stateManager, taskExecutor, group, new CustomLocalDragboard()); + return new GroupNodeViewModel(databaseContext, stateManager, taskExecutor, group, new CustomLocalDragboard(), mock(PreferencesService.class)); } } diff --git a/src/test/java/org/jabref/gui/groups/GroupTreeViewModelTest.java b/src/test/java/org/jabref/gui/groups/GroupTreeViewModelTest.java index 40d37af02b4..885bb89de3a 100644 --- a/src/test/java/org/jabref/gui/groups/GroupTreeViewModelTest.java +++ b/src/test/java/org/jabref/gui/groups/GroupTreeViewModelTest.java @@ -41,7 +41,7 @@ public void setUp() throws Exception { @Test public void rootGroupIsAllEntriesByDefault() throws Exception { AllEntriesGroup allEntriesGroup = new AllEntriesGroup("All entries"); - assertEquals(new GroupNodeViewModel(databaseContext, stateManager, taskExecutor, allEntriesGroup, new CustomLocalDragboard()), groupTree.rootGroupProperty().getValue()); + assertEquals(new GroupNodeViewModel(databaseContext, stateManager, taskExecutor, allEntriesGroup, new CustomLocalDragboard(), mock(PreferencesService.class)), groupTree.rootGroupProperty().getValue()); } @Test @@ -50,7 +50,7 @@ public void explicitGroupsAreRemovedFromEntriesOnDelete() { BibEntry entry = new BibEntry(); databaseContext.getDatabase().insertEntry(entry); - GroupNodeViewModel model = new GroupNodeViewModel(databaseContext, stateManager, taskExecutor, group, new CustomLocalDragboard()); + GroupNodeViewModel model = new GroupNodeViewModel(databaseContext, stateManager, taskExecutor, group, new CustomLocalDragboard(), mock(PreferencesService.class)); model.addEntriesToGroup(databaseContext.getEntries()); groupTree.removeGroupsAndSubGroupsFromEntries(model); @@ -64,7 +64,7 @@ public void keywordGroupsAreNotRemovedFromEntriesOnDelete() { BibEntry entry = new BibEntry(); databaseContext.getDatabase().insertEntry(entry); - GroupNodeViewModel model = new GroupNodeViewModel(databaseContext, stateManager, taskExecutor, group, new CustomLocalDragboard()); + GroupNodeViewModel model = new GroupNodeViewModel(databaseContext, stateManager, taskExecutor, group, new CustomLocalDragboard(), mock(PreferencesService.class)); model.addEntriesToGroup(databaseContext.getEntries()); groupTree.removeGroupsAndSubGroupsFromEntries(model); From f6c12f4079697ef3b5ac2ff5da37f7a752252469 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Tue, 28 Apr 2020 09:08:25 +0200 Subject: [PATCH 05/58] Update GroupNodeViewModel.java --- src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java index 05031d4d680..8252df7a3dd 100644 --- a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java @@ -58,7 +58,6 @@ public class GroupNodeViewModel { private final TaskExecutor taskExecutor; private final CustomLocalDragboard localDragBoard; private final ObservableList entriesList; - private final DelayTaskThrottler throttler; private final PreferencesService preferencesService; public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager stateManager, TaskExecutor taskExecutor, GroupTreeNode groupNode, CustomLocalDragboard localDragBoard, PreferencesService preferencesService) { From 3f368e981032881b4f8abe7e59546d7d42c17910 Mon Sep 17 00:00:00 2001 From: Niklas Schmitt Date: Fri, 1 May 2020 14:45:41 +0200 Subject: [PATCH 06/58] Fixed an issue where a new entry is not shown in the library if a filter is active --- CHANGELOG.md | 1 + src/main/java/org/jabref/gui/EntryTypeView.java | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d39e2745597..77328439ac6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - We fixed an issue where JabRef switched to discrete graphics under macOS [#5935](https://github.com/JabRef/jabref/issues/5935) - We fixed an issue where the Preferences entry preview will be unexpected modified leads to Value too long exception [#6198](https://github.com/JabRef/jabref/issues/6198) - We fixed an issue where custom jstyles for Open/LibreOffice would only be valid if a layout line for the entry type `default` was at the end of the layout section [#6303](https://github.com/JabRef/jabref/issues/6303) +- We fixed an issue where a new entry is not shown in the library if a filter is active [#6297](https://github.com/JabRef/jabref/issues/6297) ### Removed diff --git a/src/main/java/org/jabref/gui/EntryTypeView.java b/src/main/java/org/jabref/gui/EntryTypeView.java index e4f0d11a9c7..93429c00a4e 100644 --- a/src/main/java/org/jabref/gui/EntryTypeView.java +++ b/src/main/java/org/jabref/gui/EntryTypeView.java @@ -188,6 +188,7 @@ private void focusTextField(Event event) { private void setEntryTypeForReturnAndClose(Optional entryType) { type = entryType.map(BibEntryType::getType).orElse(null); viewModel.stopFetching(); + this.basePanel.frame().getGlobalSearchBar().endSearch(); this.close(); } From c8da256d894b124cdd6a7a998862a7c853d09d6f Mon Sep 17 00:00:00 2001 From: Giri Date: Fri, 8 May 2020 18:06:54 -0400 Subject: [PATCH 07/58] Partial fix for issue 5891 --- CHANGELOG.md | 1 + .../java/org/jabref/model/database/BibDatabaseContext.java | 2 -- .../java/org/jabref/logic/integrity/IntegrityCheckTest.java | 5 ++++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5f4e34895c..327b8aa52ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve ### Fixed +- We fixed to only search file links in the BIB file location directory when preferences has corresponding checkbox checked. [#5891](https://github.com/JabRef/jabref/issues/5891) - We fixed wrong button order (Apply and Cancel) in ManageProtectedTermsDialog. - We fixed an issue with incompatible characters at BibTeX key [#6257](https://github.com/JabRef/jabref/issues/6257) - We fixed an issue where dash (`-`) was reported as illegal BibTeX key [#6295](https://github.com/JabRef/jabref/issues/6295) diff --git a/src/main/java/org/jabref/model/database/BibDatabaseContext.java b/src/main/java/org/jabref/model/database/BibDatabaseContext.java index f6f56dc5bd7..20d3c85ddbb 100644 --- a/src/main/java/org/jabref/model/database/BibDatabaseContext.java +++ b/src/main/java/org/jabref/model/database/BibDatabaseContext.java @@ -144,8 +144,6 @@ public List getFileDirectoriesAsPaths(FilePreferences preferences) { // Check if we should add it as primary file dir (first in the list) or not: if (preferences.isBibLocationAsPrimary()) { fileDirs.add(0, parentPath); - } else { - fileDirs.add(parentPath); } }); diff --git a/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java b/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java index 4da2ccc6d2b..4f8eb0c5901 100644 --- a/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java +++ b/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java @@ -35,6 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; class IntegrityCheckTest { @@ -414,8 +415,10 @@ private void assertWrong(BibDatabaseContext context) { } private void assertCorrect(BibDatabaseContext context) { + FilePreferences filePreferencesMock = mock(FilePreferences.class); + when(filePreferencesMock.isBibLocationAsPrimary()).thenReturn(true); List messages = new IntegrityCheck(context, - mock(FilePreferences.class), + filePreferencesMock, createBibtexKeyPatternPreferences(), JournalAbbreviationLoader.loadBuiltInRepository(), false ).checkDatabase(); From ce3335776aca522f3cf4333032bd23a96a6b9551 Mon Sep 17 00:00:00 2001 From: Giri Date: Fri, 8 May 2020 18:06:54 -0400 Subject: [PATCH 08/58] Added more tests --- CHANGELOG.md | 1 + .../model/database/BibDatabaseContext.java | 2 -- .../externalfiles/AutoSetFileLinksUtilTest.java | 17 +++++++++++++---- .../logic/cleanup/MoveFilesCleanupTest.java | 14 +++++++++++++- .../logic/integrity/IntegrityCheckTest.java | 5 ++++- 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5f4e34895c..327b8aa52ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve ### Fixed +- We fixed to only search file links in the BIB file location directory when preferences has corresponding checkbox checked. [#5891](https://github.com/JabRef/jabref/issues/5891) - We fixed wrong button order (Apply and Cancel) in ManageProtectedTermsDialog. - We fixed an issue with incompatible characters at BibTeX key [#6257](https://github.com/JabRef/jabref/issues/6257) - We fixed an issue where dash (`-`) was reported as illegal BibTeX key [#6295](https://github.com/JabRef/jabref/issues/6295) diff --git a/src/main/java/org/jabref/model/database/BibDatabaseContext.java b/src/main/java/org/jabref/model/database/BibDatabaseContext.java index f6f56dc5bd7..20d3c85ddbb 100644 --- a/src/main/java/org/jabref/model/database/BibDatabaseContext.java +++ b/src/main/java/org/jabref/model/database/BibDatabaseContext.java @@ -144,8 +144,6 @@ public List getFileDirectoriesAsPaths(FilePreferences preferences) { // Check if we should add it as primary file dir (first in the list) or not: if (preferences.isBibLocationAsPrimary()) { fileDirs.add(0, parentPath); - } else { - fileDirs.add(parentPath); } }); diff --git a/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java b/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java index 1bcd3895338..2aaf9e98eca 100644 --- a/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java +++ b/src/test/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtilTest.java @@ -30,24 +30,33 @@ public class AutoSetFileLinksUtilTest { private final BibDatabaseContext databaseContext = mock(BibDatabaseContext.class); private final ExternalFileTypes externalFileTypes = mock(ExternalFileTypes.class); private final BibEntry entry = new BibEntry(StandardEntryType.Article); + private Path path = null; @BeforeEach public void setUp(@TempDir Path folder) throws Exception { - Path path = folder.resolve("CiteKey.pdf"); + path = folder.resolve("CiteKey.pdf"); Files.createFile(path); entry.setCiteKey("CiteKey"); - when(databaseContext.getFileDirectoriesAsPaths(any())).thenReturn(Collections.singletonList(path.getParent())); - when(externalFileTypes.getExternalFileTypeSelection()).thenReturn(new TreeSet<>(ExternalFileTypes.getDefaultExternalFileTypes())); } @Test - public void test() throws Exception { + public void testFindAssociatedNotLinkedFilesSuccess() throws Exception { // Due to mocking the externalFileType class, the file extension will not be found + when(databaseContext.getFileDirectoriesAsPaths(any())).thenReturn(Collections.singletonList(path.getParent())); + when(externalFileTypes.getExternalFileTypeSelection()).thenReturn(new TreeSet<>(ExternalFileTypes.getDefaultExternalFileTypes())); List expected = Collections.singletonList(new LinkedFile("", "CiteKey.pdf", "")); AutoSetFileLinksUtil util = new AutoSetFileLinksUtil(databaseContext, fileDirPrefs, autoLinkPrefs, externalFileTypes); List actual = util.findAssociatedNotLinkedFiles(entry); assertEquals(expected, actual); } + + @Test + public void testFindAssociatedNotLinkedFilesForEmptySearchDir() throws Exception { + when(fileDirPrefs.isBibLocationAsPrimary()).thenReturn(false); + AutoSetFileLinksUtil util = new AutoSetFileLinksUtil(databaseContext, fileDirPrefs, autoLinkPrefs, externalFileTypes); + List actual = util.findAssociatedNotLinkedFiles(entry); + assertEquals(Collections.emptyList(), actual); + } } diff --git a/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java b/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java index 22ef8bd86e7..a237f03d6d8 100644 --- a/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java +++ b/src/test/java/org/jabref/logic/cleanup/MoveFilesCleanupTest.java @@ -4,8 +4,11 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.Arrays; +import java.util.Collections; +import java.util.List; import java.util.Optional; +import org.jabref.model.FieldChange; import org.jabref.model.database.BibDatabase; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; @@ -32,6 +35,7 @@ class MoveFilesCleanupTest { private MoveFilesCleanup cleanup; private BibEntry entry; private FilePreferences filePreferences; + private BibDatabaseContext databaseContext; @BeforeEach void setUp(@TempDir Path bibFolder) throws IOException { @@ -47,7 +51,7 @@ void setUp(@TempDir Path bibFolder) throws IOException { MetaData metaData = new MetaData(); metaData.setDefaultFileDirectory(defaultFileFolder.toAbsolutePath().toString()); - BibDatabaseContext databaseContext = new BibDatabaseContext(new BibDatabase(), metaData); + databaseContext = new BibDatabaseContext(new BibDatabase(), metaData); Files.createFile(bibFolder.resolve("test.bib")); databaseContext.setDatabasePath(bibFolder.resolve("test.bib")); @@ -119,4 +123,12 @@ void movesFileWithSubdirectoryPattern() throws Exception { assertFalse(Files.exists(fileBefore)); assertTrue(Files.exists(fileAfter)); } + + @Test + void movesFileWithNoDirectory() throws Exception { + databaseContext.setMetaData(new MetaData()); + when(filePreferences.getFileDirPattern()).thenReturn(""); + List changes = cleanup.cleanup(entry); + assertEquals(Collections.emptyList(), changes); + } } diff --git a/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java b/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java index 4da2ccc6d2b..4f8eb0c5901 100644 --- a/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java +++ b/src/test/java/org/jabref/logic/integrity/IntegrityCheckTest.java @@ -35,6 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; class IntegrityCheckTest { @@ -414,8 +415,10 @@ private void assertWrong(BibDatabaseContext context) { } private void assertCorrect(BibDatabaseContext context) { + FilePreferences filePreferencesMock = mock(FilePreferences.class); + when(filePreferencesMock.isBibLocationAsPrimary()).thenReturn(true); List messages = new IntegrityCheck(context, - mock(FilePreferences.class), + filePreferencesMock, createBibtexKeyPatternPreferences(), JournalAbbreviationLoader.loadBuiltInRepository(), false ).checkDatabase(); From 40541adf1ad48ef29ac990126cbe3fa099efef9b Mon Sep 17 00:00:00 2001 From: Gena928 Date: Fri, 22 May 2020 15:59:43 +0300 Subject: [PATCH 09/58] Small update to resolve GIT conflict My method (calculateNumberOfMatches) is no longer valid and GroupNodeViewModel must use a new methods called "findMatches" --- src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java index 8252df7a3dd..e070abd3fe1 100644 --- a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java @@ -254,10 +254,6 @@ private void updateMatchedEntries() { // We could be more intelligent and try to figure out the new number of hits based on the entry change // for example, a previously matched entry gets removed -> hits = hits - 1 if (preferencesService.getDisplayGroupCount()) { - BackgroundTask - .wrap(() -> groupNode.calculateNumberOfMatches(databaseContext.getDatabase())) - .onSuccess(hits::setValue) - .executeWith(taskExecutor); BackgroundTask .wrap(() -> groupNode.findMatches(databaseContext.getDatabase())) .onSuccess(entries -> { From 92874909b5c6d2e4de966b995fa11192c164beb6 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Fri, 22 May 2020 17:08:08 +0200 Subject: [PATCH 10/58] Return true in action helper if file is online link otherwise it will be interpreted as path which obiously fails Fixes #6507 --- src/main/java/org/jabref/gui/actions/ActionHelper.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/jabref/gui/actions/ActionHelper.java b/src/main/java/org/jabref/gui/actions/ActionHelper.java index bbb22b6022f..667d52fc794 100644 --- a/src/main/java/org/jabref/gui/actions/ActionHelper.java +++ b/src/main/java/org/jabref/gui/actions/ActionHelper.java @@ -55,6 +55,11 @@ public static BooleanExpression isFilePresentForSelectedEntry(StateManager state List files = entry.getFiles(); if ((entry.getFiles().size() > 0) && stateManager.getActiveDatabase().isPresent()) { + + if(files.get(0).isOnlineLink()) { + return true; + } + Optional filename = FileHelper.find( stateManager.getActiveDatabase().get(), files.get(0).getLink(), From d4f23fa02b7469501a12389c5d62fc51d2fd0c83 Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Fri, 22 May 2020 17:13:02 +0200 Subject: [PATCH 11/58] fix checkstyle --- src/main/java/org/jabref/gui/actions/ActionHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/actions/ActionHelper.java b/src/main/java/org/jabref/gui/actions/ActionHelper.java index 667d52fc794..00c8184cd0c 100644 --- a/src/main/java/org/jabref/gui/actions/ActionHelper.java +++ b/src/main/java/org/jabref/gui/actions/ActionHelper.java @@ -56,7 +56,7 @@ public static BooleanExpression isFilePresentForSelectedEntry(StateManager state if ((entry.getFiles().size() > 0) && stateManager.getActiveDatabase().isPresent()) { - if(files.get(0).isOnlineLink()) { + if (files.get(0).isOnlineLink()) { return true; } From b1e899adc924d54e3c44fb356df2c3e002293df6 Mon Sep 17 00:00:00 2001 From: Niklas Schmitt Date: Fri, 22 May 2020 18:24:29 +0200 Subject: [PATCH 12/58] Adjusted fix by using StateManager for clearing search bar --- src/main/java/org/jabref/gui/EntryTypeView.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/EntryTypeView.java b/src/main/java/org/jabref/gui/EntryTypeView.java index 93429c00a4e..5d5d7735736 100644 --- a/src/main/java/org/jabref/gui/EntryTypeView.java +++ b/src/main/java/org/jabref/gui/EntryTypeView.java @@ -7,6 +7,7 @@ import javafx.application.Platform; import javafx.event.Event; import javafx.fxml.FXML; +import javax.inject.Inject; import javafx.scene.control.Button; import javafx.scene.control.ButtonType; import javafx.scene.control.ComboBox; @@ -55,6 +56,8 @@ public class EntryTypeView extends BaseDialog { @FXML private TitledPane ieeeTranTitlePane; @FXML private TitledPane customTitlePane; + @Inject StateManager stateManager; + private final BasePanel basePanel; private final DialogService dialogService; private final JabRefPreferences prefs; @@ -188,7 +191,7 @@ private void focusTextField(Event event) { private void setEntryTypeForReturnAndClose(Optional entryType) { type = entryType.map(BibEntryType::getType).orElse(null); viewModel.stopFetching(); - this.basePanel.frame().getGlobalSearchBar().endSearch(); + this.stateManager.clearSearchQuery(); this.close(); } From 77489409d92abfeb4bbbb360172e12fb6f294b63 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Fri, 22 May 2020 18:59:52 +0200 Subject: [PATCH 13/58] Update ActionHelper.java --- src/main/java/org/jabref/gui/actions/ActionHelper.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/jabref/gui/actions/ActionHelper.java b/src/main/java/org/jabref/gui/actions/ActionHelper.java index 00c8184cd0c..dfad438f8c0 100644 --- a/src/main/java/org/jabref/gui/actions/ActionHelper.java +++ b/src/main/java/org/jabref/gui/actions/ActionHelper.java @@ -55,7 +55,6 @@ public static BooleanExpression isFilePresentForSelectedEntry(StateManager state List files = entry.getFiles(); if ((entry.getFiles().size() > 0) && stateManager.getActiveDatabase().isPresent()) { - if (files.get(0).isOnlineLink()) { return true; } From 2c1a69e37c5c8a74b76797b99bcb6b3276c770fc Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage Date: Sat, 23 May 2020 00:07:56 +0200 Subject: [PATCH 14/58] Refactored tableColumnsTab and tableTab, changed to PreferencesService --- .../MainTableNameFormatPreferences.java | 30 +++ .../gui/preferences/TableColumnsTab.fxml | 1 + .../gui/preferences/TableColumnsTabView.java | 2 + .../preferences/TableColumnsTabViewModel.java | 44 +-- .../org/jabref/gui/preferences/TableTab.fxml | 5 - .../jabref/gui/preferences/TableTabView.java | 3 - .../gui/preferences/TableTabViewModel.java | 119 +++++---- .../jabref/preferences/JabRefPreferences.java | 252 +++++++++++------- .../preferences/PreferencesService.java | 24 ++ 9 files changed, 303 insertions(+), 177 deletions(-) create mode 100644 src/main/java/org/jabref/gui/maintable/MainTableNameFormatPreferences.java diff --git a/src/main/java/org/jabref/gui/maintable/MainTableNameFormatPreferences.java b/src/main/java/org/jabref/gui/maintable/MainTableNameFormatPreferences.java new file mode 100644 index 00000000000..fde7f1e7b66 --- /dev/null +++ b/src/main/java/org/jabref/gui/maintable/MainTableNameFormatPreferences.java @@ -0,0 +1,30 @@ +package org.jabref.gui.maintable; + +public class MainTableNameFormatPreferences { + + public enum DisplayStyle { + NATBIB, AS_IS, FIRSTNAME_LASTNAME, LASTNAME_FIRSTNAME + } + + public enum AbbreviationStyle { + NONE, LASTNAME_ONLY, FULL + } + + private final DisplayStyle displayStyle; + private final AbbreviationStyle abbreviationStyle; + + public MainTableNameFormatPreferences(DisplayStyle displayStyle, + AbbreviationStyle abbreviationStyle) { + + this.displayStyle = displayStyle; + this.abbreviationStyle = abbreviationStyle; + } + + public DisplayStyle getDisplayStyle() { + return displayStyle; + } + + public AbbreviationStyle getAbbreviationStyle() { + return abbreviationStyle; + } +} diff --git a/src/main/java/org/jabref/gui/preferences/TableColumnsTab.fxml b/src/main/java/org/jabref/gui/preferences/TableColumnsTab.fxml index 6a53f3ca333..91ba147c9c7 100644 --- a/src/main/java/org/jabref/gui/preferences/TableColumnsTab.fxml +++ b/src/main/java/org/jabref/gui/preferences/TableColumnsTab.fxml @@ -97,6 +97,7 @@ toggleGroup="$specialFieldsStoreMode"/> + diff --git a/src/main/java/org/jabref/gui/preferences/TableColumnsTabView.java b/src/main/java/org/jabref/gui/preferences/TableColumnsTabView.java index 7a5a3e07057..9c30713cffc 100644 --- a/src/main/java/org/jabref/gui/preferences/TableColumnsTabView.java +++ b/src/main/java/org/jabref/gui/preferences/TableColumnsTabView.java @@ -37,6 +37,7 @@ public class TableColumnsTabView extends AbstractPreferenceTabView restartWarnings = new ArrayList<>(); private final DialogService dialogService; - private final JabRefPreferences preferences; - private final MainTablePreferences mainTablePreferences; - private final ColumnPreferences columnPreferences; - private final SpecialFieldsPreferences specialFieldsPreferences; + private final PreferencesService preferences; - public TableColumnsTabViewModel(DialogService dialogService, JabRefPreferences preferences) { + private ColumnPreferences initialColumnPreferences; + private SpecialFieldsPreferences initialSpecialFieldsPreferences; + + public TableColumnsTabViewModel(DialogService dialogService, PreferencesService preferences) { this.dialogService = dialogService; this.preferences = preferences; - this.mainTablePreferences = preferences.getMainTablePreferences(); - this.columnPreferences = mainTablePreferences.getColumnPreferences(); - this.specialFieldsPreferences = preferences.getSpecialFieldsPreferences(); specialFieldsEnabledProperty.addListener((observable, oldValue, newValue) -> { if (newValue) { @@ -105,15 +103,19 @@ public TableColumnsTabViewModel(DialogService dialogService, JabRefPreferences p @Override public void setValues() { - specialFieldsEnabledProperty.setValue(specialFieldsPreferences.getSpecialFieldsEnabled()); - specialFieldsSyncKeywordsProperty.setValue(specialFieldsPreferences.getAutoSyncSpecialFieldsToKeyWords()); - specialFieldsSerializeProperty.setValue(specialFieldsPreferences.getSerializeSpecialFields()); - extraFileColumnsEnabledProperty.setValue(mainTablePreferences.getExtraFileColumnsEnabled()); + MainTablePreferences initialMainTablePreferences = preferences.getMainTablePreferences(); + initialColumnPreferences = initialMainTablePreferences.getColumnPreferences(); + initialSpecialFieldsPreferences = preferences.getSpecialFieldsPreferences(); + + specialFieldsEnabledProperty.setValue(initialSpecialFieldsPreferences.getSpecialFieldsEnabled()); + specialFieldsSyncKeywordsProperty.setValue(initialSpecialFieldsPreferences.getAutoSyncSpecialFieldsToKeyWords()); + specialFieldsSerializeProperty.setValue(initialSpecialFieldsPreferences.getSerializeSpecialFields()); + extraFileColumnsEnabledProperty.setValue(initialMainTablePreferences.getExtraFileColumnsEnabled()); + autoResizeColumnsProperty.setValue(initialMainTablePreferences.getResizeColumnsToFit()); fillColumnList(); availableColumnsProperty.clear(); - availableColumnsProperty.addAll( new MainTableColumnModel(MainTableColumnModel.Type.INDEX), new MainTableColumnModel(MainTableColumnModel.Type.LINKED_IDENTIFIER), @@ -142,7 +144,9 @@ public void setValues() { public void fillColumnList() { columnsListProperty.getValue().clear(); - columnPreferences.getColumns().forEach(columnsListProperty.getValue()::add); + if (initialColumnPreferences != null) { + initialColumnPreferences.getColumns().forEach(columnsListProperty.getValue()::add); + } } private void insertSpecialFieldColumns() { @@ -215,7 +219,7 @@ public void storeSettings() { new ColumnPreferences( columnsListProperty.getValue(), newMainTablePreferences.getColumnPreferences().getColumnSortOrder()), - newMainTablePreferences.getResizeColumnsToFit(), + autoResizeColumnsProperty.getValue(), extraFileColumnsEnabledProperty.getValue() )); @@ -224,11 +228,11 @@ public void storeSettings() { specialFieldsSyncKeywordsProperty.getValue(), specialFieldsSerializeProperty.getValue()); - if (specialFieldsPreferences.getAutoSyncSpecialFieldsToKeyWords() != newSpecialFieldsPreferences.getAutoSyncSpecialFieldsToKeyWords()) { + if (initialSpecialFieldsPreferences.getAutoSyncSpecialFieldsToKeyWords() != newSpecialFieldsPreferences.getAutoSyncSpecialFieldsToKeyWords()) { restartWarnings.add(Localization.lang("Synchronize special fields to keywords")); } - if (specialFieldsPreferences.getSerializeSpecialFields() != newSpecialFieldsPreferences.getSerializeSpecialFields()) { + if (initialSpecialFieldsPreferences.getSerializeSpecialFields() != newSpecialFieldsPreferences.getSerializeSpecialFields()) { restartWarnings.add(Localization.lang("Serialize special fields")); } @@ -286,4 +290,8 @@ public BooleanProperty specialFieldsSerializeProperty() { public BooleanProperty extraFileColumnsEnabledProperty() { return this.extraFileColumnsEnabledProperty; } + + public BooleanProperty autoResizeColumnsProperty() { + return autoResizeColumnsProperty; + } } diff --git a/src/main/java/org/jabref/gui/preferences/TableTab.fxml b/src/main/java/org/jabref/gui/preferences/TableTab.fxml index e72e97935a8..1ec37b5b7d8 100644 --- a/src/main/java/org/jabref/gui/preferences/TableTab.fxml +++ b/src/main/java/org/jabref/gui/preferences/TableTab.fxml @@ -1,6 +1,5 @@ - @@ -12,10 +11,6 @@