Debian Codegraph @

src/dr/app/beauti/BeautiDefaultFileMenuFactory.java

raw symbols SCIP
1 /*
2 * BeautiDefaultFileMenuFactory.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.beauti;
27
28 import jam.framework.AbstractFrame;
29 import jam.framework.Application;
30 import jam.framework.MenuBarFactory;
31 import jam.framework.MenuFactory;
32
33 import javax.swing.*;
34 import java.awt.event.KeyEvent;
35 import java.awt.event.ActionEvent;
36
37 /**
38 * @author rambaut
39 * Date: Dec 26, 2004
40 * Time: 11:01:06 AM
41 */
42 public class BeautiDefaultFileMenuFactory implements MenuFactory {
43
44
45 public BeautiDefaultFileMenuFactory() {
46 }
47
48 public String getMenuName() {
49 return "File";
50 }
51
52 public void populateMenu(JMenu menu, AbstractFrame frame) {
53
54 JMenuItem item;
55
56 Application application = Application.getApplication();
57 menu.setMnemonic('F');
58
59 item = new JMenuItem(application.getNewAction());
60 item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, MenuBarFactory.MENU_MASK));
61 menu.add(item);
62
63 item = new JMenuItem(frame.getOpenAction());
64 item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, MenuBarFactory.MENU_MASK));
65 menu.add(item);
66
67 item = new JMenuItem(frame.getSaveAction());
68 item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, MenuBarFactory.MENU_MASK));
69 menu.add(item);
70
71 item = new JMenuItem(frame.getSaveAsAction());
72 menu.add(item);
73
74 menu.addSeparator();
75
76 item = new JMenuItem(frame.getImportAction());
77 item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, MenuBarFactory.MENU_MASK));
78 menu.add(item);
79
80 item = new JMenuItem(((BeautiFrame)frame).getImportTraitsAction());
81 item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, MenuBarFactory.MENU_MASK + ActionEvent.ALT_MASK));
82 menu.add(item);
83
84 item = new JMenuItem(frame.getExportAction());
85 item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, MenuBarFactory.MENU_MASK));
86 menu.add(item);
87
88 menu.addSeparator();
89
90 item = new JMenuItem(frame.getPrintAction());
91 item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, MenuBarFactory.MENU_MASK));
92 menu.add(item);
93
94 item = new JMenuItem(application.getPageSetupAction());
95 menu.add(item);
96
97 menu.addSeparator();
98
99 item = new JMenuItem(application.getExitAction());
100 menu.add(item);
101 }
102
103 public int getPreferredAlignment() {
104 return LEFT;
105 }
106 }