ArchaeopteryxInit is now static
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Fri, 13 Oct 2017 15:10:36 +0000 (16:10 +0100)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Fri, 13 Oct 2017 15:10:36 +0000 (16:10 +0100)
src/jalview/ext/archaeopteryx/ArchaeopteryxInit.java [moved from src/jalview/ext/archaeopteryx/ArchaeopteryxFrame.java with 63% similarity]
src/jalview/gui/CalculationChooser.java
test/jalview/ext/archaeopteryx/AptxTreeCreationTest.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;
+
   }
 
 
index 5466121..83445b4 100644 (file)
@@ -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);
 
 
 
index 8ae222b..764c21f 100644 (file)
@@ -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);
 
   }