Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fixlayoutauthors
Browse files Browse the repository at this point in the history
* upstream/master:
  Bump archunit-junit5-api from 0.15.0 to 0.16.0 (#7407)
  Bump classgraph from 4.8.98 to 4.8.102 (#7401)
  Bump archunit-junit5-engine from 0.15.0 to 0.16.0 (#7402)
  Bump mariadb-java-client from 2.7.1 to 2.7.2 (#7406)
  Bump org.beryx.jlink from 2.23.2 to 2.23.3 (#7400)
  Bump checkstyle from 8.39 to 8.40 (#7404)
  Ignore codecov status for automerge
  Fixes issue of Changing font size makes font size field too small (#7398)
  fix "Alt + keyboard shortcuts do not work" (#7379)
  Fixed invisible file path in the dark theme (#7396)
  Fix File Filter and some layout issues (#7385)
  Feature/implement complex queries (#7350)
  Change format for study definition to yaml (#7126)
  Fix handling of URL in file field (#7347)
  Fix expansion of bracketed expressions in RegExpBasedFileFinder (#7338)
  • Loading branch information
Siedlerchr committed Feb 1, 2021
2 parents 720e469 + 8c3424c commit a44f589
Show file tree
Hide file tree
Showing 98 changed files with 2,614 additions and 1,081 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
id: waitforstatuschecks
uses: "WyriHaximus/github-action-wait-for-status@v1.3"
with:
ignoreActions: Automerge Dependabot
ignoreActions: Automerge Dependabot,codecov/project
checkInterval: 13
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,16 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue where the "Find unlinked files" dialog would freeze JabRef on importing. [#7205](https://github.com/JabRef/jabref/issues/7205)
- We fixed an issue where the "Find unlinked files" would stop importing when importing a single file failed. [#7206](https://github.com/JabRef/jabref/issues/7206)
- We fixed an issue where an exception would be displayed for previewing and preferences when a custom theme has been configured but is missing [#7177](https://github.com/JabRef/jabref/issues/7177)
- We fixed an issue where URLs in `file` fields could not be handled on Windows. [#7359](https://github.com/JabRef/jabref/issues/7359)
- We fixed an issue where the regex based file search miss-interpreted specific symbols. [#4342](https://github.com/JabRef/jabref/issues/4342)
- We fixed an issue where the Harvard RTF exporter used the wrong default file extension. [4508](https://github.com/JabRef/jabref/issues/4508)
- We fixed an issue where the Harvard RTF exporter did not use the new authors formatter and therefore did not export "organization" authors correctly. [4508](https://github.com/JabRef/jabref/issues/4508)
- We fixed an issue where the field `urldate` was not exported to the corresponding fields `YearAccessed`, `MonthAccessed`, `DayAccessed` in MS Office XML [#7354](https://github.com/JabRef/jabref/issues/7354)
- We fixed an issue where the password for a shared SQL database was only remembered if it was the same as the username [#6869](https://github.com/JabRef/jabref/issues/6869)
- We fixed an issue where some custom exports did not use the new authors formatter and therefore did not export authors correctly [#7356]((https://github.com/JabRef/jabref/issues/7356))
- We fixed an issue where alt+keyboard shortcuts do not work [#6994](https://github.com/JabRef/jabref/issues/6994)
- We fixed an issue where the file path is invisible in dark theme. [#7382](https://github.com/JabRef/jabref/issues/7382)
- We fixed an issue where changing the font size makes the font size field too small. [#7085](https://github.com/JabRef/jabref/issues/7085)

### Removed

Expand Down
16 changes: 10 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins {
id 'com.github.ben-manes.versions' version '0.36.0'
id 'org.javamodularity.moduleplugin' version '1.7.0'
id 'org.openjfx.javafxplugin' version '0.0.9'
id 'org.beryx.jlink' version '2.23.2'
id 'org.beryx.jlink' version '2.23.3'
// nicer test outputs during running and completion
// Homepage: https://github.com/radarsh/gradle-test-logger-plugin
id 'com.adarshr.test-logger' version '2.1.1'
Expand Down Expand Up @@ -42,6 +42,7 @@ java {

application {
mainClassName = "org.jabref.gui.JabRefLauncher"
mainModule = 'org.jabref'
}

// TODO: Ugly workaround to temporarily ignore build errors to dependencies of latex2unicode
Expand Down Expand Up @@ -132,7 +133,10 @@ dependencies {

implementation group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '5.10.0.202012080955-r'

implementation group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.7.1'
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-yaml', version: '2.12.0-rc2'
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.12.0-rc2'

implementation group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '2.7.2'

implementation 'org.postgresql:postgresql:42.2.18'

Expand Down Expand Up @@ -190,7 +194,7 @@ dependencies {
implementation 'com.vladsch.flexmark:flexmark-ext-gfm-strikethrough:0.62.2'
implementation 'com.vladsch.flexmark:flexmark-ext-gfm-tasklist:0.62.2'

testImplementation 'io.github.classgraph:classgraph:4.8.98'
testImplementation 'io.github.classgraph:classgraph:4.8.102'
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.0'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.7.0'
testImplementation 'org.junit.platform:junit-platform-launcher:1.7.0'
Expand All @@ -201,13 +205,13 @@ dependencies {
testImplementation 'org.mockito:mockito-core:3.7.7'
testImplementation 'org.xmlunit:xmlunit-core:2.8.2'
testImplementation 'org.xmlunit:xmlunit-matchers:2.8.2'
testRuntime 'com.tngtech.archunit:archunit-junit5-engine:0.15.0'
testImplementation 'com.tngtech.archunit:archunit-junit5-api:0.15.0'
testRuntime 'com.tngtech.archunit:archunit-junit5-engine:0.16.0'
testImplementation 'com.tngtech.archunit:archunit-junit5-api:0.16.0'
testImplementation "org.testfx:testfx-core:4.0.17-alpha-SNAPSHOT"
testImplementation "org.testfx:testfx-junit5:4.0.17-alpha-SNAPSHOT"
testImplementation "org.hamcrest:hamcrest-library:2.2"

checkstyle 'com.puppycrawl.tools:checkstyle:8.39'
checkstyle 'com.puppycrawl.tools:checkstyle:8.40'
xjc group: 'org.glassfish.jaxb', name: 'jaxb-xjc', version: '2.3.3'
}

Expand Down
56 changes: 56 additions & 0 deletions docs/adr/0018-use-Jackson-to-parse-study-yml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Use Jackson to parse study.yml

## Context and Problem Statement

The study definition file is formulated as a YAML document.
To accessed the definition within JabRef this document has to be parsed.
What parser should be used to parse YAML files?

## Considered Options

* [Jackson](https://github.com/FasterXML/jackson-dataformat-yaml)
* [SnakeYAML Engine](https://bitbucket.org/asomov/snakeyaml)
* [yamlbeans](https://github.com/EsotericSoftware/yamlbeans)
* [eo-yaml](https://github.com/decorators-squad/eo-yaml)
* Self-written parser

## Decision Outcome

Chosen option: Jackson, because as it is a dedicated library for parsing YAML. yamlbeans also seem to be viable. They all offer similar functionality

## Pros and Cons of the Options

### Jackson

* Good, because established YAML parser library
* Good, because supports YAML 1.2
* Good, because it can parse LocalDate

### SnakeYAML Engine

* Good, because established YAML parser library
* Good, because supports YAML 1.2
* Bad, because cannot parse YAML into Java DTOs, only into [basic Java structures](https://bitbucket.org/asomov/snakeyaml-engine/src/master/), this then has to be assembled into DTOs

### yamlbeans

* Good, because established YAML parser library
* Good, because [nice getting started page](https://github.com/EsotericSoftware/yamlbeans)
* Bad, because objects need to be annotated in the yaml file to be parsed into Java objects

### eo-yaml

* Good, because established YAML parser library
* Good, because supports YAML 1.2
* Bad, because cannot parse YAML into Java DTOs

### Own parser

* Good, because easily customizable
* Bad, because high effort
* Bad, because has to be tested extensively

## Links

* [Winery's ADR-0009](https://github.com/eclipse/winery/blob/master/docs/adr/0009-manual-tosca-yaml-serialisation.md)
* [Winery's ADR-0010](https://github.com/eclipse/winery/blob/master/docs/adr/0010-tosca-yaml-deserialisation-using-snakeyaml.md)
30 changes: 30 additions & 0 deletions docs/adr/0019-keep-study-as-a-dto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Keep study as a DTO

## Context and Problem Statement

The study holds query and library entries that could be replaced respectively with complex query and fetcher instances.
This poses the question: should the study remain a pure DTO object or should it contain direct object instances?

## Considered Options

* Keep study as DTO and use transformers
* Replace entries with instances

## Decision Outcome

Chosen option: "Keep study as DTO and use transformators", because comes out best (see below).

## Pros and Cons of the Options

### Keep study as DTO and use transformators

* Good, because no need for custom serialization
* Good, because deactivated fetchers can be documented (important for traceable Searching (SLRs))
* Bad, because Entries for databases and queries needed

### Replace entries with instances

* Good, because no need for database and query entries
* Bad, because custom de-/serializers for fetchers and complex queries needed
* Bad, because harder to maintain than using "vanilla" jackson de-/serialization
*<!-- numbers of pros and cons can vary -->
3 changes: 3 additions & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,7 @@
requires lucene.queryparser;
requires lucene.core;
requires org.eclipse.jgit;
requires com.fasterxml.jackson.databind;
requires com.fasterxml.jackson.dataformat.yaml;
requires com.fasterxml.jackson.datatype.jsr310;
}
10 changes: 9 additions & 1 deletion src/main/java/org/jabref/gui/Base.css
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,10 @@
-fx-background-color: -jr-warn;
}

.file-row-text{
-fx-fill: -jr-search-text;
}

.combo-box-base {
-fx-background-color: -fx-outer-border, -fx-control-inner-background;
-fx-background-insets: 0, 1;
Expand Down Expand Up @@ -1217,6 +1221,10 @@ TextFlow * {

}

.mainTable-header{
.mainTable-header {
-fx-fill: -fx-mid-text-color;
}

.fontsizeSpinner{
-fx-pref-width: 5em;
}
28 changes: 12 additions & 16 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -829,26 +829,22 @@ private MenuBar createMenu() {
SidePaneComponent groups = sidePaneManager.getComponent(SidePaneType.GROUPS);
SidePaneComponent openOffice = sidePaneManager.getComponent(SidePaneType.OPEN_OFFICE);

view.getItems().add(new SeparatorMenuItem());
view.setOnShowing(event -> {
view.getItems().clear();
view.getItems().addAll(
factory.createCheckMenuItem(webSearch.getToggleAction(), webSearch.getToggleCommand(), sidePaneManager.isComponentVisible(SidePaneType.WEB_SEARCH)),
factory.createCheckMenuItem(groups.getToggleAction(), groups.getToggleCommand(), sidePaneManager.isComponentVisible(SidePaneType.GROUPS)),
factory.createCheckMenuItem(openOffice.getToggleAction(), openOffice.getToggleCommand(), sidePaneManager.isComponentVisible(SidePaneType.OPEN_OFFICE)),
view.getItems().addAll(
factory.createCheckMenuItem(webSearch.getToggleAction(), webSearch.getToggleCommand(), sidePaneManager.isComponentVisible(SidePaneType.WEB_SEARCH)),
factory.createCheckMenuItem(groups.getToggleAction(), groups.getToggleCommand(), sidePaneManager.isComponentVisible(SidePaneType.GROUPS)),
factory.createCheckMenuItem(openOffice.getToggleAction(), openOffice.getToggleCommand(), sidePaneManager.isComponentVisible(SidePaneType.OPEN_OFFICE)),

new SeparatorMenuItem(),
new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.NEXT_PREVIEW_STYLE, new PreviewSwitchAction(PreviewSwitchAction.Direction.NEXT, this, stateManager)),
factory.createMenuItem(StandardActions.PREVIOUS_PREVIEW_STYLE, new PreviewSwitchAction(PreviewSwitchAction.Direction.PREVIOUS, this, stateManager)),
factory.createMenuItem(StandardActions.NEXT_PREVIEW_STYLE, new PreviewSwitchAction(PreviewSwitchAction.Direction.NEXT, this, stateManager)),
factory.createMenuItem(StandardActions.PREVIOUS_PREVIEW_STYLE, new PreviewSwitchAction(PreviewSwitchAction.Direction.PREVIOUS, this, stateManager)),

new SeparatorMenuItem(),
new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.SHOW_PDF_VIEWER, new ShowDocumentViewerAction(stateManager, prefs)),
factory.createMenuItem(StandardActions.EDIT_ENTRY, new OpenEntryEditorAction(this, stateManager)),
factory.createMenuItem(StandardActions.OPEN_CONSOLE, new OpenConsoleAction(stateManager))
);
});
factory.createMenuItem(StandardActions.SHOW_PDF_VIEWER, new ShowDocumentViewerAction(stateManager, prefs)),
factory.createMenuItem(StandardActions.EDIT_ENTRY, new OpenEntryEditorAction(this, stateManager)),
factory.createMenuItem(StandardActions.OPEN_CONSOLE, new OpenConsoleAction(stateManager))
);

options.getItems().addAll(
factory.createMenuItem(StandardActions.SHOW_PREFS, new ShowPreferencesAction(this, Globals.TASK_EXECUTOR)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class FileExtensionViewModel {
private final ExternalFileTypes externalFileTypes;

FileExtensionViewModel(FileType fileType, ExternalFileTypes externalFileTypes) {
this.description = Localization.lang("%0 file", fileType.toString());
this.description = Localization.lang("%0 file", fileType.getName());
this.extensions = fileType.getExtensionsWithDot();
this.externalFileTypes = externalFileTypes;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private FileNodeViewModel searchDirectory(Path directory, UnlinkedPDFFileFilter
Map<Boolean, List<Path>> fileListPartition;

try (Stream<Path> filesStream = StreamSupport.stream(Files.newDirectoryStream(directory, fileFilter).spliterator(), false)) {
fileListPartition = filesStream.collect(Collectors.partitioningBy(path -> path.toFile().isDirectory()));
fileListPartition = filesStream.collect(Collectors.partitioningBy(Files::isDirectory));
} catch (IOException e) {
LOGGER.error(String.format("%s while searching files: %s", e.getClass().getName(), e.getMessage()));
return parent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
<ColumnConstraints hgrow="SOMETIMES"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="20.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="20.0" vgrow="SOMETIMES"/>
</rowConstraints>
<Label text="%Start directory:" GridPane.columnIndex="0" GridPane.rowIndex="0"/>
<TextField fx:id="directoryPathField" GridPane.columnIndex="1" GridPane.rowIndex="0"/>
<Button onAction="#browseFileDirectory" styleClass="icon-button,narrow"
GridPane.columnIndex="2" GridPane.rowIndex="0"
prefHeight="20.0" prefWidth="20.0">
minWidth="20.0" minHeight="20.0" prefHeight="20.0" prefWidth="20.0">
<graphic>
<JabRefIconView glyph="OPEN"/>
</graphic>
Expand All @@ -50,9 +50,9 @@
</tooltip>
</Button>

<Label text="%File extension:" GridPane.columnIndex="0" GridPane.rowIndex="1"/>
<Label text="%File type:" GridPane.columnIndex="0" GridPane.rowIndex="1"/>
<ComboBox fx:id="fileTypeCombo" maxWidth="Infinity" GridPane.columnIndex="1" GridPane.rowIndex="1"/>
<Button fx:id="scanButton" onAction="#scanFiles" text="%Scan directory"
<Button fx:id="scanButton" onAction="#scanFiles" text="%Search"
GridPane.columnIndex="2" GridPane.rowIndex="1">
<tooltip>
<Tooltip text="%Searches the selected directory for unlinked files."/>
Expand All @@ -71,11 +71,11 @@
<TableView fx:id="importResultTable">
<columns>
<TableColumn fx:id="colStatus" prefWidth="100.0" text="%Status"/>
<TableColumn fx:id="colMessage" prefWidth="300.0" text="%Message"/>
<TableColumn fx:id="colFile" prefWidth="500.0" text="%File"/>
<TableColumn fx:id="colMessage" prefWidth="300.0" text="%Message"/>
</columns>
<columnResizePolicy>
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY"/>
<TableView fx:constant="UNCONSTRAINED_RESIZE_POLICY"/>
</columnResizePolicy>
</TableView>
</TitledPane>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.io.IOException;
import java.nio.file.DirectoryStream;
import java.nio.file.DirectoryStream.Filter;
import java.nio.file.Files;
import java.nio.file.Path;

import org.jabref.logic.util.io.DatabaseFileLookup;
Expand Down Expand Up @@ -31,6 +32,11 @@ public UnlinkedPDFFileFilter(DirectoryStream.Filter<Path> fileFilter, BibDatabas

@Override
public boolean accept(Path pathname) throws IOException {
return fileFilter.accept(pathname) && !lookup.lookupDatabase(pathname.toFile());

if (Files.isDirectory(pathname)) {
return true;
} else {
return fileFilter.accept(pathname) && !lookup.lookupDatabase(pathname);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ private static Node createFileDisplay(LinkedFileViewModel linkedFile) {
icon.setOnMouseClicked(event -> linkedFile.open());
Text link = new Text();
link.textProperty().bind(linkedFile.linkProperty());
link.getStyleClass().setAll("file-row-text");
Text desc = new Text();
desc.textProperty().bind(linkedFile.descriptionProperty());
desc.getStyleClass().setAll("file-row-text");

ProgressBar progressIndicator = new ProgressBar();
progressIndicator.progressProperty().bind(linkedFile.downloadProgressProperty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<CheckBox fx:id="fontOverride" text="%Override default font settings"/>
<HBox alignment="CENTER_LEFT" spacing="4.0">
<Label text="%Size" disable="${!fontOverride.selected}"/>
<Spinner fx:id="fontSize" prefWidth="60.0" editable="true"/>
<Spinner fx:id="fontSize" styleClass="fontsizeSpinner" editable="true"/>
<padding>
<Insets left="20.0"/>
</padding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public static String expandBrackets(String pattern, Character keywordDelimiter,
* @param database The {@link BibDatabase} for field resolving. May be null.
* @return a function accepting a bracketed expression and returning the result of expanding it
*/
private static Function<String, String> expandBracketContent(Character keywordDelimiter, BibEntry entry, BibDatabase database) {
public static Function<String, String> expandBracketContent(Character keywordDelimiter, BibEntry entry, BibDatabase database) {
return (String bracket) -> {
String expandedPattern;
List<String> fieldParts = parseFieldAndModifiers(bracket);
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/org/jabref/logic/crawler/Crawler.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.jabref.logic.preferences.TimestampPreferences;
import org.jabref.model.entry.BibEntryTypesManager;
import org.jabref.model.study.QueryResult;
import org.jabref.model.study.Study;
import org.jabref.model.util.FileUpdateMonitor;

import org.eclipse.jgit.api.errors.GitAPIException;
Expand All @@ -36,9 +35,8 @@ public class Crawler {
public Crawler(Path studyDefinitionFile, GitHandler gitHandler, FileUpdateMonitor fileUpdateMonitor, ImportFormatPreferences importFormatPreferences, SavePreferences savePreferences, TimestampPreferences timestampPreferences, BibEntryTypesManager bibEntryTypesManager) throws IllegalArgumentException, IOException, ParseException, GitAPIException {
Path studyRepositoryRoot = studyDefinitionFile.getParent();
studyRepository = new StudyRepository(studyRepositoryRoot, gitHandler, importFormatPreferences, fileUpdateMonitor, savePreferences, timestampPreferences, bibEntryTypesManager);
Study study = studyRepository.getStudy();
LibraryEntryToFetcherConverter libraryEntryToFetcherConverter = new LibraryEntryToFetcherConverter(study.getActiveLibraryEntries(), importFormatPreferences);
this.studyFetcher = new StudyFetcher(libraryEntryToFetcherConverter.getActiveFetchers(), study.getSearchQueryStrings());
StudyDatabaseToFetcherConverter studyDatabaseToFetcherConverter = new StudyDatabaseToFetcherConverter(studyRepository.getActiveLibraryEntries(), importFormatPreferences);
this.studyFetcher = new StudyFetcher(studyDatabaseToFetcherConverter.getActiveFetchers(), studyRepository.getSearchQueryStrings());
}

/**
Expand Down
Loading

0 comments on commit a44f589

Please sign in to comment.