From 66094f0aac284f26dba5ca4569381f44f442abc5 Mon Sep 17 00:00:00 2001 From: Tobias Diez Date: Wed, 18 Jul 2018 15:13:28 +0200 Subject: [PATCH 001/229] Add style tester app --- src/main/java/org/jabref/JabRefGUI.java | 2 +- .../jabref/gui/customjfx/CustomJFXPanel.java | 2 +- .../java/org/jabref/gui/util/BaseDialog.java | 2 +- .../java/org/jabref/gui/util/ThemeLoader.java | 6 +- .../org/jabref/styletester/StyleTester.fxml | 312 ++++++++++++++++++ .../jabref/styletester/StyleTesterMain.java | 29 ++ .../jabref/styletester/StyleTesterView.java | 19 ++ 7 files changed, 366 insertions(+), 6 deletions(-) create mode 100644 src/main/java/org/jabref/styletester/StyleTester.fxml create mode 100644 src/main/java/org/jabref/styletester/StyleTesterMain.java create mode 100644 src/main/java/org/jabref/styletester/StyleTesterView.java diff --git a/src/main/java/org/jabref/JabRefGUI.java b/src/main/java/org/jabref/JabRefGUI.java index f6074c34725..dc03333b7bf 100644 --- a/src/main/java/org/jabref/JabRefGUI.java +++ b/src/main/java/org/jabref/JabRefGUI.java @@ -150,7 +150,7 @@ private void openWindow(Stage mainStage) { } Scene scene = new Scene(JabRefGUI.mainFrame, 800, 800); - Globals.getThemeLoader().installBaseCss(scene); + Globals.getThemeLoader().installBaseCss(scene, Globals.prefs); mainStage.setTitle(JabRefFrame.FRAME_TITLE); mainStage.getIcons().addAll(IconTheme.getLogoSetFX()); mainStage.setScene(scene); diff --git a/src/main/java/org/jabref/gui/customjfx/CustomJFXPanel.java b/src/main/java/org/jabref/gui/customjfx/CustomJFXPanel.java index 1cb3e07b106..5cdafa593ce 100644 --- a/src/main/java/org/jabref/gui/customjfx/CustomJFXPanel.java +++ b/src/main/java/org/jabref/gui/customjfx/CustomJFXPanel.java @@ -13,7 +13,7 @@ public class CustomJFXPanel { public static JFXPanel wrap(Scene scene) { JFXPanel container = new JFXPanel(); - Globals.getThemeLoader().installBaseCss(scene); + Globals.getThemeLoader().installBaseCss(scene, Globals.prefs); DefaultTaskExecutor.runInJavaFXThread(() -> container.setScene(scene)); return container; } diff --git a/src/main/java/org/jabref/gui/util/BaseDialog.java b/src/main/java/org/jabref/gui/util/BaseDialog.java index 98bb1f7ae15..73c157838df 100644 --- a/src/main/java/org/jabref/gui/util/BaseDialog.java +++ b/src/main/java/org/jabref/gui/util/BaseDialog.java @@ -21,7 +21,7 @@ protected BaseDialog() { setDialogIcon(IconTheme.getJabRefImageFX()); - Globals.getThemeLoader().installBaseCss(getDialogPane().getScene()); + Globals.getThemeLoader().installBaseCss(getDialogPane().getScene(), Globals.prefs); } private void setDialogIcon(Image image) { diff --git a/src/main/java/org/jabref/gui/util/ThemeLoader.java b/src/main/java/org/jabref/gui/util/ThemeLoader.java index 208b808ec31..31295289a14 100644 --- a/src/main/java/org/jabref/gui/util/ThemeLoader.java +++ b/src/main/java/org/jabref/gui/util/ThemeLoader.java @@ -11,10 +11,10 @@ import javafx.scene.Parent; import javafx.scene.Scene; -import org.jabref.Globals; import org.jabref.gui.JabRefFrame; import org.jabref.model.strings.StringUtil; import org.jabref.model.util.FileUpdateMonitor; +import org.jabref.preferences.JabRefPreferences; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,7 +49,7 @@ public ThemeLoader(FileUpdateMonitor fileUpdateMonitor) { * Installs the base css file as a stylesheet in the given scene. * Changes in the css file lead to a redraw of the scene using the new css file. */ - public void installBaseCss(Scene scene) { + public void installBaseCss(Scene scene, JabRefPreferences preferences) { addAndWatchForChanges(scene, DEFAULT_PATH_MAIN_CSS, 0); if (StringUtil.isNotBlank(CSS_SYSTEM_PROPERTY)) { @@ -60,7 +60,7 @@ public void installBaseCss(Scene scene) { } } - Globals.prefs.getFontSize().ifPresent(size -> scene.getRoot().setStyle("-fx-font-size: " + size + "pt;")); + preferences.getFontSize().ifPresent(size -> scene.getRoot().setStyle("-fx-font-size: " + size + "pt;")); } private void addAndWatchForChanges(Scene scene, String cssUrl, int index) { diff --git a/src/main/java/org/jabref/styletester/StyleTester.fxml b/src/main/java/org/jabref/styletester/StyleTester.fxml new file mode 100644 index 00000000000..abdc7415893 --- /dev/null +++ b/src/main/java/org/jabref/styletester/StyleTester.fxml @@ -0,0 +1,312 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +