From 72c022e02d98bdba12ea9077a5753ca140178084 Mon Sep 17 00:00:00 2001 From: Gena928 Date: Sun, 5 Apr 2020 18:35:01 +0300 Subject: [PATCH 1/6] 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 2/6] 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 3/6] 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 4/6] 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 5/6] 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 40541adf1ad48ef29ac990126cbe3fa099efef9b Mon Sep 17 00:00:00 2001 From: Gena928 Date: Fri, 22 May 2020 15:59:43 +0300 Subject: [PATCH 6/6] 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 -> {