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

The Group Panel is not updated when switching between certain libraries #3142

Closed
bernhard-kleine opened this issue Aug 20, 2017 · 8 comments · Fixed by #5325
Closed

The Group Panel is not updated when switching between certain libraries #3142

bernhard-kleine opened this issue Aug 20, 2017 · 8 comments · Fixed by #5325
Labels
bug Confirmed bugs or reports that are very likely to be bugs groups

Comments

@bernhard-kleine
Copy link

bernhard-kleine commented Aug 20, 2017

JabRef 4.0-beta3
Windows 7 6.1 amd64
Java 1.8.0_131

Steps to reproduce:

  1. open Jabref with multiple libraries
  2. switch between the libraries
  3. the updating of the Group Panel is extremely slow and not always correct-

I have the following screenshots to show that behaviour: when I switch from chapter04.bib to EndokrinologieKunde20170513VS4.0.0.bib and vice versa the group panel is not updated, while switching to FatMetabolism20170608VS4.0.0.bib it is updated and then back to either chapter04.bib or EndokrinologieKunde... it is. Chapter04 has 275 entries, FatMetabolism has 900 and Endokrinologiekunde has 1991 entries
grafik
grafik
grafik

Log File
Paste an excerpt of your log file here
@lenhard
Copy link
Member

lenhard commented Aug 20, 2017

Refs #2690

@lenhard lenhard added groups bug Confirmed bugs or reports that are very likely to be bugs labels Aug 20, 2017
@lenhard
Copy link
Member

lenhard commented Aug 28, 2017

This can be reproduced in the following way:

  • Start JabRef with two bib files and the the groups side pane open
  • Create a new database
  • JabRef will switch to the new database, but the groups side pane will display the tree of the last selected database

If tracked the problem down to this part:

synchronized (getTreeLock()) {
validateTree();
}

Here the groups side pane should repaint, but the JFXPanel does not necessarily do that. The only way I found (and I tried many ways) to force it was by re-creating the completed pane, i.e. by putting this code into the conditional:

            StackPane root = new StackPane();
            root.getChildren().addAll(new GroupTreeView().getView());
            Scene scene = new Scene(root);
            groupsPane.setScene(scene);

But that leads to an ugly flicker in the UI. Resetting the scene with a newly created instance is the key. Without that, no change happens.

@tobiasdiez How can I force the groupsPane to refresh without having to rebuild all its contents? There has to be some way to do this.

@tobiasdiez
Copy link
Member

tobiasdiez commented Sep 11, 2017

@lenhard I cannot reproduce the issue with the steps you describe with the latest master. For me, an empty groups tree is displayed for the new database.

Codewise, it (should) work as follows: The statemanager is notified about the new database

Platform.runLater(() ->
Globals.stateManager.activeDatabaseProperty().setValue(Optional.of(currentBasePanel.getBibDatabaseContext()))
);

and propagates the event to the group tree view
stateManager.activeDatabaseProperty()
.addListener((observable, oldValue, newValue) -> onActiveDatabaseChanged(newValue));

There the tree is updated,

which triggers a repaint of the tree due to the binding
groupTree.rootProperty().bind(
EasyBind.map(viewModel.rootGroupProperty(),
group -> new RecursiveTreeItem<>(
group,
GroupNodeViewModel::getChildren,
GroupNodeViewModel::expandedProperty,
viewModel.filterPredicateProperty())));

@lenhard
Copy link
Member

lenhard commented Sep 11, 2017

@tobiasdiez Hm, you use Win10, right? if you cannot reproduce this, maybe the problem is related to Win7. Because for me it is no problem to reproduce and I have the same setting as @bernhard-kleine

We might need more help tracking this down from other people that use different settings.

@tobiasdiez
Copy link
Member

Yes, I'm on Win10. Can you please verify that

private void onActiveDatabaseChanged(Optional<BibDatabaseContext> newDatabase) {
is invoked (with the proper empty database as argument), when you create a new database.

@lenhard
Copy link
Member

lenhard commented Sep 12, 2017

I debugged this and the method is invoked with the empty database. This is the case for BibTeX and biblatex, but unfortunately the group tree doesn't get updated properly.

@stefan-kolb
Copy link
Member

Can reproduce exactly as described by Jörg (maybe you need to switch between the bibs a bit):
image
image

@tobiasdiez
Copy link
Member

This should be fixed in the latest development version. Could you please check the build from http://builds.jabref.org/master/. Thanks! Please remember to make a backup of your library before trying-out this version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs groups
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants