Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into change-upload-bac…
Browse files Browse the repository at this point in the history
…k-to-script

* upstream/master:
  Bump mockito-core from 3.2.0 to 3.2.4 (#5760)
  Bump classgraph from 4.8.58 to 4.8.59 (#5761)
  Improve dependency update rules
  Update jpackage to build 27 (#5758)
  Persistent column sortorder (#5730)
  Fix medline fetcher/importer when using installer (#5752)
  New Crowdin translations (#5751)
  Bump byte-buddy-parent from 1.10.4 to 1.10.5 (#5750)
  Fix checkstyle
  Fix filename
  • Loading branch information
Siedlerchr committed Dec 17, 2019
2 parents 3b258cd + 300d13f commit 9061f37
Show file tree
Hide file tree
Showing 20 changed files with 231 additions and 188 deletions.
File renamed without changes.
6 changes: 3 additions & 3 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ jobs:
include:
- os: ubuntu-latest
displayName: linux
jpackageDownload: https://download.java.net/java/early_access/jpackage/1/openjdk-14-jpackage+1-70_linux-x64_bin.tar.gz
jpackageDownload: https://download.java.net/java/early_access/jdk14/27/GPL/openjdk-14-ea+27_linux-x64_bin.tar.gz
jdk14Path: /jdk-14
archivePortable: tar -czf build/distribution/JabRef-portable_linux.tar.gz -C build/distribution JabRef && rm -R build/distribution/JabRef
- os: windows-latest
displayName: windows
jpackageDownload: https://download.java.net/java/early_access/jpackage/1/openjdk-14-jpackage+1-70_windows-x64_bin.zip
jpackageDownload: https://download.java.net/java/early_access/jdk14/27/GPL/openjdk-14-ea+27_windows-x64_bin.zip
jdk14Path: /jdk-14
archivePortable: 7z a -r build/distribution/JabRef-portable_windows.zip ./build/distribution/JabRef && rm -R build/distribution/JabRef
- os: macOS-latest
displayName: macOS
jpackageDownload: https://download.java.net/java/early_access/jpackage/1/openjdk-14-jpackage+1-70_osx-x64_bin.tar.gz
jpackageDownload: https://download.java.net/java/early_access/jdk14/27/GPL/openjdk-14-ea+27_osx-x64_bin.tar.gz
jdk14Path: /jdk-14.jdk/Contents/Home
archivePortable: tar -czf build/distribution/JabRef-portable_macos.tar.gz -C build/distribution JabRef.app && rm -R build/distribution/JabRef.app

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#

### Fixed

- We fixed an issue where the Medline fetcher was only working when JabRef was running from source [#5645](https://github.com/JabRef/jabref/issues/5645)


### Removed


Expand All @@ -34,6 +37,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We changed the save action buttons to be easier to understand. [#5565](https://github.com/JabRef/jabref/issues/5565)
- We made the columns for groups, files and uri in the main table reorderable and merged the clickable icon columns for uri, url, doi and eprint. [#5544](https://github.com/JabRef/jabref/pull/5544)
- We reduced the number of write actions performed when autosave is enabled [#5679](https://github.com/JabRef/jabref/issues/5679)
- We made the column sort order in the main table persistent [#5730](https://github.com/JabRef/jabref/pull/5730)

### Fixed

Expand Down
36 changes: 23 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ dependencies {
}


testCompile 'io.github.classgraph:classgraph:4.8.58'
testCompile 'io.github.classgraph:classgraph:4.8.59'
testImplementation 'org.junit.jupiter:junit-jupiter:5.5.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.5.2'
testCompile 'org.junit.platform:junit-platform-launcher:1.5.2'

testCompile 'net.bytebuddy:byte-buddy-parent:1.10.4'
testCompile 'net.bytebuddy:byte-buddy-parent:1.10.5'
testRuntime group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-SNAPSHOT'
testRuntime group: 'org.apache.logging.log4j', name: 'log4j-jul', version: '3.0.0-SNAPSHOT'
testCompile 'org.mockito:mockito-core:3.2.0'
testCompile 'org.mockito:mockito-core:3.2.4'
//testCompile 'com.github.tomakehurst:wiremock:2.24.1'
testCompile 'org.xmlunit:xmlunit-core:2.6.3'
testCompile 'org.xmlunit:xmlunit-matchers:2.6.3'
Expand Down Expand Up @@ -249,20 +249,29 @@ dependencyUpdates.resolutionStrategy = {
selection.reject('Release candidate')
}
}
rules.withModule("com.github.tomtung:latex2unicode_2.12") { ComponentSelection selection ->
if (selection.candidate.version ==~ /0.2.*/) {
// Reject version higher than 2.0.2. see https://github.com/JabRef/jabref/pull/3781
selection.reject("Cannot be updated to 0.2.4 until JabRef is prepared for it")
rules.withModule("org.python:jython-standalone") { ComponentSelection selection ->
if (selection.candidate.version ==~ /2.7.2b2/) {
selection.reject('Release candidate')
}
}
rules.withModule("de.jensd:fontawesomefx-materialdesignfont") { ComponentSelection selection ->
if (selection.candidate.version ==~ /2.0.26-9.1.2/) {
selection.reject('1.7.22-11 is actually newer (strange version system)')
}
}
rules.withModule("org.javamodularity.moduleplugin:org.javamodularity.moduleplugin.gradle.plugin") { ComponentSelection selection ->
if (selection.candidate.version ==~ /1.6.0/) {
selection.reject("Does not work due to bug, see https://github.com/JabRef/jabref/pull/5270")
}
}
rules.withModule("com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin") { ComponentSelection selection ->
if (selection.candidate.version ==~ /4.*/) {
selection.reject("Version 4.X breaks the release process.")
rules.withModule("com.microsoft.azure:applicationinsights-core") { ComponentSelection selection ->
if (selection.candidate.version ==~ /2.5.1/) {
selection.reject("Does not work due to bug, see https://github.com/JabRef/jabref/pull/5596")
}
}
rules.withModule("com.google.errorprone:error_prone_core") { ComponentSelection selection ->
if (selection.candidate.version ==~ /2.3.3/) {
selection.reject("Does not work due to bug https://github.com/google/error-prone/issues/1240")
rules.withModule("com.microsoft.azure:applicationinsights-logging-log4j2") { ComponentSelection selection ->
if (selection.candidate.version ==~ /2.5.1/) {
selection.reject("Does not work due to bug, see https://github.com/JabRef/jabref/pull/5596")
}
}
}
Expand Down Expand Up @@ -597,6 +606,7 @@ jlink {
uses 'com.airhacks.afterburner.injection.PresenterFactory'
uses 'org.controlsfx.glyphfont.GlyphFont'
uses 'com.airhacks.afterburner.views.ResourceLocator'
uses 'javax.xml.bind.JAXBContextFactory'
provides 'java.sql.Driver' with 'org.postgresql.Driver'
provides 'org.controlsfx.glyphfont.GlyphFont' with 'org.controlsfx.glyphfont.FontAwesome'
provides 'org.apache.commons.logging.LogFactory' with 'org.apache.logging.log4j.jcl.LogFactoryImpl'
Expand Down
19 changes: 6 additions & 13 deletions src/main/java/org/jabref/gui/maintable/ColumnPreferences.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
package org.jabref.gui.maintable;

import java.util.List;
import java.util.Map;

import javafx.scene.control.TableColumn.SortType;

public class ColumnPreferences {

public static final double DEFAULT_WIDTH = 100;
public static final double DEFAULT_COLUMN_WIDTH = 100;
public static final double ICON_COLUMN_WIDTH = 16 + 12; // add some additional space to improve appearance

private final List<MainTableColumnModel> columns;
private final boolean extraFileColumnsEnabled;
private final Map<String, SortType> columnSortType;
private final List<MainTableColumnModel> columnSortOrder;

public ColumnPreferences(List<MainTableColumnModel> columns, boolean extraFileColumnsEnabled, Map<String, SortType> columnSortType) {
public ColumnPreferences(List<MainTableColumnModel> columns, List<MainTableColumnModel> columnSortOrder) {
this.columns = columns;
this.extraFileColumnsEnabled = extraFileColumnsEnabled;
this.columnSortType = columnSortType;
this.columnSortOrder = columnSortOrder;
}

public boolean getExtraFileColumnsEnabled() { return extraFileColumnsEnabled; }

public List<MainTableColumnModel> getColumns() {
return columns;
}

public Map<String, SortType> getSortTypesForColumns() {
return columnSortType;
public List<MainTableColumnModel> getColumnSortOrder() {
return columnSortOrder;
}
}
18 changes: 9 additions & 9 deletions src/main/java/org/jabref/gui/maintable/MainTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ public MainTable(MainTableDataModel model, JabRefFrame frame,
.setOnMouseDragEntered(this::handleOnDragEntered)
.install(this);

/*for (Entry<String, SortType> entries : preferences.getColumnPreferences().getSortTypesForColumns().entrySet()) {
Optional<TableColumn<BibEntryTableViewModel, ?>> column = this.getColumns().stream().filter(col -> entries.getKey().equals(col.getText())).findFirst();
column.ifPresent(col -> {
col.setSortType(entries.getValue());
this.getSortOrder().add(col);
});
}*/

if (preferences.resizeColumnsToFit()) {
this.getSortOrder().clear();
preferences.getColumnPreferences().getColumnSortOrder().forEach(columnModel ->
this.getColumns().stream()
.map(column -> (MainTableColumn<?>) column)
.filter(column -> column.getModel().equals(columnModel))
.findFirst()
.ifPresent(column -> this.getSortOrder().add(column)));

if (preferences.getResizeColumnsToFit()) {
this.setColumnResizePolicy(new SmartConstrainedResizePolicy());
}
this.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/org/jabref/gui/maintable/MainTableColumn.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.jabref.gui.maintable;

import javafx.beans.value.ObservableValue;
import javafx.scene.control.TableColumn;

import org.jabref.gui.util.BindingsHelper;
Expand All @@ -16,6 +17,12 @@ public MainTableColumn(MainTableColumnModel model) {
model.widthProperty(),
value -> this.setPrefWidth(model.widthProperty().getValue()),
value -> model.widthProperty().setValue(this.getWidth()));

BindingsHelper.bindBidirectional(
this.sortTypeProperty(),
(ObservableValue<SortType>) model.sortTypeProperty(),
value -> this.setSortType(model.sortTypeProperty().getValue()),
value -> model.sortTypeProperty().setValue(this.getSortType()));
}

public MainTableColumnModel getModel() { return model; }
Expand Down
86 changes: 49 additions & 37 deletions src/main/java/org/jabref/gui/maintable/MainTableColumnModel.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.jabref.gui.maintable;

import java.util.EnumSet;
import java.util.Objects;

import javafx.beans.property.DoubleProperty;
Expand All @@ -9,6 +10,7 @@
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.scene.control.TableColumn;

import org.jabref.gui.util.FieldsUtil;
import org.jabref.logic.l10n.Localization;
Expand All @@ -35,6 +37,8 @@ public enum Type {
NORMALFIELD("field"),
SPECIALFIELD("special", Localization.lang("Special"));

public static final EnumSet<Type> ICON_COLUMNS = EnumSet.of(EXTRAFILE,FILES,GROUPS,LINKED_IDENTIFIER);

private String name;
private String displayName;

Expand Down Expand Up @@ -67,35 +71,54 @@ public static Type fromString(String text) {
}
}

private final ObjectProperty<Type> typeProperty;
private final StringProperty qualifierProperty;
private final DoubleProperty widthProperty;
private final ObjectProperty<Type> typeProperty = new SimpleObjectProperty<>();
private final StringProperty qualifierProperty = new SimpleStringProperty();
private final DoubleProperty widthProperty = new SimpleDoubleProperty();
private final ObjectProperty<TableColumn.SortType> sortTypeProperty = new SimpleObjectProperty<>();

/**
* This is used by the preferences dialog, to initialize available columns the user can add to the table.
*
* @param type the {@code MainTableColumnModel.Type} of the column, e.g. "NORMALFIELD" or "GROUPS"
* @param type the {@code MainTableColumnModel.Type} of the column, e.g. "NORMALFIELD" or "EXTRAFILE"
* @param qualifier the stored qualifier of the column, e.g. "author/editor"
*/
public MainTableColumnModel(Type type, String qualifier, double width) {
public MainTableColumnModel(Type type, String qualifier) {
Objects.requireNonNull(type);
typeProperty = new SimpleObjectProperty<>(type);
qualifierProperty = new SimpleStringProperty(qualifier);
widthProperty = new SimpleDoubleProperty(width);
}
Objects.requireNonNull(qualifier);

public MainTableColumnModel(Type type, String qualifier) {
this(type, qualifier, ColumnPreferences.DEFAULT_WIDTH);
}
this.typeProperty.setValue(type);
this.qualifierProperty.setValue(qualifier);
this.sortTypeProperty.setValue(TableColumn.SortType.ASCENDING);

public MainTableColumnModel(Type type, double width) {
this(type, "", width);
if (Type.ICON_COLUMNS.contains(type)) {
this.widthProperty.setValue(ColumnPreferences.ICON_COLUMN_WIDTH);
} else {
this.widthProperty.setValue(ColumnPreferences.DEFAULT_COLUMN_WIDTH);
}
}

/**
* This is used by the preferences dialog, to initialize available basic icon columns, the user can add to the table.
*
* @param type the {@code MainTableColumnModel.Type} of the column, e.g. "GROUPS" or "LINKED_IDENTIFIER"
*/
public MainTableColumnModel(Type type) {
this(type, "");
}

/**
* This is used by the preference migrations.
*
* @param type the {@code MainTableColumnModel.Type} of the column, e.g. "NORMALFIELD" or "GROUPS"
* @param qualifier the stored qualifier of the column, e.g. "author/editor"
* @param width the stored width of the column
*/
public MainTableColumnModel(Type type, String qualifier, double width) {
this(type, qualifier);

this.widthProperty.setValue(width);
}

public Type getType() { return typeProperty.getValue(); }

public String getQualifier() { return qualifierProperty.getValue(); }
Expand All @@ -109,10 +132,7 @@ public String getName() {
}

public String getDisplayName() {
if ((typeProperty.getValue() == Type.GROUPS
|| typeProperty.getValue() == Type.FILES
|| typeProperty.getValue() == Type.LINKED_IDENTIFIER)
&& qualifierProperty.getValue().isBlank()) {
if (Type.ICON_COLUMNS.contains(typeProperty.getValue()) && qualifierProperty.getValue().isBlank()) {
return typeProperty.getValue().getDisplayName();
} else {
return FieldsUtil.getNameWithType(FieldFactory.parseField(qualifierProperty.getValue()));
Expand All @@ -121,12 +141,14 @@ public String getDisplayName() {

public StringProperty nameProperty() { return new ReadOnlyStringWrapper(getDisplayName()); }

public double getWidth() {
return widthProperty.get();
}
public double getWidth() { return widthProperty.getValue(); }

public DoubleProperty widthProperty() { return widthProperty; }

public TableColumn.SortType getSortType() { return sortTypeProperty.getValue(); }

public ObjectProperty<TableColumn.SortType> sortTypeProperty() { return sortTypeProperty; }

public boolean equals(Object o) {
if (this == o) {
return true;
Expand All @@ -149,23 +171,11 @@ public int hashCode() {
}

/**
* This is used by JabRefPreferences, to create a new ColumnModel out ouf the stored preferences.
* This creates a new {@code MainTableColumnModel} out of a given string
*
* @param rawColumnName the stored name of the column, e.g. "field:author"
* @param width the stored width of the column
*/
public static MainTableColumnModel parse(String rawColumnName, Double width) {
MainTableColumnModel columnModel = parse(rawColumnName);

Objects.requireNonNull(width);
columnModel.widthProperty().setValue(width);
return columnModel;
}

/**
* This is used by the preferences dialog, to allow the user to type in a field he wants to add to the table.
* @param rawColumnName the name of the column, e.g. "field:author", or "author"
*
* @param rawColumnName the stored name of the column, e.g. "field:author", or "author"
* @return A new {@code MainTableColumnModel}
*/
public static MainTableColumnModel parse(String rawColumnName) {
Objects.requireNonNull(rawColumnName);
Expand All @@ -174,7 +184,9 @@ public static MainTableColumnModel parse(String rawColumnName) {
Type type = Type.fromString(splittedName[0]);
String qualifier = "";

if (type == Type.NORMALFIELD || type == Type.SPECIALFIELD || type == Type.EXTRAFILE) {
if (type == Type.NORMALFIELD
|| type == Type.SPECIALFIELD
|| type == Type.EXTRAFILE) {
if (splittedName.length == 1) {
qualifier = splittedName[0]; // By default the rawColumnName is parsed as NORMALFIELD
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@
public class MainTablePreferences {
private final ColumnPreferences columnPreferences;
private final boolean resizeColumnsToFit;
private final boolean extraFileColumnsEnabled;

public MainTablePreferences(ColumnPreferences columnPreferences, boolean resizeColumnsToFit) {
public MainTablePreferences(ColumnPreferences columnPreferences, boolean resizeColumnsToFit, boolean extraFileColumnsEnabled) {
this.columnPreferences = columnPreferences;
this.resizeColumnsToFit = resizeColumnsToFit;
this.extraFileColumnsEnabled = extraFileColumnsEnabled;
}

public ColumnPreferences getColumnPreferences() {
return columnPreferences;
}

public boolean resizeColumnsToFit() {
public boolean getResizeColumnsToFit() {
return resizeColumnsToFit;
}

public boolean getExtraFileColumnsEnabled() { return extraFileColumnsEnabled; }
}
Loading

0 comments on commit 9061f37

Please sign in to comment.