Debian Codegraph @

src/dr/app/mapper/application/MapperApp.java

raw symbols SCIP
1 /*
2 * MapperApp.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.mapper.application;
27
28 import dr.app.mapper.application.menus.MapperMenuBarFactory;
29 import dr.app.util.OSType;
30 import dr.util.Version;
31 import jam.framework.*;
32
33 import javax.swing.*;
34 import java.awt.*;
35 import java.io.File;
36 import java.util.Locale;
37
38 /**
39 * @author Andrew Rambaut
40 * @version $Id$
41 */
42 public class MapperApp extends MultiDocApplication {
43 private final static Version version = new Version() {
44 private static final String VERSION = "1.0pre";
45
46 public String getVersion() {
47 return VERSION;
48 }
49
50 public String getVersionString() {
51 return "v" + VERSION;
52 }
53
54 public String getDateString() {
55 return "2013";
56 }
57
58 public String getBuildString() {
59 return "Build r3656";
60 }
61
62 public String[] getCredits() {
63 return new String[0];
64 }
65
66 public String getHTMLCredits() {
67 return "<p>by<br>" +
68 "Andrew Rambaut, Trevor Bedford & Marc A. Suchard</p>" +
69 "<p>Institute of Evolutionary Biology, University of Edinburgh<br>" +
70 "<a href=\"mailto:[email protected]\">[email protected]</a>, <a href=\"mailto:[email protected]\">[email protected]</a></p>" +
71
72 "<p>Departments of Biomathematics, Biostatistics and Human Genetics, UCLA<br>" +
73 "<a href=\"mailto:[email protected]\">[email protected]</a></p>" +
74
75 "<p>Part of the BEAST package:<br>" +
76 "<a href=\"http://beast.community\">http://beast.community</a></p>";
77 }
78
79 };
80
81
82 public MapperApp(String nameString, String aboutString, Icon icon,
83 String websiteURLString, String helpURLString) {
84 super(new MapperMenuBarFactory(), nameString, aboutString, icon, websiteURLString, helpURLString);
85
86 addPreferencesSection(new GeneralPreferencesSection());
87 }
88
89 // Main entry point
90 static public void main(String[] args) {
91 // There is a major issue with languages that use the comma as a decimal separator.
92 // To ensure compatibility between programs in the package, enforce the US locale.
93 Locale.setDefault(Locale.US);
94
95 boolean lafLoaded = false;
96
97 if (OSType.isMac()) {
98 System.setProperty("apple.awt.graphics.UseQuartz", "true");
99 System.setProperty("apple.awt.antialiasing","true");
100 System.setProperty("apple.awt.rendering","VALUE_RENDER_QUALITY");
101
102 System.setProperty("apple.laf.useScreenMenuBar","true");
103 System.setProperty("apple.awt.draggableWindowBackground","true");
104 System.setProperty("apple.awt.showGrowBox","true");
105
106 // set the Quaqua Look and Feel in the UIManager
107 try {
108 UIManager.setLookAndFeel(
109 "ch.randelshofer.quaqua.QuaquaLookAndFeel"
110 );
111 lafLoaded = true;
112
113
114 } catch (Exception e) {
115 //
116 }
117
118 UIManager.put("SystemFont", new Font("Lucida Grande", Font.PLAIN, 13));
119 UIManager.put("SmallSystemFont", new Font("Lucida Grande", Font.PLAIN, 11));
120 }
121
122 if (!lafLoaded) {
123 try {
124 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
125 } catch (Exception e1) {
126 e1.printStackTrace();
127 }
128 }
129
130 try {
131 java.net.URL url = MapperApp.class.getResource("images/Mapper.png");
132 Icon icon = null;
133
134 if (url != null) {
135 icon = new ImageIcon(url);
136 }
137
138 final String nameString = "Mapper";
139 final String versionString = version.getVersionString();
140 String aboutString = "<html><center><p>Antigenic Mapping Investigation Tool<br>" +
141 "Version " + versionString + ", " + version.getDateString() + "</p>" +
142 version.getHTMLCredits() +
143 "</center></html>";
144
145 String websiteURLString = "http://tree.bio.ed.ac.uk/";
146 String helpURLString = "http://tree.bio.ed.ac.uk/software/mapper";
147
148 MapperApp app = new MapperApp(nameString, aboutString, icon, websiteURLString, helpURLString);
149 app.setDocumentFrameFactory(new DocumentFrameFactory() {
150 public DocumentFrame createDocumentFrame(Application app, MenuBarFactory menuBarFactory) {
151 return new MapperFrame("Mapper");
152 }
153 });
154 app.initialize();
155
156 app.doNew();
157
158 if (args.length > 0) {
159 MapperFrame frame = (MapperFrame) app.getDefaultFrame();
160 for (String fileName : args) {
161
162 File file = new File(fileName);
163 // LogFileTraces[] traces = { new LogFileTraces(fileName, file) };
164
165 // frame.processTraces(traces);
166 }
167 }
168 } catch (Exception e) {
169 JOptionPane.showMessageDialog(new JFrame(), "Fatal exception: " + e,
170 "Please report this to the authors",
171 JOptionPane.ERROR_MESSAGE);
172 e.printStackTrace();
173 }
174 }
175 }