Added TreeBuilder as parameter to the converter constructor
[jalview.git] / src / jalview / ext / archaeopteryx / ArchaeopteryxInit.java
1 package jalview.ext.archaeopteryx;
2
3 import jalview.analysis.TreeBuilder;
4 import jalview.gui.Desktop;
5
6 import java.awt.Dimension;
7
8 import org.forester.archaeopteryx.Archaeopteryx;
9 import org.forester.archaeopteryx.MainFrame;
10 import org.forester.phylogeny.Phylogeny;
11
12 public final class ArchaeopteryxInit
13 {
14   public static MainFrame createInstance(Phylogeny[] aptxTrees)
15   {
16     return createBoundAptxFrame(aptxTrees);
17
18   }
19
20   public static MainFrame createInstance(Phylogeny aptxTree)
21   {
22     Phylogeny[] aptxTrees = { aptxTree }; // future possibility to load in
23     // several trees simultaneously
24     return createBoundAptxFrame(aptxTrees);
25
26   }
27
28   public static MainFrame createInstance(
29           TreeBuilder calculatedTree)
30   {
31     ArchaeopteryxTreeConverter aptxTreeBuilder = new ArchaeopteryxTreeConverter(
32             calculatedTree);
33     Phylogeny aptxTree = aptxTreeBuilder.buildAptxTree();
34     Phylogeny[] aptxTrees = { aptxTree }; // future possibility to load in
35                                           // several trees simultaneously
36
37     return createBoundAptxFrame(aptxTrees);
38
39   }
40
41
42   private static MainFrame createBoundAptxFrame(Phylogeny[] aptxTrees)
43   {
44     MainFrame aptxApp = Archaeopteryx.createApplication(aptxTrees,
45             "_aptx_jalview_configuration_file", null);
46     return bindFrameToJalview(aptxApp);
47   }
48
49
50
51   private static MainFrame bindFrameToJalview(MainFrame aptxApp)
52   {
53     int width = 400;
54     int height = 550;
55     aptxApp.setMinimumSize(new Dimension(width, height));
56
57     Desktop.addInternalFrame(aptxApp, "Archaeopteryx Tree View", true,
58             width, height, true, true);
59
60     return aptxApp;
61
62   }
63
64
65 }