diff --git a/src/main/java/org/jabref/gui/Base.css b/src/main/java/org/jabref/gui/Base.css index 9296ab3a7d8..e7f42cd8bb4 100644 --- a/src/main/java/org/jabref/gui/Base.css +++ b/src/main/java/org/jabref/gui/Base.css @@ -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; diff --git a/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java b/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java index 0c40f927eea..79993c07758 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java +++ b/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java @@ -74,7 +74,6 @@ public class LinkedFileViewModel extends AbstractViewModel { private final XmpPreferences xmpPreferences; private final LinkedFileHandler linkedFileHandler; private final ExternalFileTypes externalFileTypes; - private final DoubleProperty opacityProperty = new SimpleDoubleProperty(1.0); private final Validator fileExistsValidator; @@ -177,12 +176,10 @@ public JabRefIcon getTypeIcon() { public void markAsAutomaticallyFound() { isAutomaticallyFound.setValue(true); - opacityProperty.setValue(0.7); } public void acceptAsLinked() { isAutomaticallyFound.setValue(false); - opacityProperty.setValue(1.0); } public Observable[] getObservables() { @@ -511,12 +508,4 @@ public LinkedFile getFile() { public ValidationStatus fileExistsValidationStatus() { return fileExistsValidator.getValidationStatus(); } - - public DoubleProperty opacityProperty() { - return opacityProperty; - } - - public void setOpacityProperty(double v) { - opacityProperty.setValue(v); - } } diff --git a/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java b/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java index d568a620e22..aa42587c8c3 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java +++ b/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java @@ -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; @@ -137,12 +138,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.opacityProperty().bind(linkedFile.opacityProperty()); link.textProperty().bind(linkedFile.linkProperty()); link.getStyleClass().setAll("file-row-text"); + link.pseudoClassStateChanged(opacity, linkedFile.isAutomaticallyFound()); + Text desc = new Text(); desc.textProperty().bind(linkedFile.descriptionProperty()); desc.getStyleClass().setAll("file-row-text"); @@ -159,7 +164,10 @@ private static Node createFileDisplay(LinkedFileViewModel linkedFile) { 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.setOnAction(event -> { + linkedFile.acceptAsLinked(); + link.pseudoClassStateChanged(opacity, linkedFile.isAutomaticallyFound()); + }); acceptAutoLinkedFile.getStyleClass().setAll("icon-button"); Button writeXMPMetadata = IconTheme.JabRefIcons.IMPORT.asButton();