From 7f2bb99cee53626f577b3f350137a6e6ea8cc5f6 Mon Sep 17 00:00:00 2001 From: kjvdheide Date: Fri, 13 Oct 2017 16:10:36 +0100 Subject: [PATCH] ArchaeopteryxInit is now static --- ...haeopteryxFrame.java => ArchaeopteryxInit.java} | 26 ++++++++++---------- src/jalview/gui/CalculationChooser.java | 4 +-- .../ext/archaeopteryx/AptxTreeCreationTest.java | 3 ++- 3 files changed, 17 insertions(+), 16 deletions(-) rename src/jalview/ext/archaeopteryx/{ArchaeopteryxFrame.java => ArchaeopteryxInit.java} (63%) diff --git a/src/jalview/ext/archaeopteryx/ArchaeopteryxFrame.java b/src/jalview/ext/archaeopteryx/ArchaeopteryxInit.java similarity index 63% rename from src/jalview/ext/archaeopteryx/ArchaeopteryxFrame.java rename to src/jalview/ext/archaeopteryx/ArchaeopteryxInit.java index 64750ad..8302140 100644 --- a/src/jalview/ext/archaeopteryx/ArchaeopteryxFrame.java +++ b/src/jalview/ext/archaeopteryx/ArchaeopteryxInit.java @@ -9,23 +9,23 @@ import org.forester.archaeopteryx.Archaeopteryx; import org.forester.archaeopteryx.MainFrame; import org.forester.phylogeny.Phylogeny; -public class ArchaeopteryxFrame +public final class ArchaeopteryxInit { - public static ArchaeopteryxFrame createInstance(Phylogeny[] aptxTrees) + public static MainFrame createInstance(Phylogeny[] aptxTrees) { - return new ArchaeopteryxFrame(aptxTrees); + return createAptxFrame(aptxTrees); } - public static ArchaeopteryxFrame createInstance(Phylogeny aptxTree) + public static MainFrame createInstance(Phylogeny aptxTree) { Phylogeny[] aptxTrees = { aptxTree }; // future possibility to load in // several trees simultaneously - return new ArchaeopteryxFrame(aptxTrees); + return createAptxFrame(aptxTrees); } - public static ArchaeopteryxFrame createInstance( + public static MainFrame createInstance( TreeBuilder calculatedTree) { ArchaeopteryxTreeBuilder aptxTreeBuilder = new ArchaeopteryxTreeBuilder(); @@ -33,23 +33,21 @@ public class ArchaeopteryxFrame Phylogeny[] aptxTrees = { aptxTree }; // future possibility to load in // several trees simultaneously - return new ArchaeopteryxFrame(aptxTrees); + return createAptxFrame(aptxTrees); } - private ArchaeopteryxFrame(Phylogeny[] aptxTrees) + private static MainFrame createAptxFrame(Phylogeny[] aptxTrees) { MainFrame aptxApp = Archaeopteryx.createApplication(aptxTrees, "_aptx_jalview_configuration_file", null); - bindFrameToJalview(aptxApp); - + return bindFrameToJalview(aptxApp); } - // public so that, should an Aptx main frame ever get created outside this - // class, it can be bound to jalview anyway - public void bindFrameToJalview(MainFrame aptxApp) + + private static MainFrame bindFrameToJalview(MainFrame aptxApp) { int width = 400; int height = 550; @@ -58,6 +56,8 @@ public class ArchaeopteryxFrame Desktop.addInternalFrame(aptxApp, "Archaeopteryx Tree View", true, width, height, true, true); + return aptxApp; + } diff --git a/src/jalview/gui/CalculationChooser.java b/src/jalview/gui/CalculationChooser.java index 5466121..83445b4 100644 --- a/src/jalview/gui/CalculationChooser.java +++ b/src/jalview/gui/CalculationChooser.java @@ -28,7 +28,7 @@ import jalview.analysis.scoremodels.SimilarityParams; import jalview.api.analysis.ScoreModelI; import jalview.api.analysis.SimilarityParamsI; import jalview.datamodel.SequenceGroup; -import jalview.ext.archaeopteryx.ArchaeopteryxFrame; +import jalview.ext.archaeopteryx.ArchaeopteryxInit; import jalview.util.MessageManager; import java.awt.BorderLayout; @@ -481,7 +481,7 @@ public class CalculationChooser extends JPanel TreeModel tree = new TreeModel(calculatedTree); openTreePanel(tree, treeAlgo, substitutionMatrix); - ArchaeopteryxFrame.createInstance(calculatedTree); + ArchaeopteryxInit.createInstance(calculatedTree); diff --git a/test/jalview/ext/archaeopteryx/AptxTreeCreationTest.java b/test/jalview/ext/archaeopteryx/AptxTreeCreationTest.java index 8ae222b..764c21f 100644 --- a/test/jalview/ext/archaeopteryx/AptxTreeCreationTest.java +++ b/test/jalview/ext/archaeopteryx/AptxTreeCreationTest.java @@ -2,6 +2,7 @@ package jalview.ext.archaeopteryx; import jalview.gui.JvOptionPane; +import org.forester.archaeopteryx.MainFrame; import org.forester.phylogeny.Phylogeny; import org.forester.phylogeny.PhylogenyNode; import org.testng.annotations.BeforeClass; @@ -53,7 +54,7 @@ public class AptxTreeCreationTest @Test(groups = "Functional") public void testShowingTree() { - ArchaeopteryxFrame.createInstance(phy); + MainFrame aptx = ArchaeopteryxInit.createInstance(phy); } -- 1.7.10.2