Skip to content

Commit

Permalink
Fix freezes in entry editor
Browse files Browse the repository at this point in the history
Fixes #4323 and probably fixes #4294 as well.
The reason for the freezes were the pull-request https://bitbucket.org/controlsfx/controlsfx/pull-requests/710. These changes mess up the layout for some reason. The fix is to inject a DecorationPane ourselves directly from the beginning. Although this fix started as a workaround for this bug in controlsfx, I think, we should keep it permanently for performance reasons.
  • Loading branch information
tobiasdiez committed Sep 18, 2018
1 parent e83680f commit a538d8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/main/java/org/jabref/JabRefGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.jabref.model.database.shared.DatabaseNotSupportedException;
import org.jabref.preferences.JabRefPreferences;

import impl.org.controlsfx.skin.DecorationPane;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -143,7 +144,12 @@ private void openWindow(Stage mainStage) {
mainStage.setHeight(Globals.prefs.getDouble(JabRefPreferences.SIZE_Y));
}

Scene scene = new Scene(JabRefGUI.mainFrame, 800, 800);
// We create a decoration pane ourselves for performance reasons
// (otherwise it has to be injected later, leading to a complete redraw/relayout of the complete scene)
DecorationPane root = new DecorationPane();
root.getChildren().add(JabRefGUI.mainFrame);

Scene scene = new Scene(root, 800, 800);
Globals.getThemeLoader().installBaseCss(scene, Globals.prefs);
mainStage.setTitle(JabRefFrame.FRAME_TITLE);
mainStage.getIcons().addAll(IconTheme.getLogoSetFX());
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/jabref/gui/fieldeditors/PersonsEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import javafx.scene.Parent;
import javafx.scene.control.TextInputControl;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;

import org.jabref.gui.autocompleter.AutoCompleteSuggestionProvider;
import org.jabref.gui.autocompleter.AutoCompletionTextInputBinding;
Expand All @@ -27,7 +26,7 @@ public PersonsEditor(final String fieldName,
textInput = isSingleLine
? new EditorTextField()
: new EditorTextArea();
HBox.setHgrow(textInput, Priority.ALWAYS);

textInput.textProperty().bindBidirectional(viewModel.textProperty());
((ContextMenuAddable) textInput).addToContextMenu(EditorMenus.getNameMenu(textInput));
this.getChildren().add(textInput);
Expand Down

0 comments on commit a538d8e

Please sign in to comment.