|
11 | 11 | import javafx.beans.property.SimpleBooleanProperty; |
12 | 12 | import javafx.beans.property.SimpleIntegerProperty; |
13 | 13 | import javafx.collections.FXCollections; |
| 14 | +import javafx.collections.ListChangeListener; |
14 | 15 | import javafx.collections.ObservableList; |
15 | 16 | import javafx.scene.input.Dragboard; |
16 | 17 | import javafx.scene.paint.Color; |
|
29 | 30 | import org.jabref.model.FieldChange; |
30 | 31 | import org.jabref.model.database.BibDatabaseContext; |
31 | 32 | import org.jabref.model.entry.BibEntry; |
32 | | -import org.jabref.model.entry.event.EntryEvent; |
33 | 33 | import org.jabref.model.groups.AbstractGroup; |
34 | 34 | import org.jabref.model.groups.AutomaticGroup; |
35 | 35 | import org.jabref.model.groups.GroupEntryChanger; |
36 | 36 | import org.jabref.model.groups.GroupTreeNode; |
37 | 37 | import org.jabref.model.strings.StringUtil; |
38 | 38 |
|
39 | 39 | import com.google.common.base.Enums; |
40 | | -import com.google.common.eventbus.Subscribe; |
41 | 40 | import de.jensd.fx.glyphs.materialdesignicons.MaterialDesignIcon; |
42 | 41 | import org.fxmisc.easybind.EasyBind; |
43 | 42 |
|
@@ -85,7 +84,7 @@ public GroupNodeViewModel(BibDatabaseContext databaseContext, StateManager state |
85 | 84 | expandedProperty.addListener((observable, oldValue, newValue) -> groupNode.getGroup().setExpanded(newValue)); |
86 | 85 |
|
87 | 86 | // Register listener |
88 | | - databaseContext.getDatabase().registerListener(this); |
| 87 | + databaseContext.getDatabase().getEntries().addListener(this::onDatabaseChanged); |
89 | 88 |
|
90 | 89 | ObservableList<Boolean> selectedEntriesMatchStatus = EasyBind.map(stateManager.getSelectedEntries(), groupNode::matches); |
91 | 90 | anySelectedEntriesMatched = BindingsHelper.any(selectedEntriesMatchStatus, matched -> matched); |
@@ -212,10 +211,9 @@ public GroupTreeNode getGroupNode() { |
212 | 211 | } |
213 | 212 |
|
214 | 213 | /** |
215 | | - * Gets invoked if an entry in the current database changes. |
216 | | - */ |
217 | | - @Subscribe |
218 | | - public void listen(@SuppressWarnings("unused") EntryEvent entryEvent) { |
| 214 | + * Gets invoked if an entry in the current database changes. |
| 215 | + */ |
| 216 | + private void onDatabaseChanged(ListChangeListener.Change<? extends BibEntry> change) { |
219 | 217 | calculateNumberOfMatches(); |
220 | 218 | } |
221 | 219 |
|
|
0 commit comments