2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.jbgui;
23 import jalview.util.ImageMaker.TYPE;
24 import jalview.util.MessageManager;
26 import java.awt.BorderLayout;
27 import java.awt.Color;
28 import java.awt.event.ActionEvent;
29 import java.awt.event.ActionListener;
31 import javax.swing.JCheckBoxMenuItem;
32 import javax.swing.JInternalFrame;
33 import javax.swing.JMenu;
34 import javax.swing.JMenuBar;
35 import javax.swing.JMenuItem;
36 import javax.swing.JScrollPane;
37 import javax.swing.event.MenuEvent;
38 import javax.swing.event.MenuListener;
40 public class GTreePanel extends JInternalFrame
42 BorderLayout borderLayout1 = new BorderLayout();
44 public JScrollPane scrollPane = new JScrollPane();
46 JMenuBar jMenuBar1 = new JMenuBar();
48 JMenu fileMenu = new JMenu();
50 JMenuItem saveAsNewick = new JMenuItem();
52 JMenuItem printMenu = new JMenuItem();
54 protected JMenu viewMenu = new JMenu();
56 public JMenuItem font = new JMenuItem();
58 public JMenuItem sortAssocViews = new JMenuItem();
60 public JCheckBoxMenuItem bootstrapMenu = new JCheckBoxMenuItem();
62 public JCheckBoxMenuItem distanceMenu = new JCheckBoxMenuItem();
64 public JCheckBoxMenuItem fitToWindow = new JCheckBoxMenuItem();
66 public JCheckBoxMenuItem placeholdersMenu = new JCheckBoxMenuItem();
68 JMenuItem pngTree = new JMenuItem();
70 JMenuItem epsTree = new JMenuItem();
72 JMenu saveAsMenu = new JMenu();
74 JMenuItem textbox = new JMenuItem();
76 public JMenuItem originalSeqData = new JMenuItem();
78 protected JMenu associateLeavesMenu = new JMenu();
85 this.setJMenuBar(jMenuBar1);
92 private void jbInit() throws Exception
94 this.getContentPane().setLayout(borderLayout1);
95 this.setBackground(Color.white);
96 this.setFont(new java.awt.Font("Verdana", 0, 12));
97 scrollPane.setOpaque(false);
98 fileMenu.setText(MessageManager.getString("action.file"));
99 saveAsNewick.setText(MessageManager.getString("label.newick_format"));
100 saveAsNewick.addActionListener(new ActionListener()
102 public void actionPerformed(ActionEvent e)
104 saveAsNewick_actionPerformed(e);
107 printMenu.setText(MessageManager.getString("action.print"));
108 printMenu.addActionListener(new java.awt.event.ActionListener()
110 public void actionPerformed(ActionEvent e)
112 printMenu_actionPerformed(e);
115 viewMenu.setText(MessageManager.getString("action.view"));
116 viewMenu.addMenuListener(new MenuListener()
118 public void menuSelected(MenuEvent e)
120 viewMenu_menuSelected();
123 public void menuDeselected(MenuEvent e)
127 public void menuCanceled(MenuEvent e)
131 sortAssocViews.setText(
132 MessageManager.getString("label.sort_alignment_by_tree"));
133 sortAssocViews.addActionListener(new java.awt.event.ActionListener()
135 public void actionPerformed(ActionEvent e)
137 sortByTree_actionPerformed();
140 font.setText(MessageManager.getString("action.font"));
141 font.addActionListener(new java.awt.event.ActionListener()
143 public void actionPerformed(ActionEvent e)
145 font_actionPerformed(e);
148 bootstrapMenu.setText(
149 MessageManager.getString("label.show_bootstrap_values"));
150 bootstrapMenu.addActionListener(new java.awt.event.ActionListener()
152 public void actionPerformed(ActionEvent e)
154 bootstrapMenu_actionPerformed(e);
157 distanceMenu.setText(MessageManager.getString("label.show_distances"));
158 distanceMenu.addActionListener(new java.awt.event.ActionListener()
160 public void actionPerformed(ActionEvent e)
162 distanceMenu_actionPerformed(e);
165 fitToWindow.setSelected(true);
166 fitToWindow.setText(MessageManager.getString("label.fit_to_window"));
167 fitToWindow.addActionListener(new java.awt.event.ActionListener()
169 public void actionPerformed(ActionEvent e)
171 fitToWindow_actionPerformed(e);
174 epsTree.setText("EPS");
175 epsTree.addActionListener(new java.awt.event.ActionListener()
177 public void actionPerformed(ActionEvent e)
179 writeTreeImage(TYPE.EPS);
182 pngTree.setText("PNG");
183 pngTree.addActionListener(new java.awt.event.ActionListener()
185 public void actionPerformed(ActionEvent e)
187 writeTreeImage(TYPE.PNG);
190 saveAsMenu.setText(MessageManager.getString("action.save_as"));
191 placeholdersMenu.setToolTipText(MessageManager.getString(
192 "label.marks_leaves_tree_not_associated_with_sequence"));
193 placeholdersMenu.setText(
194 MessageManager.getString("label.mark_unlinked_leaves"));
195 placeholdersMenu.addActionListener(new ActionListener()
197 public void actionPerformed(ActionEvent e)
199 placeholdersMenu_actionPerformed(e);
202 textbox.setText(MessageManager.getString("label.out_to_textbox"));
203 textbox.addActionListener(new ActionListener()
205 public void actionPerformed(ActionEvent e)
207 textbox_actionPerformed(e);
210 originalSeqData.setText(MessageManager.getString("label.input_data"));
211 originalSeqData.addActionListener(new ActionListener()
213 public void actionPerformed(ActionEvent e)
215 originalSeqData_actionPerformed(e);
218 associateLeavesMenu.setText(
219 MessageManager.getString("label.associate_leaves_with"));
220 this.getContentPane().add(scrollPane, BorderLayout.CENTER);
221 jMenuBar1.add(fileMenu);
222 jMenuBar1.add(viewMenu);
223 fileMenu.add(saveAsMenu);
224 fileMenu.add(textbox);
225 fileMenu.add(printMenu);
226 fileMenu.add(originalSeqData);
227 viewMenu.add(fitToWindow);
229 viewMenu.add(distanceMenu);
230 viewMenu.add(bootstrapMenu);
231 viewMenu.add(placeholdersMenu);
232 viewMenu.add(sortAssocViews);
233 viewMenu.add(associateLeavesMenu);
234 saveAsMenu.add(saveAsNewick);
235 saveAsMenu.add(epsTree);
236 saveAsMenu.add(pngTree);
239 public void printMenu_actionPerformed(ActionEvent e)
243 public void font_actionPerformed(ActionEvent e)
247 public void distanceMenu_actionPerformed(ActionEvent e)
251 public void bootstrapMenu_actionPerformed(ActionEvent e)
255 public void fitToWindow_actionPerformed(ActionEvent e)
259 public void writeTreeImage(TYPE imageType)
263 public void saveAsNewick_actionPerformed(ActionEvent e)
267 public void placeholdersMenu_actionPerformed(ActionEvent e)
271 public void textbox_actionPerformed(ActionEvent e)
275 public void fullid_actionPerformed(ActionEvent e)
280 public void originalSeqData_actionPerformed(ActionEvent e)
285 public void viewMenu_menuSelected()
289 public void sortByTree_actionPerformed()