Debian Codegraph @

src/dr/app/treespace/TreeSpaceApp.java

raw symbols SCIP
1 /*
2 * TreeSpaceApp.java
3 *
4 * Copyright (c) 2002-2015 Alexei Drummond, Andrew Rambaut and Marc Suchard
5 *
6 * This file is part of BEAST.
7 * See the NOTICE file distributed with this work for additional
8 * information regarding copyright ownership and licensing.
9 *
10 * BEAST is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as
12 * published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * BEAST is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with BEAST; if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23 * Boston, MA 02110-1301 USA
24 */
25
26 package dr.app.treespace;
27
28 import jam.framework.*;
29 import jam.mac.Utils;
30
31 import javax.swing.*;
32 import java.awt.*;
33 import java.io.File;
34
35 /**
36 * @author Andrew Rambaut
37 * @version $Id$
38 */
39 public class TreeSpaceApp extends MultiDocApplication {
40
41 public TreeSpaceApp(String nameString, String aboutString, Icon icon,
42 String websiteURLString, String helpURLString) {
43 super(new TreeSpaceMenuBarFactory(), nameString, aboutString, icon, websiteURLString, helpURLString);
44 }
45
46 /**
47 * In a departure from the standard UI, there is no "Open" command for this application
48 * This overriden method should never be called and throw a RuntimeException if it is.
49 *
50 * @return the action
51 */
52 public Action getOpenAction() {
53 throw new UnsupportedOperationException("getOpenAction is not supported");
54 }
55
56 // Main entry point
57 static public void main(String[] args) {
58
59 boolean lafLoaded = false;
60
61 if (Utils.isMacOSX()) {
62 System.setProperty("apple.awt.graphics.UseQuartz", "true");
63 System.setProperty("apple.awt.antialiasing","true");
64 System.setProperty("apple.awt.rendering","VALUE_RENDER_QUALITY");
65
66 System.setProperty("apple.laf.useScreenMenuBar","true");
67 System.setProperty("apple.awt.draggableWindowBackground","true");
68 System.setProperty("apple.awt.showGrowBox","true");
69
70 // set the Quaqua Look and Feel in the UIManager
71 try {
72 UIManager.setLookAndFeel(
73 "ch.randelshofer.quaqua.QuaquaLookAndFeel"
74 );
75 lafLoaded = true;
76
77
78 } catch (Exception e) {
79
80 }
81
82 UIManager.put("SystemFont", new Font("Lucida Grande", Font.PLAIN, 13));
83 UIManager.put("SmallSystemFont", new Font("Lucida Grande", Font.PLAIN, 11));
84 }
85
86 try {
87
88 if (!lafLoaded) {
89 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
90 }
91
92 java.net.URL url = TreeSpaceApp.class.getResource("images/phylogeography.png");
93 Icon icon = null;
94
95 if (url != null) {
96 icon = new ImageIcon(url);
97 }
98
99 final String nameString = "TreeSpace";
100 final String versionString = "v1.0";
101 String aboutString = "<html><div style=\"font-family:sans-serif;\"><center>" +
102 "<div style=\"font-size:12;\"><p>Phylogenetic Tree Space Exploration<br>" +
103 "Version " + versionString + ", 2009</p>" +
104 "<p>by Andrew Rambaut</p></div>" +
105 "</div></html>";
106
107 String websiteURLString = "http://beast.community";
108 String helpURLString = "http://beast.community/phylogeography";
109
110 TreeSpaceApp app = new TreeSpaceApp(nameString, aboutString, icon,
111 websiteURLString, helpURLString);
112 app.setDocumentFrameFactory(new DocumentFrameFactory() {
113 public DocumentFrame createDocumentFrame(final Application application, final MenuBarFactory menuBarFactory) {
114 return new TreeSpaceFrame(nameString);
115 }
116 });
117 app.initialize();
118 app.doNew();
119
120 if (args.length > 0) {
121 for (String fileName : args) {
122 ((TreeSpaceFrame)app.getUpperDocumentFrame()).importDataFile(new File(fileName));
123 }
124 }
125
126 } catch (Exception e) {
127 JOptionPane.showMessageDialog(new JFrame(), "Fatal exception: " + e,
128 "Please report this to the authors",
129 JOptionPane.ERROR_MESSAGE);
130 e.printStackTrace();
131 }
132
133 }
134
135 }