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

Remember Sidepane width after restart #8936

Merged
merged 20 commits into from
Jul 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue where the exception that there are invalid characters in filename. [#8786](https://github.com/JabRef/jabref/issues/8786)
- When the proxy configuration removed the proxy user/password, this change is applied immediately.
- We fixed an issue where removing several groups deletes only one of them. [#8390](https://github.com/JabRef/jabref/issues/8390)
- We fixed an issue where the Sidepane(groups, web search and open office) width is not remembered after restarting JabRef. [#8907](https://github.com/JabRef/jabref/issues/8907)
- We fixed a bug where switching between themes will cause an error/exception. [#8939](https://github.com/JabRef/jabref/pull/8939)

### Removed
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,10 @@ private void initLayout() {
@Override
public void invalidated(Observable observable) {
if (mainStage.isShowing()) {
setDividerPosition();
observable.removeListener(this);
Platform.runLater(() -> {
setDividerPosition();
observable.removeListener(this);
});
}
}
});
Expand All @@ -472,10 +474,9 @@ private void updateSidePane() {
}

private void setDividerPosition() {
splitPane.setDividerPositions(prefs.getGuiPreferences().getSidePaneWidth());
if (mainStage.isShowing() && !sidePane.getChildren().isEmpty()) {
dividerSubscription = EasyBind.subscribe(splitPane.getDividers().get(0).positionProperty(),
position -> prefs.getGuiPreferences().setSidePaneWidth(position.doubleValue()));
splitPane.setDividerPositions(prefs.getGuiPreferences().getSidePaneWidth() / splitPane.getWidth());
dividerSubscription = EasyBind.subscribe(sidePane.widthProperty(), width -> prefs.getGuiPreferences().setSidePaneWidth(width.doubleValue()));
}
}

Expand Down