-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Add tooltip for cell content and entries' preview in Main Table #11176
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
932491d
add checkbox for showing entry preview in main table
azatyamanaev 93e78dd
add mouse enter event to set tooltip for main table columns
azatyamanaev db837c1
update CHANGELOG
azatyamanaev 5c625c1
add empty line before entry preview in main table tooltip
azatyamanaev 9290706
add empty line only when entry's preview is shown
azatyamanaev 04774cc
add ThemeManager as constructor parameter
azatyamanaev 0bf0aab
Revert "add ThemeManager as constructor parameter"
azatyamanaev 16ab52b
implement temporary solution for ThemeManager injection
azatyamanaev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/main/java/org/jabref/gui/maintable/MainTableTooltip.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.jabref.gui.maintable; | ||
|
||
import javafx.scene.control.Label; | ||
import javafx.scene.control.Tooltip; | ||
import javafx.scene.layout.VBox; | ||
import javafx.util.Duration; | ||
|
||
import org.jabref.gui.DialogService; | ||
import org.jabref.gui.StateManager; | ||
import org.jabref.gui.preview.PreviewViewer; | ||
import org.jabref.gui.theme.ThemeManager; | ||
import org.jabref.gui.util.TaskExecutor; | ||
import org.jabref.model.database.BibDatabaseContext; | ||
import org.jabref.model.entry.BibEntry; | ||
import org.jabref.preferences.PreferencesService; | ||
|
||
public class MainTableTooltip extends Tooltip { | ||
|
||
private final PreviewViewer preview; | ||
private final PreferencesService preferences; | ||
|
||
public MainTableTooltip(BibDatabaseContext databaseContext, DialogService dialogService, PreferencesService preferences, | ||
StateManager stateManager, ThemeManager themeManager, TaskExecutor taskExecutor) { | ||
|
||
this.preferences = preferences; | ||
this.preview = new PreviewViewer(databaseContext, dialogService, preferences, stateManager, themeManager, taskExecutor); | ||
} | ||
|
||
public Tooltip createTooltip(BibEntry entry, String fieldValue) { | ||
preview.setLayout(preferences.getPreviewPreferences().getSelectedPreviewLayout()); | ||
preview.setEntry(entry); | ||
this.setShowDelay(Duration.seconds(1)); | ||
Label label = new Label(fieldValue + "\n "); | ||
|
||
if (preferences.getPreviewPreferences().shouldShowPreviewEntryTableTooltip()) { | ||
VBox vBox = new VBox(); | ||
vBox.getChildren().add(label); | ||
vBox.getChildren().add(preview); | ||
this.setGraphic(vBox); | ||
} else { | ||
this.setGraphic(label); | ||
} | ||
return this; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pleas pass the ThemeManager via constructor (Dependency Inversion Principle)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Siedlerchr This entails adding ThemeManager as a constructor parameter for dozen other classes. Should I still do it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I know this sounds crazy but we don't have really any good dependency injection.
But most of the calling classes should already have the theme manager, so I hope it's only a handful of classes that need ajustment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Siedlerchr I think it's 17 files
commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is a temporary solution until we have a proper di solution.