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

Fixed #6472 that multiple background task popups stacked over each other #6475

Merged
merged 9 commits into from
May 31, 2020
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue where the Preferences entry preview will be unexpected modified leads to Value too long exception [#6198](https://github.com/JabRef/jabref/issues/6198)
- We fixed an issue where custom jstyles for Open/LibreOffice would only be valid if a layout line for the entry type `default` was at the end of the layout section [#6303](https://github.com/JabRef/jabref/issues/6303)
- We fixed an issue where long directory names created from patterns could create an exception. [#3915](https://github.com/JabRef/jabref/issues/3915)

- We fixed an issue where sort on numeric cases was broken. [#6349](https://github.com/JabRef/jabref/issues/6349)
- We fixed an issue where an "Not on FX thread" exception occured when saving on linux [#6453](https://github.com/JabRef/jabref/issues/6453)
- We fixed an issue where the library sort order was lost. [#6091](https://github.com/JabRef/jabref/issues/6091)
- We fixed an issue where brackets in regular expressions were not working. [6469](https://github.com/JabRef/jabref/pull/6469)
- We fixed an issue where multiple background task popups stacked over each other.. [#6472](https://github.com/JabRef/jabref/issues/6472)

### Removed

Expand Down
7 changes: 6 additions & 1 deletion src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ public class JabRefFrame extends BorderPane {
private SidePaneManager sidePaneManager;
private TabPane tabbedPane;
private SidePane sidePane;
private PopOver existedProgressViewPopOver; // Used to hide the existed pop over before a new pop over shows

public JabRefFrame(Stage mainStage) {
this.mainStage = mainStage;
Expand Down Expand Up @@ -988,10 +989,14 @@ hide it and clip it to a square of (width x width) each time width is updated.
taskProgressView.setGraphicFactory(BackgroundTask::getIcon);

PopOver progressViewPopOver = new PopOver(taskProgressView);
if (this.existedProgressViewPopOver == null) {
this.existedProgressViewPopOver = progressViewPopOver;
}
progressViewPopOver.setTitle(Localization.lang("Background Tasks"));
progressViewPopOver.setArrowLocation(PopOver.ArrowLocation.RIGHT_TOP);

this.existedProgressViewPopOver.hide();
Copy link
Member

Choose a reason for hiding this comment

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

Another option would be to reuse the existing pop over and only change the content. That is:

if (existedProgressViewPopOver == null) {
   existedProgressViewPopOver = new ...
} else {
   existedProgressViewPopOver.setContentNode(taskProgressView).
}

This should be a slightly better user experience as there is no flicker of hiding/showing a new pop over.

Then you can also rename the global variable to progressViewPopOver

Copy link
Member

Choose a reason for hiding this comment

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

In this context, it would be nice if the progress button serves as a toggle: if the pop over is currently shown, and the button is clicked again then the pop over should be hidden.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's great! I have made the change, it works.

progressViewPopOver.show(indicator);
this.existedProgressViewPopOver = progressViewPopOver;
});

return new Group(indicator);
Expand Down