-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Fixed preview not showing issue for an entry properly #4813
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,6 +177,7 @@ public BasePanel(JabRefFrame frame, BasePanelPreferences preferences, BibDatabas | |
setupMainPanel(); | ||
|
||
setupActions(); | ||
setPreviewOn(true); | ||
|
||
this.getDatabase().registerListener(new SearchListener()); | ||
this.getDatabase().registerListener(new EntryRemovedListener()); | ||
|
@@ -702,6 +703,7 @@ private void createMainTable() { | |
.ifPresent(entry -> { | ||
preview.setEntry(entry); | ||
entryEditor.setEntry(entry); | ||
setPreviewAction(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this change. Here we react to the user selecting a different entry. For me it is not clear why we need to show or hide the preview in this case (if it already shown, then we don't need to show it; and if it was not shown then it also shouldn't be shown just because the user selects a different entry). Can you please explain the reason for this change. Thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. `private void setPreviewAction() { It gets the current value of whether the preview panel is enabled or disabled. And if enabled the preview is shown. the setPreviewActive(enabled); method call is the part which is responsible for showing the preview and the panel in the UI (previous logic) ` private void setPreviewOn(Boolean previewOn) {
This method only sets the panel to be enabled. But it's not yet shown in the UI. since setPreviewActive(enabled); is not called in this method. Thus; At the beginning by calling setPreviewOn() method enables the preview panel (Not shown in the UI) and the when a row is clicked setPreviewAction() method is called and based on whether the panel is active or not (Panel can be disabled by clicking on the menu item) the preview is shown or not. |
||
})); | ||
|
||
// TODO: Register these actions globally | ||
|
@@ -1411,4 +1413,24 @@ public void action() { | |
preview.print(); | ||
} | ||
} | ||
|
||
private void setPreviewAction() { | ||
PreviewPreferences previewPreferences = Globals.prefs.getPreviewPreferences(); | ||
boolean enabled = previewPreferences.isPreviewPanelEnabled(); | ||
PreviewPreferences newPreviewPreferences = previewPreferences.getBuilder() | ||
.withPreviewPanelEnabled(enabled) | ||
.build(); | ||
Globals.prefs.storePreviewPreferences(newPreviewPreferences); | ||
setPreviewActive(enabled); | ||
} | ||
|
||
private void setPreviewOn(Boolean previewOn) { | ||
PreviewPreferences previewPreferences = Globals.prefs.getPreviewPreferences(); | ||
PreviewPreferences newPreviewPreferences = previewPreferences.getBuilder() | ||
.withPreviewPanelEnabled(previewOn) | ||
.build(); | ||
Globals.prefs.storePreviewPreferences(newPreviewPreferences); | ||
|
||
} | ||
|
||
} |
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.
Now the preview is always shown?
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 at the beginning only the preference is set to be true but it's not shown until a row is pressed. As per previous logic, the preview entry in menu is ticked when the program loads but it does not show any preview even a row is clicked.
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.
@tobiasdiez Any specific ideas about this?