| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 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 |
|
| 40 |
|
| 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 |
|
| 90 |
static public void main(String[] args) { |
| 91 |
|
| 92 |
|
| 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 |
|
| 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 |
|
| 164 |
|
| 165 |
|
| 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 |
} |