From 534fefe878109afcb92db55d8556cf9c55976c58 Mon Sep 17 00:00:00 2001 From: Houssem Nasri Date: Thu, 30 Jun 2022 12:22:46 +0100 Subject: [PATCH 1/6] Remove installCss(dialogScene) from dialogs because JavaFX already handle that - If we update dialog stylesheet ourselves than we're breaking the binding made by JavaFX and thus unexpected behaviours may/will happen --- src/main/java/org/jabref/gui/JabRefDialogService.java | 10 ---------- src/main/java/org/jabref/gui/util/BaseDialog.java | 4 ---- 2 files changed, 14 deletions(-) diff --git a/src/main/java/org/jabref/gui/JabRefDialogService.java b/src/main/java/org/jabref/gui/JabRefDialogService.java index 3f50cfd8616..d21e0b3b9d9 100644 --- a/src/main/java/org/jabref/gui/JabRefDialogService.java +++ b/src/main/java/org/jabref/gui/JabRefDialogService.java @@ -80,7 +80,6 @@ public JabRefDialogService(Window mainWindow, Pane mainPane, ThemeManager themeM private FXDialog createDialog(AlertType type, String title, String content) { FXDialog alert = new FXDialog(type, title, true); - themeManager.installCss(alert.getDialogPane().getScene()); alert.setHeaderText(null); alert.setContentText(content); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); @@ -113,7 +112,6 @@ protected Node createDetailsButton() { // Reset the dialog graphic using the default style alert.getDialogPane().setGraphic(graphic); - themeManager.installCss(alert.getDialogPane().getScene()); alert.setHeaderText(null); alert.setContentText(content); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); @@ -138,7 +136,6 @@ public Optional showChoiceDialogAndWait(String title, String content, Str choiceDialog.setTitle(title); choiceDialog.setContentText(content); choiceDialog.initOwner(mainWindow); - themeManager.installCss(choiceDialog.getDialogPane().getScene()); return choiceDialog.showAndWait(); } @@ -148,7 +145,6 @@ public Optional showInputDialogAndWait(String title, String content) { inputDialog.setHeaderText(title); inputDialog.setContentText(content); inputDialog.initOwner(mainWindow); - themeManager.installCss(inputDialog.getDialogPane().getScene()); return inputDialog.showAndWait(); } @@ -158,7 +154,6 @@ public Optional showInputDialogWithDefaultAndWait(String title, String c inputDialog.setHeaderText(title); inputDialog.setContentText(content); inputDialog.initOwner(mainWindow); - themeManager.installCss(inputDialog.getDialogPane().getScene()); return inputDialog.showAndWait(); } @@ -186,7 +181,6 @@ public void showErrorDialogAndWait(String message, Throwable exception) { exceptionDialog.getDialogPane().setMaxWidth(mainWindow.getWidth() / 2); exceptionDialog.setHeaderText(message); exceptionDialog.initOwner(mainWindow); - themeManager.installCss(exceptionDialog.getDialogPane().getScene()); exceptionDialog.showAndWait(); } @@ -196,7 +190,6 @@ public void showErrorDialogAndWait(String title, String content, Throwable excep exceptionDialog.setHeaderText(title); exceptionDialog.setContentText(content); exceptionDialog.initOwner(mainWindow); - themeManager.installCss(exceptionDialog.getDialogPane().getScene()); exceptionDialog.showAndWait(); } @@ -266,7 +259,6 @@ public Optional showCustomDialogAndWait(String title, DialogPane con alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); alert.setResizable(true); alert.initOwner(mainWindow); - themeManager.installCss(alert.getDialogPane().getScene()); return alert.showAndWait(); } @@ -294,7 +286,6 @@ public void showProgressDialog(String title, String content, Task task) { task.cancel(); progressDialog.close(); }); - themeManager.installCss(progressDialog.getDialogPane().getScene()); progressDialog.initOwner(mainWindow); progressDialog.show(); } @@ -319,7 +310,6 @@ public Optional showBackgroundProgressDialogAndWait(String title alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); alert.setResizable(true); alert.initOwner(mainWindow); - themeManager.installCss(alert.getDialogPane().getScene()); stateManager.getAnyTasksThatWillNotBeRecoveredRunning().addListener((observable, oldValue, newValue) -> { if (!newValue) { diff --git a/src/main/java/org/jabref/gui/util/BaseDialog.java b/src/main/java/org/jabref/gui/util/BaseDialog.java index 8879f9b7f5c..28952d94e58 100644 --- a/src/main/java/org/jabref/gui/util/BaseDialog.java +++ b/src/main/java/org/jabref/gui/util/BaseDialog.java @@ -39,10 +39,6 @@ protected BaseDialog() { setDialogIcon(IconTheme.getJabRefImage()); setResizable(true); - - EasyBind.wrapNullable(dialogPaneProperty()) - .mapObservable(Node::sceneProperty) - .subscribeToValues(scene -> Globals.getThemeManager().installCss(scene)); } private Optional