diff --git a/src/beastfx/app/inputeditor/AVMNConnector.java b/src/beastfx/app/inputeditor/AVMNConnector.java index 65d62fc..12710a0 100644 --- a/src/beastfx/app/inputeditor/AVMNConnector.java +++ b/src/beastfx/app/inputeditor/AVMNConnector.java @@ -17,7 +17,7 @@ public class AVMNConnector { public static boolean customConnector(BeautiDoc doc) { - System.err.println("AVMNConnector::customConnector() called"); + // System.err.println("AVMNConnector::customConnector() called"); // count how many partitions have the a unique clock List partitions = doc.getPartitions("Partitions"); diff --git a/src/beastfx/app/inputeditor/AlignmentListInputEditor.java b/src/beastfx/app/inputeditor/AlignmentListInputEditor.java index 14cf3ac..1a882be 100644 --- a/src/beastfx/app/inputeditor/AlignmentListInputEditor.java +++ b/src/beastfx/app/inputeditor/AlignmentListInputEditor.java @@ -16,6 +16,9 @@ import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.event.EventHandler; +import javafx.geometry.Bounds; +import javafx.geometry.Point2D; +import javafx.scene.Parent; import javafx.scene.control.Button; import javafx.scene.control.ButtonType; import javafx.scene.control.ComboBox; @@ -169,7 +172,7 @@ public void handle(DragEvent event) { //scroller.setMinSize(doc.beauti.frame.getWidth(), doc.beauti.frame.getHeight()-155); BeautiPanel.resizeList.clear(); BeautiPanel.resizeList.add(table); - table.setMinWidth(1020); + //table.setMinWidth(1020); getChildren().add(pane); updateStatus(); } @@ -685,13 +688,23 @@ void initTableData() { } try { - if (!Double.isNaN(doc.beauti.frame.getWidth())) { - table.setMinSize(doc.beauti.frame.getWidth() - 20, doc.beauti.frame.getHeight()-160); - } else { - table.setMinSize(1024 - 20, 768 - 138); - } + +// Parent root = getScene().getRoot(); +// Bounds localRootBounds = root.getBoundsInLocal(); +// Point2D localRootTopLeft = new Point2D(localRootBounds.getMinX(), localRootBounds.getMinY()); +// Point2D screenRootTopLeft = root.localToScreen(localRootTopLeft); + + table.setMinSize(doc.beauti.frame.getWidth() - 12, doc.beauti.frame.getHeight() - 160); + // System.err.println("table.setMinSize(" + (doc.beauti.frame.getWidth()-12)+","+ (doc.beauti.frame.getHeight()-230) +")"); + +// if (!Double.isNaN(doc.beauti.frame.getWidth())) { +// table.setMinSize(doc.beauti.frame.getWidth() - 20, doc.beauti.frame.getHeight()-160); +// } else { +// table.setMinSize(1024 - 20, 768 - 138); +// } } catch (NullPointerException e) { // ignore + // System.err.println("table.setMinSize(1024 - 20, 768 - 138)"); table.setMinSize(1024 - 20, 768 - 138); } diff --git a/src/beastfx/app/inputeditor/BeautiPanel.java b/src/beastfx/app/inputeditor/BeautiPanel.java index 91fa8ff..b3d7850 100644 --- a/src/beastfx/app/inputeditor/BeautiPanel.java +++ b/src/beastfx/app/inputeditor/BeautiPanel.java @@ -213,8 +213,12 @@ private Node createList() { } public void updateList() { + List selected = null; if (listModel == null) { return; + } else { + selected = new ArrayList<>(); + selected.addAll(listOfPartitions.getSelectionModel().getSelectedIndices()); } listModel.clear(); if (listModel.size() > 0) { @@ -237,8 +241,15 @@ public void updateList() { } listModel.add(partitionID); } - if (partitionIndex >= 0 && listModel.size() > 0) - listOfPartitions.getSelectionModel().select(partitionIndex); + if (partitionIndex >= 0 && listModel.size() > 0) { + if (selected != null && selected.size() > 0) { + for (int index : selected) { + listOfPartitions.getSelectionModel().select(index); + } + } else { + listOfPartitions.getSelectionModel().select(partitionIndex); + } + } } diff --git a/src/beastfx/app/inputeditor/InputEditor.java b/src/beastfx/app/inputeditor/InputEditor.java index 93e370a..8bf65b8 100644 --- a/src/beastfx/app/inputeditor/InputEditor.java +++ b/src/beastfx/app/inputeditor/InputEditor.java @@ -458,7 +458,7 @@ protected void sync() { BeautiPanel panel = beauti.getCurrentPanel(); BeautiPanelConfig cfgPanel = panel.config; cfgPanel.sync(panel.partitionIndex); - // Platform.runLater(() -> beauti.refreshPanel()); + Platform.runLater(() -> beauti.refreshPanel()); } } } diff --git a/src/beastfx/app/inputeditor/SiteModelInputEditor.java b/src/beastfx/app/inputeditor/SiteModelInputEditor.java index ee140eb..fce536e 100644 --- a/src/beastfx/app/inputeditor/SiteModelInputEditor.java +++ b/src/beastfx/app/inputeditor/SiteModelInputEditor.java @@ -318,7 +318,7 @@ public static boolean customConnector(BeautiDoc doc) { } public static boolean avmnConnector(BeautiDoc doc) { - System.err.println("SiteModelInputEditor::avmnConnector() called"); + // System.err.println("SiteModelInputEditor::avmnConnector() called"); return AVMNConnector.customConnector(doc); } diff --git a/src/test/beastfx/app/beauti/BeautiBase.java b/src/test/beastfx/app/beauti/BeautiBase.java index d650887..54d80e6 100644 --- a/src/test/beastfx/app/beauti/BeautiBase.java +++ b/src/test/beastfx/app/beauti/BeautiBase.java @@ -611,13 +611,16 @@ protected FxRobot clickOnButtonWithText(FxRobot robot, String buttonText) { protected FxRobot clickOnNodesWithID(FxRobot robot, String id) { NodeQuery q = robot.lookup(target -> { - if (target.getId() != null) System.err.println(target.getId()); + // if (target.getId() != null) System.err.println(target.getId()); return id.equals(target.getId()) && target.isVisible(); }); Set nodes = q.queryAll(); - for (Node node : nodes) { - robot.clickOn(node); + if (nodes.size() > 0) { + robot.clickOn((Node)(nodes.toArray()[0])); } +// for (Node node : nodes) { +// robot.clickOn(node); +// } return robot; } diff --git a/src/test/beastfx/app/beauti/CloneTest.java b/src/test/beastfx/app/beauti/CloneTest.java index 07c1077..14760eb 100644 --- a/src/test/beastfx/app/beauti/CloneTest.java +++ b/src/test/beastfx/app/beauti/CloneTest.java @@ -99,6 +99,9 @@ public void simpleSiteModelCloneTest(FxRobot robot) throws Exception { // set category count back to 1 //beautiFrame.checkBox("shape.isEstimated").uncheck(); clickOnNodesWithID(robot, "shape.isEstimated"); + printBeautiState(); + assertStateEquals("Tree.t:3rdpos", "birthRate.t:3rdpos", "Tree.t:2ndpos", "birthRate.t:2ndpos", "Tree.t:noncoding", "birthRate.t:noncoding", "Tree.t:coding", "birthRate.t:coding", "Tree.t:1stpos", "birthRate.t:1stpos", "kappa.s:coding", "gammaShape.s:coding", "kappa.s:1stpos", "gammaShape.s:1stpos", "kappa.s:2ndpos", "gammaShape.s:2ndpos", "kappa.s:3rdpos", "gammaShape.s:3rdpos", "freqParameter.s:2ndpos", "freqParameter.s:3rdpos", "freqParameter.s:1stpos", "freqParameter.s:coding"); + robot.doubleClickOn("#gammaCategoryCount").write("1"); printBeautiState(); assertStateEquals("Tree.t:3rdpos", "birthRate.t:3rdpos", "Tree.t:2ndpos", "birthRate.t:2ndpos", "Tree.t:noncoding", "birthRate.t:noncoding", "Tree.t:coding", "birthRate.t:coding", "Tree.t:1stpos", "birthRate.t:1stpos", "kappa.s:coding", "gammaShape.s:coding", "kappa.s:1stpos", "gammaShape.s:1stpos", "kappa.s:2ndpos", "gammaShape.s:2ndpos", "kappa.s:3rdpos", "gammaShape.s:3rdpos", "freqParameter.s:2ndpos", "freqParameter.s:3rdpos", "freqParameter.s:1stpos", "freqParameter.s:coding"); @@ -149,10 +152,12 @@ public void simpleClockModelCloneTest(FxRobot robot) throws Exception { warning("1. Set the clock model of second partition to UCLD exponential"); selectTab(robot, "Clock Model"); // final ListView list = robot.lookup(".list-view").queryAs(ListView.class); - robot.clickOn("noncoding"); - robot.clickOn(".combo-box");//.clickOn("coding"); - robot.interact(()->robot.lookup(".combo-box").queryAs(ComboBox.class).getSelectionModel().select(1)); - robot.clickOn("Relaxed Clock Exponential"); + robot.clickOn(".list-view").clickOn("noncoding"); + +// robot.clickOn(".combo-box");//.clickOn("coding"); +// robot.interact(()->robot.lookup(".combo-box").queryAs(ComboBox.class).getSelectionModel().select(1)); + selectFromCombobox(robot, "indexComboBox", "Relaxed Clock Exponential"); + robot.clickOn(".list-view").clickOn("noncoding"); //robot.clickOn("Relaxed Clock Log Normal"); // Platform.runLater(()->list.getSelectionModel().select(1)); @@ -188,7 +193,7 @@ public void simpleClockModelCloneTest(FxRobot robot) throws Exception { list.getSelectionModel().clearAndSelect(2); }); // robot.clickOn(".combo-box").clickOn(".arrow-button").clickOn("Relaxed Clock Log Normal"); - robot.interact(()->robot.lookup(".combo-box").queryAs(ComboBox.class).getSelectionModel().select(2)); + robot.interact(()->robot.lookup(".combo-box").queryAs(ComboBox.class).getSelectionModel().select(3)); printBeautiState(); assertStateEquals("Tree.t:coding", "birthRate.t:coding", "clockRate.c:2ndpos", "ucedMean.c:noncoding", "expRateCategories.c:noncoding", "expRateCategories.c:coding", "ucedMean.c:3rdpos", "expRateCategories.c:3rdpos", "ucldMean.c:1stpos", "ucldStdev.c:1stpos", "rateCategories.c:1stpos"); assertOperatorsEqual("YuleBirthRateScaler.t:coding", "YuleModelBICEPSEpochTop.t:coding", "YuleModelBICEPSEpochAll.t:coding", "YuleModelBICEPSTreeFlex.t:coding", "YuleModelTreeRootScaler.t:coding", "YuleModelUniformOperator.t:coding", "YuleModelSubtreeSlide.t:coding", "YuleModelNarrow.t:coding", "YuleModelWide.t:coding", "YuleModelWilsonBalding.t:coding", "StrictClockRateScaler.c:2ndpos", "strictClockUpDownOperator.c:2ndpos", "ucedMeanScaler.c:noncoding", "ExpCategoriesRandomWalk.c:noncoding", "ExpCategoriesSwapOperator.c:noncoding", "ExpCategoriesUniform.c:noncoding", "relaxedUpDownOperatorExp.c:noncoding", "ExpCategoriesRandomWalk.c:coding", "ExpCategoriesSwapOperator.c:coding", "ExpCategoriesUniform.c:coding", "ucedMeanScaler.c:3rdpos", "ExpCategoriesRandomWalk.c:3rdpos", "ExpCategoriesSwapOperator.c:3rdpos", "ExpCategoriesUniform.c:3rdpos", "relaxedUpDownOperatorExp.c:3rdpos", "ucldMeanScaler.c:1stpos", "ucldStdevScaler.c:1stpos", "CategoriesRandomWalk.c:1stpos", "CategoriesSwapOperator.c:1stpos", "CategoriesUniform.c:1stpos", "relaxedUpDownOperator.c:1stpos");