From 6aad9c73ae7680f7c61eb0c237a1b211cdfa6cf8 Mon Sep 17 00:00:00 2001 From: Remco Bouckaert Date: Mon, 5 Sep 2022 08:05:49 +1200 Subject: [PATCH] towards fixing #5 --- build.xml | 2 +- src/beastfx/app/inputeditor/FastaImporter.java | 14 ++++++-------- src/beastfx/app/util/Alert.java | 10 +++++++++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/build.xml b/build.xml index 69b0a4c..97c55aa 100644 --- a/build.xml +++ b/build.xml @@ -28,7 +28,7 @@ - + diff --git a/src/beastfx/app/inputeditor/FastaImporter.java b/src/beastfx/app/inputeditor/FastaImporter.java index ddb6c22..8fcf0a6 100644 --- a/src/beastfx/app/inputeditor/FastaImporter.java +++ b/src/beastfx/app/inputeditor/FastaImporter.java @@ -134,14 +134,12 @@ public List loadFile(File file) { i++; } } - ComboBox jcb = new ComboBox<>(); - for (String s : new String[]{"aminoacid", "nucleotide", "all are aminoacid", "all are nucleotide"}) { - jcb.getItems().add(s); - } - jcb.setEditable(true); - jcb.setValue(datatype); - Alert.showMessageDialog(null, jcb, "Choose the datatype of alignment " + alignment.getID(), Alert.QUESTION_MESSAGE); - String selectedType = (String) jcb.getValue(); + String [] providers = new String[]{"aminoacid", "nucleotide", "all are aminoacid", "all are nucleotide"}; + String selectedType = (String) Alert.showInputDialog(null, "Choose the datatype of alignment " + alignment.getID(), + "Add partition", + Alert.QUESTION_MESSAGE, null, providers, + providers[0]); + switch (selectedType) { case "aminoacid": datatype = "aminoacid"; totalCount = 20; break; case "nucleotide": datatype = "nucleotide"; totalCount = 4; break; diff --git a/src/beastfx/app/util/Alert.java b/src/beastfx/app/util/Alert.java index ce5b11d..1ea1cef 100644 --- a/src/beastfx/app/util/Alert.java +++ b/src/beastfx/app/util/Alert.java @@ -9,6 +9,7 @@ import javax.swing.ImageIcon; import beast.base.core.BEASTInterface; +import beastfx.app.beauti.ThemeProvider; import javafx.embed.swing.SwingFXUtils; import javafx.geometry.Insets; import javafx.scene.Node; @@ -85,6 +86,7 @@ public static void showMessageDialog(Parent parent, String message) { alert.setX(node.getX() + node.getWidth()/2); alert.setY(node.getY() + node.getHeight()/2); } +// ThemeProvider.loadStyleSheet(alert.getDialogPane().getScene()); alert.showAndWait(); } @@ -98,6 +100,7 @@ public static ButtonType showConfirmDialog(Parent parent, String message, String alert.setX(node.getX() + node.getWidth()/2); alert.setY(node.getY() + node.getHeight()/2); } +// ThemeProvider.loadStyleSheet(alert.getDialogPane().getScene()); Optional option = alert.showAndWait(); return option.get(); } @@ -117,6 +120,7 @@ public static void showMessageDialog(Parent parent, String message, String heade alert.setX(node.getX() + node.getWidth()/2); alert.setY(node.getY() + node.getHeight()/2); } +// ThemeProvider.loadStyleSheet(alert.getDialogPane().getScene()); alert.showAndWait(); } @@ -169,6 +173,7 @@ public static void showMessageDialog(Parent parent, Node message, String header, pane.setPrefHeight(600); pane.setPrefWidth(600); alert.setResizable(true); +// ThemeProvider.loadStyleSheet(alert.getDialogPane().getScene()); alert.showAndWait(); } @@ -181,7 +186,9 @@ public static Object showInputDialog(Parent parent, } ChoiceDialog dlg = new ChoiceDialog<>(valueOf(initialSelectionValue), values); - dlg.setHeaderText(title); + dlg.setTitle(title); + dlg.setHeaderText(message.toString()); +// ThemeProvider.loadStyleSheet(dlg.getDialogPane().getScene()); Optional option = dlg.showAndWait(); if (parent != null) { Scene node = parent.getScene(); @@ -207,6 +214,7 @@ public static Object showInputDialog(Parent parent, Object message, String title, AlertType messageType, String initialSelectionValue) { TextInputDialog dlg = new TextInputDialog(initialSelectionValue); dlg.setHeaderText(title); +// ThemeProvider.loadStyleSheet(dlg.getDialogPane().getScene()); Optional option = dlg.showAndWait(); if (parent != null) { Scene node = parent.getScene();