From ee20b5a0fe72a3e0747cf71370d97ea1b22862ec Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage Date: Fri, 21 Feb 2020 16:07:21 +0100 Subject: [PATCH 1/2] Fixed display of groups and links column in MainTable --- .../gui/maintable/BibEntryTableViewModel.java | 46 ++++++++++--------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/src/main/java/org/jabref/gui/maintable/BibEntryTableViewModel.java b/src/main/java/org/jabref/gui/maintable/BibEntryTableViewModel.java index d7391790d7a..47e783c2d61 100644 --- a/src/main/java/org/jabref/gui/maintable/BibEntryTableViewModel.java +++ b/src/main/java/org/jabref/gui/maintable/BibEntryTableViewModel.java @@ -7,6 +7,7 @@ import java.util.Optional; import java.util.stream.Collectors; +import javafx.beans.binding.Bindings; import javafx.beans.binding.ObjectBinding; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.value.ObservableValue; @@ -18,6 +19,7 @@ import org.jabref.model.entry.FileFieldParser; import org.jabref.model.entry.LinkedFile; import org.jabref.model.entry.field.Field; +import org.jabref.model.entry.field.InternalField; import org.jabref.model.entry.field.SpecialField; import org.jabref.model.entry.field.StandardField; import org.jabref.model.groups.AbstractGroup; @@ -52,31 +54,33 @@ public ObservableValue> getLinkedFiles() { return EasyBind.map(getField(StandardField.FILE), FileFieldParser::parse); } - public ObservableValue> getLinkedIdentifiers() { - SimpleObjectProperty> linkedIdentifiers = new SimpleObjectProperty<>(new HashMap<>()); - - entry.getField(StandardField.URL).ifPresent(value -> linkedIdentifiers.getValue().put(StandardField.URL, value)); - entry.getField(StandardField.DOI).ifPresent(value -> linkedIdentifiers.getValue().put(StandardField.DOI, value)); - entry.getField(StandardField.URI).ifPresent(value -> linkedIdentifiers.getValue().put(StandardField.URI, value)); - entry.getField(StandardField.EPRINT).ifPresent(value -> linkedIdentifiers.getValue().put(StandardField.EPRINT, value)); - - return linkedIdentifiers; + public ObservableValue> getLinkedIdentifiers() { + return Bindings.createObjectBinding(() -> { + Map linkedIdentifiers = new HashMap<>(); + entry.getField(StandardField.URL).ifPresent(value -> linkedIdentifiers.put(StandardField.URL, value)); + entry.getField(StandardField.DOI).ifPresent(value -> linkedIdentifiers.put(StandardField.DOI, value)); + entry.getField(StandardField.URI).ifPresent(value -> linkedIdentifiers.put(StandardField.URI, value)); + entry.getField(StandardField.EPRINT).ifPresent(value -> linkedIdentifiers.put(StandardField.EPRINT, value)); + return linkedIdentifiers; + }, + getEntry().getFieldBinding(StandardField.URL), + getEntry().getFieldBinding(StandardField.DOI), + getEntry().getFieldBinding(StandardField.URI), + getEntry().getFieldBinding(StandardField.EPRINT)); } public ObservableValue> getMatchedGroups(BibDatabaseContext database) { - SimpleObjectProperty> matchedGroups = new SimpleObjectProperty<>(Collections.emptyList()); - - Optional root = database.getMetaData() - .getGroups(); + Optional root = database.getMetaData().getGroups(); if (root.isPresent()) { - List groups = root.get().getMatchingGroups(entry) - .stream() - .map(GroupTreeNode::getGroup) - .collect(Collectors.toList()); - groups.remove(root.get().getGroup()); - matchedGroups.setValue(groups); + return EasyBind.map(entry.getFieldBinding(InternalField.GROUPS), field -> { + List groups = root.get().getMatchingGroups(entry) + .stream() + .map(GroupTreeNode::getGroup) + .collect(Collectors.toList()); + groups.remove(root.get().getGroup()); + return groups; + }); } - - return matchedGroups; + return new SimpleObjectProperty<>(Collections.emptyList()); } } From 672d3209048f6c5e87176570238c5ec9ece18606 Mon Sep 17 00:00:00 2001 From: Carl Christian Snethlage Date: Fri, 21 Feb 2020 16:11:35 +0100 Subject: [PATCH 2/2] CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebb90f3c68b..0e96758c107 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# ### Changed -- We reintroduced the possibility to extract references from plain text (using GROBID) [#5614](https://github.com/JabRef/jabref/pull/5614) +- We reintroduced the possibility to extract references from plain text (using GROBID) [#5614](https://github.com/JabRef/jabref/pull/5614) - We changed the open office panel to show buttons in rows of three instead of going straight down to save space as the button expanded out to take up unnecessary horizontal space. [#5479](https://github.com/JabRef/jabref/issues/5479) - We cleaned up the group add/edit dialog. [#5826](https://github.com/JabRef/jabref/pull/5826) - We reintroduced the index column. [#5844](https://github.com/JabRef/jabref/pull/5844) @@ -43,6 +43,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - We fixed an issue where changing the type of an entry did not update the main table. [#5906](https://github.com/JabRef/jabref/issues/5906) - We fixed an issue where opening a library from the recent libraries menu was not possible. [#5939](https://github.com/JabRef/jabref/issues/5939) - We fixed an issue where changing entry type doesn't always work when biblatex source is shown. [#5905](https://github.com/JabRef/jabref/issues/5905) +- We fixed an issue where the group and the link column were not updated after changing the entry in the main table. [#5985](https://github.com/JabRef/jabref/issues/5985) ### Removed