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 @SuppressWarnings("serial")
41 public class GTreePanel extends JInternalFrame
43 BorderLayout borderLayout1 = new BorderLayout();
45 public JScrollPane scrollPane = new JScrollPane();
47 JMenuBar jMenuBar1 = new JMenuBar();
49 JMenu fileMenu = new JMenu();
51 JMenuItem saveAsNewick = new JMenuItem();
53 JMenuItem printMenu = new JMenuItem();
55 protected JMenu viewMenu = new JMenu();
57 public JMenuItem font = new JMenuItem();
59 public JMenuItem sortAssocViews = new JMenuItem();
61 public JCheckBoxMenuItem bootstrapMenu = new JCheckBoxMenuItem();
63 public JCheckBoxMenuItem distanceMenu = new JCheckBoxMenuItem();
65 public JCheckBoxMenuItem fitToWindow = new JCheckBoxMenuItem();
67 public JCheckBoxMenuItem placeholdersMenu = new JCheckBoxMenuItem();
69 JMenuItem pngTree = new JMenuItem();
71 JMenuItem epsTree = new JMenuItem();
73 JMenu saveAsMenu = new JMenu();
75 JMenuItem textbox = new JMenuItem();
77 public JMenuItem originalSeqData = new JMenuItem();
79 protected JMenu associateLeavesMenu = new JMenu();
86 this.setJMenuBar(jMenuBar1);
93 private void jbInit() throws Exception
95 setName("jalview-tree");
96 this.getContentPane().setLayout(borderLayout1);
97 this.setBackground(Color.white);
98 this.setFont(new java.awt.Font("Verdana", 0, 12));
99 scrollPane.setOpaque(false);
100 fileMenu.setText(MessageManager.getString("action.file"));
101 saveAsNewick.setText(MessageManager.getString("label.newick_format"));
102 saveAsNewick.addActionListener(new ActionListener()
105 public void actionPerformed(ActionEvent e)
107 saveAsNewick_actionPerformed(e);
110 printMenu.setText(MessageManager.getString("action.print"));
111 printMenu.addActionListener(new java.awt.event.ActionListener()
114 public void actionPerformed(ActionEvent e)
116 printMenu_actionPerformed(e);
119 viewMenu.setText(MessageManager.getString("action.view"));
120 viewMenu.addMenuListener(new MenuListener()
123 public void menuSelected(MenuEvent e)
125 viewMenu_menuSelected();
129 public void menuDeselected(MenuEvent e)
134 public void menuCanceled(MenuEvent e)
138 sortAssocViews.setText(
139 MessageManager.getString("label.sort_alignment_by_tree"));
140 sortAssocViews.addActionListener(new java.awt.event.ActionListener()
143 public void actionPerformed(ActionEvent e)
145 sortByTree_actionPerformed();
148 font.setText(MessageManager.getString("action.font"));
149 font.addActionListener(new java.awt.event.ActionListener()
152 public void actionPerformed(ActionEvent e)
154 font_actionPerformed(e);
157 bootstrapMenu.setText(
158 MessageManager.getString("label.show_bootstrap_values"));
159 bootstrapMenu.addActionListener(new java.awt.event.ActionListener()
162 public void actionPerformed(ActionEvent e)
164 bootstrapMenu_actionPerformed(e);
167 distanceMenu.setText(MessageManager.getString("label.show_distances"));
168 distanceMenu.addActionListener(new java.awt.event.ActionListener()
171 public void actionPerformed(ActionEvent e)
173 distanceMenu_actionPerformed(e);
176 fitToWindow.setSelected(true);
177 fitToWindow.setText(MessageManager.getString("label.fit_to_window"));
178 fitToWindow.addActionListener(new java.awt.event.ActionListener()
181 public void actionPerformed(ActionEvent e)
183 fitToWindow_actionPerformed(e);
186 epsTree.setText("EPS");
187 epsTree.addActionListener(new java.awt.event.ActionListener()
190 public void actionPerformed(ActionEvent e)
192 writeTreeImage(TYPE.EPS);
195 pngTree.setText("PNG");
196 pngTree.addActionListener(new java.awt.event.ActionListener()
199 public void actionPerformed(ActionEvent e)
201 writeTreeImage(TYPE.PNG);
204 saveAsMenu.setText(MessageManager.getString("action.save_as"));
205 placeholdersMenu.setToolTipText(MessageManager.getString(
206 "label.marks_leaves_tree_not_associated_with_sequence"));
207 placeholdersMenu.setText(
208 MessageManager.getString("label.mark_unlinked_leaves"));
209 placeholdersMenu.addActionListener(new ActionListener()
212 public void actionPerformed(ActionEvent e)
214 placeholdersMenu_actionPerformed(e);
217 textbox.setText(MessageManager.getString("label.out_to_textbox"));
218 textbox.addActionListener(new ActionListener()
221 public void actionPerformed(ActionEvent e)
223 textbox_actionPerformed(e);
226 originalSeqData.setText(MessageManager.getString("label.input_data"));
227 originalSeqData.addActionListener(new ActionListener()
230 public void actionPerformed(ActionEvent e)
232 originalSeqData_actionPerformed(e);
235 associateLeavesMenu.setText(
236 MessageManager.getString("label.associate_leaves_with"));
237 this.getContentPane().add(scrollPane, BorderLayout.CENTER);
238 jMenuBar1.add(fileMenu);
239 jMenuBar1.add(viewMenu);
240 fileMenu.add(saveAsMenu);
241 fileMenu.add(textbox);
242 fileMenu.add(printMenu);
243 fileMenu.add(originalSeqData);
244 viewMenu.add(fitToWindow);
246 viewMenu.add(distanceMenu);
247 viewMenu.add(bootstrapMenu);
248 viewMenu.add(placeholdersMenu);
249 viewMenu.add(sortAssocViews);
250 viewMenu.add(associateLeavesMenu);
251 saveAsMenu.add(saveAsNewick);
252 saveAsMenu.add(epsTree);
253 saveAsMenu.add(pngTree);
256 public void printMenu_actionPerformed(ActionEvent e)
260 public void font_actionPerformed(ActionEvent e)
264 public void distanceMenu_actionPerformed(ActionEvent e)
268 public void bootstrapMenu_actionPerformed(ActionEvent e)
272 public void fitToWindow_actionPerformed(ActionEvent e)
276 public void writeTreeImage(TYPE imageType)
280 public void saveAsNewick_actionPerformed(ActionEvent e)
284 public void placeholdersMenu_actionPerformed(ActionEvent e)
288 public void textbox_actionPerformed(ActionEvent e)
292 public void fullid_actionPerformed(ActionEvent e)
297 public void originalSeqData_actionPerformed(ActionEvent e)
302 public void viewMenu_menuSelected()
306 public void sortByTree_actionPerformed()