| 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.bss; |
| 27 |
|
| 28 |
import java.awt.Color; |
| 29 |
import java.awt.Cursor; |
| 30 |
import java.awt.Desktop; |
| 31 |
import java.awt.Dimension; |
| 32 |
import java.awt.Font; |
| 33 |
import java.awt.event.ActionEvent; |
| 34 |
import java.awt.event.ActionListener; |
| 35 |
import java.awt.event.MouseAdapter; |
| 36 |
import java.awt.event.MouseEvent; |
| 37 |
import java.io.IOException; |
| 38 |
import java.net.URI; |
| 39 |
import java.net.URISyntaxException; |
| 40 |
|
| 41 |
import javax.swing.Box; |
| 42 |
import javax.swing.BoxLayout; |
| 43 |
import javax.swing.JButton; |
| 44 |
import javax.swing.JDialog; |
| 45 |
import javax.swing.JLabel; |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
@SuppressWarnings("serial") |
| 52 |
public class AboutDialog extends JDialog { |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
private static final int WIDTH = 700; |
| 66 |
private static final int HEIGHT = 700; |
| 67 |
private static final int FONT_SIZE = 15; |
| 68 |
|
| 69 |
private static final String FILIP_BIELEJEC = "Filip Bielejec"; |
| 70 |
private static final String ANDREW_RAMBAUT = "Andrew Rambaut"; |
| 71 |
private static final String MARC_SUCHARD = "Marc A. Suchard"; |
| 72 |
private static final String PHILIPPE_LEMEY = "Philippe Lemey"; |
| 73 |
private static final String LUIZ_MAX_CARVAHLO = "Luiz Max Carvahlo"; |
| 74 |
private static final String GUY_BAELE = "Guy Baele"; |
| 75 |
|
| 76 |
private static final String CITATION1 = "To cite " + BeagleSequenceSimulatorApp.SHORT_NAME + " in publications, please use:"; |
| 77 |
private static final String CITATION2 = "Bielejec, F., P. Lemey, L. Carvalho, G. Baele, A. Rambaut, and M. A. Suchard. 2014."; |
| 78 |
private static final String CITATION3 = "pibuss: a parallel beast/beagle utility for sequence simulation under complex evolutionary scenarios."; |
| 79 |
private static final String CITATION4 = "BMC Bioinformatics 15:133"; |
| 80 |
|
| 81 |
public AboutDialog() { |
| 82 |
initUI(); |
| 83 |
} |
| 84 |
|
| 85 |
public final void initUI() { |
| 86 |
|
| 87 |
JLabel label; |
| 88 |
JLabel contact; |
| 89 |
JLabel website; |
| 90 |
String addres; |
| 91 |
|
| 92 |
setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); |
| 93 |
getContentPane().setBackground(Color.WHITE); |
| 94 |
setLocationRelativeTo(Utils.getActiveFrame()); |
| 95 |
|
| 96 |
add(Box.createRigidArea(new Dimension(0, 10))); |
| 97 |
|
| 98 |
|
| 99 |
label = new JLabel(Utils.createImageIcon(Utils.BSS_ICON)); |
| 100 |
label.setAlignmentX(0.5f); |
| 101 |
add(label); |
| 102 |
|
| 103 |
add(Box.createRigidArea(new Dimension(0, 10))); |
| 104 |
|
| 105 |
|
| 106 |
label = new JLabel(BeagleSequenceSimulatorApp.SHORT_NAME); |
| 107 |
label.setFont(new Font("Serif", Font.BOLD, FONT_SIZE)); |
| 108 |
label.setAlignmentX(0.5f); |
| 109 |
add(label); |
| 110 |
|
| 111 |
add(Box.createRigidArea(new Dimension(0, 10))); |
| 112 |
|
| 113 |
|
| 114 |
label = new JLabel(BeagleSequenceSimulatorApp.LONG_NAME); |
| 115 |
label.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 2)); |
| 116 |
label.setAlignmentX(0.5f); |
| 117 |
add(label); |
| 118 |
|
| 119 |
|
| 120 |
label = new JLabel("Version v" + BeagleSequenceSimulatorApp.VERSION |
| 121 |
+ |
| 122 |
|
| 123 |
", " + BeagleSequenceSimulatorApp.DATE); |
| 124 |
label.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 2)); |
| 125 |
label.setAlignmentX(0.5f); |
| 126 |
add(label); |
| 127 |
|
| 128 |
add(Box.createRigidArea(new Dimension(0, 10))); |
| 129 |
|
| 130 |
|
| 131 |
label = new JLabel("by " + FILIP_BIELEJEC + ", " + ANDREW_RAMBAUT |
| 132 |
+ ", " + MARC_SUCHARD + ", " + GUY_BAELE + ", " + LUIZ_MAX_CARVAHLO + " and " |
| 133 |
+ PHILIPPE_LEMEY); |
| 134 |
label.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 2)); |
| 135 |
label.setAlignmentX(0.5f); |
| 136 |
add(label); |
| 137 |
|
| 138 |
add(Box.createRigidArea(new Dimension(0, 10))); |
| 139 |
|
| 140 |
|
| 141 |
label = new JLabel(CITATION1); |
| 142 |
label.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 2)); |
| 143 |
label.setAlignmentX(0.5f); |
| 144 |
add(label); |
| 145 |
|
| 146 |
label = new JLabel(CITATION2); |
| 147 |
label.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 2)); |
| 148 |
label.setAlignmentX(0.5f); |
| 149 |
add(label); |
| 150 |
|
| 151 |
label = new JLabel(CITATION3); |
| 152 |
label.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 2)); |
| 153 |
label.setAlignmentX(0.5f); |
| 154 |
add(label); |
| 155 |
|
| 156 |
label = new JLabel(CITATION4); |
| 157 |
label.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 2)); |
| 158 |
label.setAlignmentX(0.5f); |
| 159 |
add(label); |
| 160 |
|
| 161 |
add(Box.createRigidArea(new Dimension(0, 10))); |
| 162 |
|
| 163 |
|
| 164 |
label = new JLabel("BEAST auxiliary software package"); |
| 165 |
label.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 3)); |
| 166 |
label.setAlignmentX(0.5f); |
| 167 |
add(label); |
| 168 |
|
| 169 |
website = new JLabel(); |
| 170 |
addres = "http://beast.community"; |
| 171 |
website.setText("<html><p><a href=\"" + addres + "\">" + addres |
| 172 |
+ "</a></p></html>"); |
| 173 |
website.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
| 174 |
website.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 3)); |
| 175 |
|
| 176 |
|
| 177 |
website.addMouseListener(new ListenBrowse(addres)); |
| 178 |
add(website); |
| 179 |
|
| 180 |
add(Box.createRigidArea(new Dimension(0, 10))); |
| 181 |
|
| 182 |
label = new JLabel("Designed and developed by"); |
| 183 |
label.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 3)); |
| 184 |
label.setAlignmentX(0.5f); |
| 185 |
add(label); |
| 186 |
|
| 187 |
label = new JLabel(FILIP_BIELEJEC + ", " + MARC_SUCHARD + " and " + ANDREW_RAMBAUT); |
| 188 |
label.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 3)); |
| 189 |
label.setAlignmentX(0.5f); |
| 190 |
add(label); |
| 191 |
|
| 192 |
add(Box.createRigidArea(new Dimension(0, 10))); |
| 193 |
|
| 194 |
label = new JLabel("Computational and Evolutionary Virology, KU Leuven"); |
| 195 |
label.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 3)); |
| 196 |
label.setAlignmentX(0.5f); |
| 197 |
add(label); |
| 198 |
|
| 199 |
contact = new JLabel(); |
| 200 |
addres = "filip.bielejec(AT)rega.kuleuven.be"; |
| 201 |
contact.setText("<html><center><p><a href=\"mailto:" + addres + "\">" |
| 202 |
+ addres + "</a></p></center></html>"); |
| 203 |
contact.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
| 204 |
contact.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 3)); |
| 205 |
|
| 206 |
contact.addMouseListener(new ListenSendMail(addres)); |
| 207 |
add(contact); |
| 208 |
|
| 209 |
add(Box.createRigidArea(new Dimension(0, 10))); |
| 210 |
|
| 211 |
label = new JLabel("Departments of Biomathematics and Human Genetics, University of California, Los Angeles"); |
| 212 |
label.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 3)); |
| 213 |
label.setAlignmentX(0.5f); |
| 214 |
add(label); |
| 215 |
|
| 216 |
contact = new JLabel(); |
| 217 |
addres = "msuchard(AT)ucla.edu"; |
| 218 |
contact.setText("<html><center><p><a href=\"mailto:" + addres + "\">" |
| 219 |
+ addres + "</a></p></center></html>"); |
| 220 |
contact.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
| 221 |
contact.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 3)); |
| 222 |
|
| 223 |
contact.addMouseListener(new ListenSendMail(addres)); |
| 224 |
add(contact); |
| 225 |
|
| 226 |
add(Box.createRigidArea(new Dimension(0, 10))); |
| 227 |
|
| 228 |
label = new JLabel( |
| 229 |
"Institute of Evolutionary Biology, University of Edinburgh"); |
| 230 |
label.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 3)); |
| 231 |
label.setAlignmentX(0.5f); |
| 232 |
add(label); |
| 233 |
|
| 234 |
contact = new JLabel(); |
| 235 |
addres = "a.rambaut(AT)ed.ac.uk"; |
| 236 |
contact.setText("<html><p><a href=\"mailto:" + addres + "\">" + addres |
| 237 |
+ "</a></p></html>"); |
| 238 |
contact.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
| 239 |
contact.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 3)); |
| 240 |
|
| 241 |
contact.addMouseListener(new ListenSendMail(addres)); |
| 242 |
add(contact); |
| 243 |
|
| 244 |
add(Box.createRigidArea(new Dimension(0, 10))); |
| 245 |
|
| 246 |
label = new JLabel("Source code distributed under the GNU LGPL"); |
| 247 |
label.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 3)); |
| 248 |
label.setAlignmentX(0.5f); |
| 249 |
add(label); |
| 250 |
|
| 251 |
website = new JLabel(); |
| 252 |
addres = "http://code.google.com/p/beast-mcmc"; |
| 253 |
website.setText("<html><p><a href=\"" + addres + "\">" + addres |
| 254 |
+ "</a></p></html>"); |
| 255 |
website.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); |
| 256 |
website.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 3)); |
| 257 |
|
| 258 |
website.addMouseListener(new ListenBrowse(addres)); |
| 259 |
add(website); |
| 260 |
|
| 261 |
add(Box.createRigidArea(new Dimension(0, 20))); |
| 262 |
|
| 263 |
label = new JLabel("In case of any problems please contact your local witch doctor or a shaman."); |
| 264 |
label.setFont(new Font("Serif", Font.PLAIN, FONT_SIZE - 3)); |
| 265 |
label.setAlignmentX(0.5f); |
| 266 |
add(label); |
| 267 |
|
| 268 |
add(Box.createRigidArea(new Dimension(0, 20))); |
| 269 |
|
| 270 |
JButton close = new JButton("Close"); |
| 271 |
close.addActionListener(new ActionListener() { |
| 272 |
|
| 273 |
public void actionPerformed(ActionEvent event) { |
| 274 |
dispose(); |
| 275 |
} |
| 276 |
}); |
| 277 |
|
| 278 |
close.setAlignmentX(0.5f); |
| 279 |
add(close); |
| 280 |
|
| 281 |
setModalityType(ModalityType.APPLICATION_MODAL); |
| 282 |
|
| 283 |
setTitle("About " + BeagleSequenceSimulatorApp.SHORT_NAME); |
| 284 |
setDefaultCloseOperation(DISPOSE_ON_CLOSE); |
| 285 |
setLocationRelativeTo(null); |
| 286 |
setSize(WIDTH, HEIGHT); |
| 287 |
setResizable(true); |
| 288 |
} |
| 289 |
|
| 290 |
private class ListenSendMail extends MouseAdapter { |
| 291 |
|
| 292 |
private String addres; |
| 293 |
|
| 294 |
public ListenSendMail(String addres) { |
| 295 |
this.addres = addres; |
| 296 |
} |
| 297 |
|
| 298 |
@Override |
| 299 |
public void mouseClicked(MouseEvent ev) { |
| 300 |
try { |
| 301 |
|
| 302 |
Desktop.getDesktop().mail(new URI("mailto:" + addres)); |
| 303 |
|
| 304 |
} catch (IOException e) { |
| 305 |
Utils.handleException( |
| 306 |
e, |
| 307 |
"Problem occurred while trying to open this address in your system's standard email client."); |
| 308 |
} catch (URISyntaxException e) { |
| 309 |
Utils.handleException( |
| 310 |
e, |
| 311 |
"Problem occurred while trying to open this address in your system's standard email client."); |
| 312 |
} |
| 313 |
|
| 314 |
} |
| 315 |
|
| 316 |
} |
| 317 |
|
| 318 |
private class ListenBrowse extends MouseAdapter { |
| 319 |
|
| 320 |
private String website; |
| 321 |
|
| 322 |
public ListenBrowse(String website) { |
| 323 |
this.website = website; |
| 324 |
} |
| 325 |
|
| 326 |
@Override |
| 327 |
public void mouseClicked(MouseEvent ev) { |
| 328 |
|
| 329 |
try { |
| 330 |
|
| 331 |
Desktop.getDesktop().browse(new URI(website)); |
| 332 |
|
| 333 |
} catch (IOException e) { |
| 334 |
Utils.handleException( |
| 335 |
e, |
| 336 |
"Problem occurred while trying to open this link in your system's standard browser."); |
| 337 |
} catch (URISyntaxException e) { |
| 338 |
Utils.handleException( |
| 339 |
e, |
| 340 |
"Problem occurred while trying to open this link in your system's standard browser."); |
| 341 |
} |
| 342 |
|
| 343 |
} |
| 344 |
|
| 345 |
} |
| 346 |
|
| 347 |
} |