ArchaeopteryxInit is now static
[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 createAptxFrame(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 createAptxFrame(aptxTrees);
25
26   }
27
28   public static MainFrame createInstance(
29           TreeBuilder calculatedTree)
30   {
31     ArchaeopteryxTreeBuilder aptxTreeBuilder = new ArchaeopteryxTreeBuilder();
32     Phylogeny aptxTree = aptxTreeBuilder.buildAptxTree(calculatedTree);
33     Phylogeny[] aptxTrees = { aptxTree }; // future possibility to load in
34                                           // several trees simultaneously
35
36     return createAptxFrame(aptxTrees);
37
38   }
39
40
41   private static MainFrame createAptxFrame(Phylogeny[] aptxTrees)
42   {
43     MainFrame aptxApp = Archaeopteryx.createApplication(aptxTrees,
44             "_aptx_jalview_configuration_file", null);
45     return bindFrameToJalview(aptxApp);
46   }
47
48
49
50   private static MainFrame bindFrameToJalview(MainFrame aptxApp)
51   {
52     int width = 400;
53     int height = 550;
54     aptxApp.setMinimumSize(new Dimension(width, height));
55
56     Desktop.addInternalFrame(aptxApp, "Archaeopteryx Tree View", true,
57             width, height, true, true);
58
59     return aptxApp;
60
61   }
62
63
64 }