Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve user friendliness of automatically linked files #7484

Merged
merged 12 commits into from
Mar 9, 2021
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- The export to MS Office XML now uses the month name for the field `MonthAcessed` instead of the two digit number [#7354](https://github.com/JabRef/jabref/issues/7354)
- We included some standalone dialogs from the options menu in the main preference dialog and fixed some visual issues in the preferences dialog. [#7384](https://github.com/JabRef/jabref/pull/7384)
- We improved the linking of the `python3` interpreter via the shebang to dynamically use the systems default Python. Related to [JabRef-Browser-Extension #177](https://github.com/JabRef/JabRef-Browser-Extension/issues/177)
- Automatically found pdf files now have the linking button to the far left and uses a link icon with a plus instead of a briefcase. The file name also has lowered opacity(70%) until added. [#3607](https://github.com/JabRef/jabref/issues/3607)
- We simplified the select entry type form by splitting it into two parts ("Recommended" and "Others") based on internal usage data. [#6730](https://github.com/JabRef/jabref/issues/6730)

### Fixed
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/jabref/gui/Base.css
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,10 @@
-fx-fill: -jr-search-text;
}

.file-row-text:opacity{
-fx-fill: derive(-jr-search-text, 70%);
}

.combo-box-base {
-fx-background-color: -fx-outer-border, -fx-control-inner-background;
-fx-background-insets: 0, 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import javafx.beans.binding.Bindings;
import javafx.collections.ObservableList;
import javafx.css.PseudoClass;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.Parent;
Expand Down Expand Up @@ -46,6 +47,7 @@
import org.jabref.preferences.PreferencesService;

import com.airhacks.afterburner.views.ViewLoader;
import com.tobiasdiez.easybind.EasyBind;

public class LinkedFilesEditor extends HBox implements FieldEditorFX {

Expand Down Expand Up @@ -137,11 +139,16 @@ private void handleOnDragDropped(LinkedFileViewModel originalItem, DragEvent eve
}

private static Node createFileDisplay(LinkedFileViewModel linkedFile) {
PseudoClass opacity = PseudoClass.getPseudoClass("opacity");

Node icon = linkedFile.getTypeIcon().getGraphicNode();
icon.setOnMouseClicked(event -> linkedFile.open());

Text link = new Text();
link.textProperty().bind(linkedFile.linkProperty());
link.getStyleClass().setAll("file-row-text");
EasyBind.subscribe(linkedFile.isAutomaticallyFoundProperty(), found -> link.pseudoClassStateChanged(opacity, found));

Text desc = new Text();
desc.textProperty().bind(linkedFile.descriptionProperty());
desc.getStyleClass().setAll("file-row-text");
Expand All @@ -157,6 +164,7 @@ private static Node createFileDisplay(LinkedFileViewModel linkedFile) {
Button acceptAutoLinkedFile = IconTheme.JabRefIcons.AUTO_LINKED_FILE.asButton();
acceptAutoLinkedFile.setTooltip(new Tooltip(Localization.lang("This file was found automatically. Do you want to link it to this entry?")));
acceptAutoLinkedFile.visibleProperty().bind(linkedFile.isAutomaticallyFoundProperty());
acceptAutoLinkedFile.managedProperty().bind(linkedFile.isAutomaticallyFoundProperty());
acceptAutoLinkedFile.setOnAction(event -> linkedFile.acceptAsLinked());
acceptAutoLinkedFile.getStyleClass().setAll("icon-button");

Expand All @@ -169,7 +177,7 @@ private static Node createFileDisplay(LinkedFileViewModel linkedFile) {
HBox container = new HBox(10);
container.setPrefHeight(Double.NEGATIVE_INFINITY);

container.getChildren().addAll(info, acceptAutoLinkedFile, writeXMPMetadata);
container.getChildren().addAll(acceptAutoLinkedFile, info, writeXMPMetadata);

return container;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/icon/IconTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public enum JabRefIcons implements JabRefIcon {
RENAME(MaterialDesignR.RENAME_BOX),
DELETE_FILE(MaterialDesignD.DELETE_FOREVER),
REMOVE_LINK(MaterialDesignL.LINK_OFF),
AUTO_LINKED_FILE(MaterialDesignB.BRIEFCASE_CHECK),
AUTO_LINKED_FILE(MaterialDesignL.LINK_PLUS),
QUALITY_ASSURED(MaterialDesignC.CERTIFICATE),
QUALITY(MaterialDesignC.CERTIFICATE),
OPEN(MaterialDesignF.FOLDER_OUTLINE),
Expand Down