Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
* upstream/master:
  Bump unirest-java from 3.4.01 to 3.4.03 (#5932)
  Bump postgresql from 42.2.9 to 42.2.10 (#5930)
  Bump archunit-junit5-api from 0.13.0 to 0.13.1 (#5928)
  Bump classgraph from 4.8.60 to 4.8.62 (#5927)
  Bump commons-csv from 1.7 to 1.8 (#5929)
  Bump jsoup from 1.12.1 to 1.12.2 (#5931)
  Disable search when no library is opened (#5923)
  Fix maintable not updated when changing entry type (#5925)
  • Loading branch information
Siedlerchr committed Feb 11, 2020
2 parents 38d11e6 + 259bca0 commit 8bf0c77
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 37 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where cleaning up entries broke web URLs, if "Make paths of linked files relative (if possible)" was enabled, which resulted in various other issues subsequently. [#5861](https://github.com/JabRef/jabref/issues/5861)
- We fixed an issue where the tab "Required fields" of the entry editor did not show all required fields, if at least two of the defined required fields are linked with a logical or. [#5859](https://github.com/JabRef/jabref/issues/5859)
- We fixed several issues concerning managing external file types: Now everything is usable and fully functional. Previously, there were problems with the radio buttons, with saving the settings and with loading an input field value. Furthermore, different behavior for Windows and other operating systems was given, which was unified as well. [#5846](https://github.com/JabRef/jabref/issues/5846)
- 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)


### Removed
- Ampersands are no longer escaped by default in the `bib` file. If you want to keep the current behaviour, you can use the new "Escape Ampersands" formatter as a save action.
Expand Down
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ dependencies {
compile 'org.apache.pdfbox:fontbox:2.0.18'
compile 'org.apache.pdfbox:xmpbox:2.0.18'

compile group: 'org.apache.commons', name: 'commons-csv', version: '1.7'
compile group: 'org.apache.commons', name: 'commons-csv', version: '1.8'

compile group: 'org.apache.tika', name: 'tika-core', version: '1.23'

Expand Down Expand Up @@ -142,7 +142,7 @@ dependencies {

compile group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.5.4'

compile 'org.postgresql:postgresql:42.2.9'
compile 'org.postgresql:postgresql:42.2.10'

compile ('com.oracle.ojdbc:ojdbc10:19.3.0.0') {
// causing module issues
Expand All @@ -168,8 +168,8 @@ dependencies {
compile 'com.jfoenix:jfoenix:9.0.9'
compile 'org.controlsfx:controlsfx:11.0.1'

compile 'org.jsoup:jsoup:1.12.1'
compile 'com.konghq:unirest-java:3.4.01'
compile 'org.jsoup:jsoup:1.12.2'
compile 'com.konghq:unirest-java:3.4.03'

compile 'org.slf4j:slf4j-api:2.0.0-alpha1'
compile group: 'org.apache.logging.log4j', name: 'log4j-jcl', version: '3.0.0-SNAPSHOT'
Expand Down Expand Up @@ -206,7 +206,7 @@ dependencies {
}


testCompile 'io.github.classgraph:classgraph:4.8.60'
testCompile 'io.github.classgraph:classgraph:4.8.62'
testImplementation 'org.junit.jupiter:junit-jupiter:5.6.0'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.6.0'
testCompile 'org.junit.platform:junit-platform-launcher:1.6.0'
Expand All @@ -218,7 +218,7 @@ dependencies {
//testCompile 'com.github.tomakehurst:wiremock:2.24.1'
testCompile 'org.xmlunit:xmlunit-core:2.6.3'
testCompile 'org.xmlunit:xmlunit-matchers:2.6.3'
testCompile 'com.tngtech.archunit:archunit-junit5-api:0.13.0'
testCompile 'com.tngtech.archunit:archunit-junit5-api:0.13.1'
//testRuntime 'com.tngtech.archunit:archunit-junit5-engine:0.13.0'
testCompile "org.testfx:testfx-core:4.0.17-alpha-SNAPSHOT"
testCompile "org.testfx:testfx-junit5:4.0.17-alpha-SNAPSHOT"
Expand Down
1 change: 1 addition & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
requires org.apache.xmpbox;
requires de.saxsys.mvvmfx.validation;
requires richtextfx;
requires com.google.gson;
requires unirest.java;
requires org.apache.httpcomponents.httpclient;
requires org.jsoup;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/StateManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.ReadOnlyListProperty;
import javafx.beans.property.ReadOnlyListWrapper;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.collections.ObservableMap;
Expand Down Expand Up @@ -53,7 +54,7 @@ public void setActiveSearchResultSize(BibDatabaseContext database, IntegerProper
}

public IntegerProperty getSearchResultSize() {
return searchResultMap.get(activeDatabase.getValue().orElse(new BibDatabaseContext()));
return searchResultMap.getOrDefault(activeDatabase.getValue().orElse(new BibDatabaseContext()), new SimpleIntegerProperty(0));
}

public ReadOnlyListProperty<GroupTreeNode> activeGroupProperty() {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/jabref/gui/search/GlobalSearchBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.jabref.gui.actions.ActionHelper.needsDatabase;

public class GlobalSearchBar extends HBox {

private static final Logger LOGGER = LoggerFactory.getLogger(GlobalSearchBar.class);
Expand Down Expand Up @@ -99,6 +101,8 @@ public GlobalSearchBar(JabRefFrame frame, StateManager stateManager) {

SearchPreferences searchPreferences = new SearchPreferences(Globals.prefs);
searchDisplayMode = searchPreferences.getSearchMode();

this.searchField.disableProperty().bind(needsDatabase(stateManager).not());

// fits the standard "found x entries"-message thus hinders the searchbar to jump around while searching if the frame width is too small
currentResults.setPrefWidth(150);
Expand Down
63 changes: 33 additions & 30 deletions src/main/java/org/jabref/model/entry/BibEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@

import com.google.common.base.Strings;
import com.google.common.eventbus.EventBus;
import org.fxmisc.easybind.EasyBind;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -68,7 +69,7 @@ public class BibEntry implements Cloneable {
/**
* Cache that stores the field as keyword lists (format <Field, Separator, Keyword list>)
*/
private MultiKeyMap<Field, Character, KeywordList> fieldsAsKeywords = new MultiKeyMap<>();
private final MultiKeyMap<Field, Character, KeywordList> fieldsAsKeywords = new MultiKeyMap<>();

private final EventBus eventBus = new EventBus();
private String id;
Expand Down Expand Up @@ -148,27 +149,27 @@ private Optional<Field> getSourceField(Field targetField, EntryType targetEntry,
}

//// 2. Handle special field mappings
if ((sourceEntry == StandardEntryType.MvBook && targetEntry == StandardEntryType.InBook) ||
(sourceEntry == StandardEntryType.MvBook && targetEntry == StandardEntryType.BookInBook) ||
(sourceEntry == StandardEntryType.MvBook && targetEntry == StandardEntryType.SuppBook) ||
(sourceEntry == StandardEntryType.Book && targetEntry == StandardEntryType.InBook) ||
(sourceEntry == StandardEntryType.Book && targetEntry == StandardEntryType.BookInBook) ||
(sourceEntry == StandardEntryType.Book && targetEntry == StandardEntryType.SuppBook)) {
if (((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.InBook)) ||
((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.BookInBook)) ||
((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.SuppBook)) ||
((sourceEntry == StandardEntryType.Book) && (targetEntry == StandardEntryType.InBook)) ||
((sourceEntry == StandardEntryType.Book) && (targetEntry == StandardEntryType.BookInBook)) ||
((sourceEntry == StandardEntryType.Book) && (targetEntry == StandardEntryType.SuppBook))) {
if (targetField == StandardField.AUTHOR) { return Optional.of(StandardField.AUTHOR); }
if (targetField == StandardField.BOOKAUTHOR) { return Optional.of(StandardField.AUTHOR); }
}

if ((sourceEntry == StandardEntryType.MvBook && targetEntry == StandardEntryType.Book) ||
(sourceEntry == StandardEntryType.MvBook && targetEntry == StandardEntryType.InBook) ||
(sourceEntry == StandardEntryType.MvBook && targetEntry == StandardEntryType.BookInBook) ||
(sourceEntry == StandardEntryType.MvBook && targetEntry == StandardEntryType.SuppBook) ||
(sourceEntry == StandardEntryType.MvCollection && targetEntry == StandardEntryType.Collection) ||
(sourceEntry == StandardEntryType.MvCollection && targetEntry == StandardEntryType.InCollection) ||
(sourceEntry == StandardEntryType.MvCollection && targetEntry == StandardEntryType.SuppCollection) ||
(sourceEntry == StandardEntryType.MvProceedings && targetEntry == StandardEntryType.Proceedings) ||
(sourceEntry == StandardEntryType.MvProceedings && targetEntry == StandardEntryType.InProceedings) ||
(sourceEntry == StandardEntryType.MvReference && targetEntry == StandardEntryType.Reference) ||
(sourceEntry == StandardEntryType.MvReference && targetEntry == StandardEntryType.InReference)) {
if (((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.Book)) ||
((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.InBook)) ||
((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.BookInBook)) ||
((sourceEntry == StandardEntryType.MvBook) && (targetEntry == StandardEntryType.SuppBook)) ||
((sourceEntry == StandardEntryType.MvCollection) && (targetEntry == StandardEntryType.Collection)) ||
((sourceEntry == StandardEntryType.MvCollection) && (targetEntry == StandardEntryType.InCollection)) ||
((sourceEntry == StandardEntryType.MvCollection) && (targetEntry == StandardEntryType.SuppCollection)) ||
((sourceEntry == StandardEntryType.MvProceedings) && (targetEntry == StandardEntryType.Proceedings)) ||
((sourceEntry == StandardEntryType.MvProceedings) && (targetEntry == StandardEntryType.InProceedings)) ||
((sourceEntry == StandardEntryType.MvReference) && (targetEntry == StandardEntryType.Reference)) ||
((sourceEntry == StandardEntryType.MvReference) && (targetEntry == StandardEntryType.InReference))) {
if (targetField == StandardField.MAINTITLE) { return Optional.of(StandardField.TITLE); }
if (targetField == StandardField.MAINSUBTITLE) { return Optional.of(StandardField.SUBTITLE); }
if (targetField == StandardField.MAINTITLEADDON) { return Optional.of(StandardField.TITLEADDON); }
Expand All @@ -186,13 +187,13 @@ private Optional<Field> getSourceField(Field targetField, EntryType targetEntry,
}
}

if ((sourceEntry == StandardEntryType.Book && targetEntry == StandardEntryType.InBook) ||
(sourceEntry == StandardEntryType.Book && targetEntry == StandardEntryType.BookInBook) ||
(sourceEntry == StandardEntryType.Book && targetEntry == StandardEntryType.SuppBook) ||
(sourceEntry == StandardEntryType.Collection && targetEntry == StandardEntryType.InCollection) ||
(sourceEntry == StandardEntryType.Collection && targetEntry == StandardEntryType.SuppCollection) ||
(sourceEntry == StandardEntryType.Reference && targetEntry == StandardEntryType.InReference) ||
(sourceEntry == StandardEntryType.Proceedings && targetEntry == StandardEntryType.InProceedings)) {
if (((sourceEntry == StandardEntryType.Book) && (targetEntry == StandardEntryType.InBook)) ||
((sourceEntry == StandardEntryType.Book) && (targetEntry == StandardEntryType.BookInBook)) ||
((sourceEntry == StandardEntryType.Book) && (targetEntry == StandardEntryType.SuppBook)) ||
((sourceEntry == StandardEntryType.Collection) && (targetEntry == StandardEntryType.InCollection)) ||
((sourceEntry == StandardEntryType.Collection) && (targetEntry == StandardEntryType.SuppCollection)) ||
((sourceEntry == StandardEntryType.Reference) && (targetEntry == StandardEntryType.InReference)) ||
((sourceEntry == StandardEntryType.Proceedings) && (targetEntry == StandardEntryType.InProceedings))) {
if (targetField == StandardField.BOOKTITLE) { return Optional.of(StandardField.TITLE); }
if (targetField == StandardField.BOOKSUBTITLE) { return Optional.of(StandardField.SUBTITLE); }
if (targetField == StandardField.BOOKTITLEADDON) { return Optional.of(StandardField.TITLEADDON); }
Expand All @@ -210,8 +211,8 @@ private Optional<Field> getSourceField(Field targetField, EntryType targetEntry,
}
}

if ((sourceEntry == IEEETranEntryType.Periodical && targetEntry == StandardEntryType.Article) ||
(sourceEntry == IEEETranEntryType.Periodical && targetEntry == StandardEntryType.SuppPeriodical)) {
if (((sourceEntry == IEEETranEntryType.Periodical) && (targetEntry == StandardEntryType.Article)) ||
((sourceEntry == IEEETranEntryType.Periodical) && (targetEntry == StandardEntryType.SuppPeriodical))) {
if (targetField == StandardField.JOURNALTITLE) { return Optional.of(StandardField.TITLE); }
if (targetField == StandardField.JOURNALSUBTITLE) { return Optional.of(StandardField.SUBTITLE); }

Expand Down Expand Up @@ -915,8 +916,10 @@ public Optional<Month> getMonth() {
}

public ObjectBinding<String> getFieldBinding(Field field) {
//noinspection unchecked
return Bindings.valueAt(fields, field);
if ((field == InternalField.TYPE_HEADER) || (field == InternalField.OBSOLETE_TYPE_HEADER)) {
return (ObjectBinding<String>) EasyBind.map(type, EntryType::getDisplayName);
}
return Bindings.valueAt(fields, field);
}

public ObjectBinding<String> getCiteKeyBinding() {
Expand All @@ -937,7 +940,7 @@ public ObservableMap<Field, String> getFieldsObservable() {
* Returns a list of observables that represent the data of the entry.
*/
public Observable[] getObservables() {
return new Observable[] {fields};
return new Observable[] {fields, type};
}

private interface GetFieldInterface {
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/jabref/model/entry/field/InternalField.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public enum InternalField implements Field {
TIMESTAMP("timestamp", FieldProperty.DATE),
GROUPS("groups"),
KEY_FIELD("bibtexkey"),
/**
* field which indicates the entrytype
*/
TYPE_HEADER("entrytype"),
OBSOLETE_TYPE_HEADER("bibtextype"),
MARKED_INTERNAL("__markedentry"), // used in old versions of JabRef. Currently used for conversion only
Expand Down

0 comments on commit 8bf0c77

Please sign in to comment.