Skip to content

Commit

Permalink
Merge pull request #5 from JabRef/master
Browse files Browse the repository at this point in the history
Merging from master
  • Loading branch information
CyraxSector authored Aug 20, 2019
2 parents e2f389f + 445af8d commit a369e3e
Show file tree
Hide file tree
Showing 62 changed files with 1,642 additions and 1,364 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where the same menu for changing entry type had two different sizes and weights. [#4977](https://github.com/JabRef/jabref/issues/4977)
- We fixed an issue where the "Attach file" dialog, in the right-click menu for an entry, started on the working directory instead of the user's main directory. [#4995](https://github.com/JabRef/jabref/issues/4995)
- We fixed an issue where the JabRef Icon in the macOS launchpad was not displayed correctly [#5003](https://github.com/JabRef/jabref/issues/5003)
- We fixed an issue where the "Search for unlinked local files" would throw an exception when parsing the content of a PDF-file with missing "series" information [#5128](https://github.com/JabRef/jabref/issues/5128)


### Removed
Expand Down
16 changes: 8 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ buildscript {
}

plugins {
id 'com.gradle.build-scan' version '2.3'
id 'com.gradle.build-scan' version '2.4'
id 'com.install4j.gradle' version '7.0.12'
id 'com.github.johnrengelman.shadow' version '5.1.0'
id "com.simonharrer.modernizer" version '1.8.0-1'
id 'me.champeau.gradle.jmh' version '0.4.8'
id 'net.ltgt.errorprone' version '0.8.1'
id 'com.github.ben-manes.versions' version '0.21.0'
id 'com.github.ben-manes.versions' version '0.22.0'
}

// use the gradle build scan feature: https://scans.gradle.com/get-started
Expand Down Expand Up @@ -143,10 +143,10 @@ dependencies {

// >1.8.0-beta is required for java 9 compatibility
compile 'org.slf4j:slf4j-api:2.0.0-alpha0'
compile 'org.apache.logging.log4j:log4j-slf4j18-impl:2.12.0'
compile 'org.apache.logging.log4j:log4j-jcl:2.12.0'
compile 'org.apache.logging.log4j:log4j-api:2.12.0'
compile 'org.apache.logging.log4j:log4j-core:2.12.0'
compile 'org.apache.logging.log4j:log4j-slf4j18-impl:2.12.1'
compile 'org.apache.logging.log4j:log4j-jcl:2.12.1'
compile 'org.apache.logging.log4j:log4j-api:2.12.1'
compile 'org.apache.logging.log4j:log4j-core:2.12.1'

compile 'de.undercouch:citeproc-java:1.0.1'

Expand All @@ -162,9 +162,9 @@ dependencies {
testCompile 'org.junit.platform:junit-platform-launcher:1.5.1'

testRuntime 'org.apache.logging.log4j:log4j-core:2.12.0'
testRuntime 'org.apache.logging.log4j:log4j-jul:2.12.0'
testRuntime 'org.apache.logging.log4j:log4j-jul:2.12.1'
testCompile 'org.mockito:mockito-core:3.0.0'
testCompile 'com.github.tomakehurst:wiremock:2.24.0'
testCompile 'com.github.tomakehurst:wiremock:2.24.1'
testCompile 'org.reflections:reflections:0.9.11'
testCompile 'org.xmlunit:xmlunit-core:2.6.3'
testCompile 'org.xmlunit:xmlunit-matchers:2.6.3'
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/jabref/gui/Base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,11 @@ We want to have a look that matches our icons in the tool-bar */
-fx-fill: -jr-warn;
}

.warning-message {
-fx-fill: -jr-error;
-fx-text-fill: -jr-error;
}

.error-icon {
-fx-text-fill: -jr-error;
-fx-fill: -jr-error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private void buildLayout() {
actionsList.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
new ViewModelListCellFactory<FieldFormatterCleanup>()
.withText(action -> action.getField() + ": " + action.getFormatter().getName())
.withTooltip(action -> action.getFormatter().getDescription())
.withStringTooltip(action -> action.getFormatter().getDescription())
.install(actionsList);
add(actionsList, 1, 1, 3, 1);

Expand Down Expand Up @@ -171,7 +171,7 @@ private GridPane getSelectorPanel() {
formattersCombobox = new ComboBox<>(FXCollections.observableArrayList(availableFormatters));
new ViewModelListCellFactory<Formatter>()
.withText(Formatter::getName)
.withTooltip(Formatter::getDescription)
.withStringTooltip(Formatter::getDescription)
.install(formattersCombobox);
EasyBind.subscribe(formattersCombobox.valueProperty(), e -> updateDescription());
builder.add(formattersCombobox, 3, 1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jabref.gui.collab;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.Set;
Expand Down Expand Up @@ -44,7 +45,7 @@ public EntryChangeViewModel(BibEntry memEntry, BibEntry tmpEntry, BibEntry diskE
LOGGER.debug("Modified entry: " + memEntry.getCiteKeyOptional().orElse("<no BibTeX key set>")
+ "\n Modified locally: " + isModifiedLocally + " Modifications agree: " + modificationsAgree);

Set<Field> allFields = new TreeSet<>();
Set<Field> allFields = new TreeSet<>(Comparator.comparing(Field::getName));
allFields.addAll(memEntry.getFields());
allFields.addAll(tmpEntry.getFields());
allFields.addAll(diskEntry.getFields());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jabref.gui.BibEntryTypes;
package org.jabref.gui.customentrytypes;

import org.jabref.gui.JabRefFrame;
import org.jabref.gui.actions.SimpleCommand;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jabref.gui.BibEntryTypes;
package org.jabref.gui.customentrytypes;

import org.jabref.gui.util.BaseDialog;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jabref.gui.BibEntryTypes;
package org.jabref.gui.customentrytypes;

import java.awt.Component;
import java.awt.GridBagConstraints;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public LinkedFilesEditor(Field field, DialogService dialogService, BibDatabaseCo
.load();

ViewModelListCellFactory<LinkedFileViewModel> cellFactory = new ViewModelListCellFactory<LinkedFileViewModel>()
.withTooltip(LinkedFileViewModel::getDescription)
.withStringTooltip(LinkedFileViewModel::getDescription)
.withGraphic(LinkedFilesEditor::createFileDisplay)
.withContextMenu(this::createContextMenuForFile)
.withOnMouseClickedEvent(this::handleItemMouseClick)
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/icon/IconTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ public enum JabRefIcons implements JabRefIcon {
LATEX_FILE_DIRECTORY(MaterialDesignIcon.FOLDER_OUTLINE),
LATEX_FILE(MaterialDesignIcon.FILE_OUTLINE),
LATEX_COMMENT(MaterialDesignIcon.COMMENT_TEXT_OUTLINE),
LATEX_LINE(MaterialDesignIcon.FORMAT_LINE_SPACING);
LATEX_LINE(MaterialDesignIcon.FORMAT_LINE_SPACING),
PASSWORD_REVEALED(MaterialDesignIcon.EYE);

private final JabRefIcon icon;

Expand Down
64 changes: 40 additions & 24 deletions src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@

import javax.swing.undo.UndoManager;

import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TableColumn;
import javafx.scene.control.Tooltip;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;

Expand Down Expand Up @@ -65,7 +67,7 @@ class MainTableColumnFactory {
private final CellFactory cellFactory;
private final UndoManager undoManager;
private final DialogService dialogService;


public MainTableColumnFactory(BibDatabaseContext database, ColumnPreferences preferences, ExternalFileTypes externalFileTypes, UndoManager undoManager, DialogService dialogService) {
this.database = Objects.requireNonNull(database);
Expand All @@ -78,9 +80,7 @@ public MainTableColumnFactory(BibDatabaseContext database, ColumnPreferences pre

public List<TableColumn<BibEntryTableViewModel, ?>> createColumns() {
List<TableColumn<BibEntryTableViewModel, ?>> columns = new ArrayList<>();

columns.add(createGroupColumn());

// Add column for linked files
if (preferences.showFileColumn()) {
columns.add(createFileColumn());
Expand Down Expand Up @@ -116,35 +116,51 @@ public MainTableColumnFactory(BibDatabaseContext database, ColumnPreferences pre

private TableColumn<BibEntryTableViewModel, ?> createGroupColumn() {
TableColumn<BibEntryTableViewModel, List<AbstractGroup>> column = new TableColumn<>();
column.getStyleClass().add(GROUP_COLUMN);
setExactWidth(column, 20);
Node headerGraphic = IconTheme.JabRefIcons.DEFAULT_GROUP_ICON.getGraphicNode();
Tooltip.install(headerGraphic, new Tooltip(Localization.lang("Group color")));
column.setGraphic(headerGraphic);
column.getStyleClass().add(ICON_COLUMN);
setExactWidth(column, GUIGlobals.WIDTH_ICON_COL);
column.setCellValueFactory(cellData -> cellData.getValue().getMatchedGroups(database));
new ValueTableCellFactory<BibEntryTableViewModel, List<AbstractGroup>>()
.withGraphic(this::createGroupColorRegion)
.install(column);
column.setStyle("-fx-padding: 0 0 0 0;");
column.setSortable(true);
return column;
}

private Node createGroupColorRegion(BibEntryTableViewModel entry, List<AbstractGroup> matchedGroups) {
Rectangle rectangle = new Rectangle();
rectangle.setWidth(3);
rectangle.setHeight(20);
Color color = matchedGroups.stream()
.flatMap(group -> OptionalUtil.toStream(group.getColor()))
.findFirst()
.orElse(Color.TRANSPARENT);
rectangle.setFill(color);

String matchedGroupsString = matchedGroups.stream()
.map(AbstractGroup::getName)
.collect(Collectors.joining(", "));
Tooltip tooltip = new Tooltip(Localization.lang("Entry is contained in the following groups:") + "\n" + matchedGroupsString);
Tooltip.install(rectangle, tooltip);

BorderPane container = new BorderPane();
container.setLeft(rectangle);
return container;
Color groupColor = matchedGroups.stream()
.flatMap(group -> OptionalUtil.toStream(group.getColor()))
.findFirst()
.orElse(Color.TRANSPARENT);

if (groupColor != Color.TRANSPARENT) {
Rectangle border = new Rectangle();
border.setWidth(5);
border.setHeight(20);
border.setFill(Color.DARKGRAY);

Rectangle groupRectangle = new Rectangle();
groupRectangle.setWidth(3);
groupRectangle.setHeight(18);
groupRectangle.setFill(groupColor);

StackPane container = new StackPane();
container.setMinWidth(10);
container.setAlignment(Pos.CENTER);

container.getChildren().addAll(border,groupRectangle);

String matchedGroupsString = matchedGroups.stream()
.map(AbstractGroup::getName)
.collect(Collectors.joining(", "));
Tooltip tooltip = new Tooltip(Localization.lang("Entry is contained in the following groups:") + "\n" + matchedGroupsString);
Tooltip.install(container, tooltip);
return container;
}
return new Pane();
}

private List<TableColumn<BibEntryTableViewModel, ?>> createNormalColumns() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.Set;
Expand Down Expand Up @@ -92,8 +93,10 @@ private void showMergeDialog(BibEntry originalEntry, BibEntry fetchedEntry, WebF
NamedCompound ce = new NamedCompound(Localization.lang("Merge entry with %0 information", fetcher.getName()));

// Updated the original entry with the new fields
Set<Field> jointFields = new TreeSet<>(mergedEntry.get().getFields());
Set<Field> originalFields = new TreeSet<>(originalEntry.getFields());
Set<Field> jointFields = new TreeSet<>(Comparator.comparing(Field::getName));
jointFields.addAll(mergedEntry.get().getFields());
Set<Field> originalFields = new TreeSet<>(Comparator.comparing(Field::getName));
originalFields.addAll(originalEntry.getFields());
boolean edited = false;

// entry type
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/org/jabref/gui/mergeentries/MergeEntries.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -46,18 +47,18 @@ public class MergeEntries extends BorderPane {

// Headings
private final List<String> columnHeadings = Arrays.asList(Localization.lang("Field"),
Localization.lang("Left entry"),
Localization.lang("Left"),
Localization.lang("None"),
Localization.lang("Right"),
Localization.lang("Right entry"));
Localization.lang("Left entry"),
Localization.lang("Left"),
Localization.lang("None"),
Localization.lang("Right"),
Localization.lang("Right entry"));
private final Set<Field> identicalFields = new HashSet<>();
private final Set<Field> differentFields = new HashSet<>();
private final BibEntry mergedEntry = new BibEntry();
private final BibEntry leftEntry;
private final BibEntry rightEntry;
private final Map<Field, TextFlow> leftTextPanes = new HashMap<>();
private final Set<Field> allFields = new TreeSet<>();
private final Set<Field> allFields = new TreeSet<>(Comparator.comparing(Field::getName));
private final Map<Field, TextFlow> rightTextPanes = new HashMap<>();
private final Map<Field, List<RadioButton>> radioButtons = new HashMap<>();
private Boolean identicalTypes;
Expand All @@ -81,7 +82,6 @@ public MergeEntries(BibEntry entryLeft, BibEntry entryRight, String headingLeft,
setRightHeaderText(headingRight);
}


/**
* Constructor taking two entries
*
Expand Down Expand Up @@ -240,8 +240,8 @@ private void setupHeadingRows(GridPane mergePanel) {
private void fillDiffModes() {
diffMode.setItems(FXCollections.observableList(Arrays.asList(DiffMode.values())));
new ViewModelListCellFactory<DiffMode>()
.withText(MergeEntries::getDisplayText)
.install(diffMode);
.withText(MergeEntries::getDisplayText)
.install(diffMode);
DiffMode diffModePref = Globals.prefs.getAsOptional(JabRefPreferences.MERGE_ENTRIES_DIFF_MODE)
.flatMap(DiffMode::parse)
.orElse(DiffMode.WORD);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.jabref.gui.preferences;

import java.util.List;

import javax.inject.Inject;

import javafx.scene.Node;
import javafx.scene.layout.VBox;

import org.jabref.gui.DialogService;
import org.jabref.gui.util.TaskExecutor;
import org.jabref.preferences.JabRefPreferences;

public abstract class AbstractPreferenceTabView extends VBox implements PreferencesTab {

@Inject protected TaskExecutor taskExecutor;
@Inject protected DialogService dialogService;

protected PreferenceTabViewModel viewModel;

protected JabRefPreferences preferences;

@Override
public Node getBuilder() { return this; }

@Override
public void setValues() { viewModel.setValues(); }

@Override
public void storeSettings() { viewModel.storeSettings(); }

@Override
public boolean validateSettings() { return viewModel.validateSettings(); }

@Override
public List<String> getRestartWarnings() { return viewModel.getRestartWarnings(); }
}
Loading

0 comments on commit a369e3e

Please sign in to comment.