moved Aptx creation from CalculationChooser to separate class
[jalview.git] / src / jalview / ext / archaeopteryx / ArchaeopteryxFrame.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 class ArchaeopteryxFrame
13 {
14
15   public static void createInstance(Phylogeny aptxTree)
16   {
17     new ArchaeopteryxFrame(aptxTree);
18
19   }
20
21   public static void createInstance(
22           TreeBuilder calculatedTree)
23   {
24     new ArchaeopteryxFrame(calculatedTree);
25
26   }
27
28   private ArchaeopteryxFrame(Phylogeny aptxTree)
29   {
30     MainFrame aptxApp = Archaeopteryx.createApplication(aptxTree);
31     start(aptxApp);
32
33   }
34
35   private ArchaeopteryxFrame(TreeBuilder calculatedTree)
36   {
37     ArchaeopteryxTreeBuilder aptxTreeBuilder = new ArchaeopteryxTreeBuilder();
38     Phylogeny aptxTree = aptxTreeBuilder.buildAptxTree(calculatedTree);
39     MainFrame aptxApp = Archaeopteryx.createApplication(aptxTree);
40     start(aptxApp);
41   }
42
43
44
45   public void start(MainFrame aptxApp)
46   {
47     int width = 400;
48     int height = 550;
49     aptxApp.setMinimumSize(new Dimension(width - 30, height - 50)); // doesn't
50                                                                     // work
51                                                                     // as it
52                                                                     // gets
53                                                                     // overridden
54                                                                     // during
55                                                                     // addInternalFrame?
56
57     Desktop.addInternalFrame(aptxApp, "Archaeopteryx Tree View", width,
58             height, true);
59
60   }
61
62
63 }