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

Fix/12351 area of preview hover #12355

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
19 changes: 18 additions & 1 deletion src/main/java/org/jabref/gui/maintable/MainTableTooltip.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import javafx.scene.control.Label;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.util.Duration;

Expand All @@ -23,20 +24,36 @@ public class MainTableTooltip extends Tooltip {
public MainTableTooltip(DialogService dialogService, GuiPreferences preferences, ThemeManager themeManager, TaskExecutor taskExecutor) {
this.preferences = preferences;
this.preview = new PreviewViewer(dialogService, preferences, themeManager, taskExecutor);
this.setShowDelay(Duration.seconds(1));

this.setShowDelay(Duration.millis(100));
this.setHideDelay(Duration.millis(500));

this.tooltipContent.getChildren().addAll(fieldValueLabel, preview);

tooltipContent.setStyle("-fx-padding: 10; -fx-background-color: white; -fx-border-color: gray; -fx-border-radius: 5;");
}

public Tooltip createTooltip(BibDatabaseContext databaseContext, BibEntry entry, String fieldValue) {
fieldValueLabel.setText(fieldValue + "\n");

fieldValueLabel.setWrapText(true);
fieldValueLabel.setMaxWidth(400);

tooltipContent.setPrefSize(Region.USE_COMPUTED_SIZE, Region.USE_COMPUTED_SIZE);
tooltipContent.setMaxWidth(500);
tooltipContent.setMaxHeight(400);

if (preferences.getPreviewPreferences().shouldShowPreviewEntryTableTooltip()) {
preview.setLayout(preferences.getPreviewPreferences().getSelectedPreviewLayout());
preview.setDatabaseContext(databaseContext);
preview.setEntry(entry);

this.setGraphic(tooltipContent);
} else {
this.setGraphic(fieldValueLabel);
}

return this;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ public List<IntegrityMessage> check(BibEntry entry) {
.ifPresent(val -> messages.add(new IntegrityMessage(Localization.lang("abbreviation detected"), entry, field)));
}
return messages;
}
}
}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Siedlerchr i expected checkstyle to complain here, but it's green. Maybe we need to add a rule.

Loading