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 java.awt.BorderLayout;
24 import java.awt.Color;
25 import java.awt.event.ActionEvent;
26 import java.awt.event.ActionListener;
28 import javax.swing.JCheckBoxMenuItem;
29 import javax.swing.JInternalFrame;
30 import javax.swing.JMenu;
31 import javax.swing.JMenuBar;
32 import javax.swing.JMenuItem;
33 import javax.swing.JScrollPane;
34 import javax.swing.event.MenuEvent;
35 import javax.swing.event.MenuListener;
37 import jalview.util.ImageMaker.TYPE;
38 import jalview.util.MessageManager;
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
96 setName("jalview-tree");
97 this.getContentPane().setLayout(borderLayout1);
98 this.setBackground(Color.white);
99 this.setFont(new java.awt.Font("Verdana", 0, 12));
100 scrollPane.setOpaque(false);
101 fileMenu.setText(MessageManager.getString("action.file"));
102 saveAsNewick.setText(MessageManager.getString("label.newick_format"));
103 saveAsNewick.addActionListener(new ActionListener()
106 public void actionPerformed(ActionEvent e)
108 saveAsNewick_actionPerformed(e);
111 printMenu.setText(MessageManager.getString("action.print"));
112 printMenu.addActionListener(new java.awt.event.ActionListener()
115 public void actionPerformed(ActionEvent e)
117 printMenu_actionPerformed(e);
120 viewMenu.setText(MessageManager.getString("action.view"));
121 viewMenu.addMenuListener(new MenuListener()
124 public void menuSelected(MenuEvent e)
126 viewMenu_menuSelected();
130 public void menuDeselected(MenuEvent e)
135 public void menuCanceled(MenuEvent e)
139 sortAssocViews.setText(
140 MessageManager.getString("label.sort_alignment_by_tree"));
141 sortAssocViews.addActionListener(new java.awt.event.ActionListener()
144 public void actionPerformed(ActionEvent e)
146 sortByTree_actionPerformed();
149 font.setText(MessageManager.getString("action.font"));
150 font.addActionListener(new java.awt.event.ActionListener()
153 public void actionPerformed(ActionEvent e)
155 font_actionPerformed(e);
158 bootstrapMenu.setText(
159 MessageManager.getString("label.show_bootstrap_values"));
160 bootstrapMenu.addActionListener(new java.awt.event.ActionListener()
163 public void actionPerformed(ActionEvent e)
165 bootstrapMenu_actionPerformed(e);
168 distanceMenu.setText(MessageManager.getString("label.show_distances"));
169 distanceMenu.addActionListener(new java.awt.event.ActionListener()
172 public void actionPerformed(ActionEvent e)
174 distanceMenu_actionPerformed(e);
177 fitToWindow.setSelected(true);
178 fitToWindow.setText(MessageManager.getString("label.fit_to_window"));
179 fitToWindow.addActionListener(new java.awt.event.ActionListener()
182 public void actionPerformed(ActionEvent e)
184 fitToWindow_actionPerformed(e);
187 epsTree.setText("EPS");
188 epsTree.addActionListener(new java.awt.event.ActionListener()
191 public void actionPerformed(ActionEvent e)
193 writeTreeImage(TYPE.EPS);
196 pngTree.setText("PNG");
197 pngTree.addActionListener(new java.awt.event.ActionListener()
200 public void actionPerformed(ActionEvent e)
202 writeTreeImage(TYPE.PNG);
205 saveAsMenu.setText(MessageManager.getString("action.save_as"));
206 placeholdersMenu.setToolTipText(MessageManager.getString(
207 "label.marks_leaves_tree_not_associated_with_sequence"));
208 placeholdersMenu.setText(
209 MessageManager.getString("label.mark_unlinked_leaves"));
210 placeholdersMenu.addActionListener(new ActionListener()
213 public void actionPerformed(ActionEvent e)
215 placeholdersMenu_actionPerformed(e);
218 textbox.setText(MessageManager.getString("label.out_to_textbox"));
219 textbox.addActionListener(new ActionListener()
222 public void actionPerformed(ActionEvent e)
224 textbox_actionPerformed(e);
227 originalSeqData.setText(MessageManager.getString("label.input_data"));
228 originalSeqData.addActionListener(new ActionListener()
231 public void actionPerformed(ActionEvent e)
233 originalSeqData_actionPerformed(e);
236 associateLeavesMenu.setText(
237 MessageManager.getString("label.associate_leaves_with"));
238 this.getContentPane().add(scrollPane, BorderLayout.CENTER);
239 jMenuBar1.add(fileMenu);
240 jMenuBar1.add(viewMenu);
241 fileMenu.add(saveAsMenu);
242 fileMenu.add(textbox);
243 fileMenu.add(printMenu);
244 fileMenu.add(originalSeqData);
245 viewMenu.add(fitToWindow);
247 viewMenu.add(distanceMenu);
248 viewMenu.add(bootstrapMenu);
249 viewMenu.add(placeholdersMenu);
250 viewMenu.add(sortAssocViews);
251 viewMenu.add(associateLeavesMenu);
252 saveAsMenu.add(saveAsNewick);
253 saveAsMenu.add(epsTree);
254 saveAsMenu.add(pngTree);
257 public void printMenu_actionPerformed(ActionEvent e)
261 public void font_actionPerformed(ActionEvent e)
265 public void distanceMenu_actionPerformed(ActionEvent e)
269 public void bootstrapMenu_actionPerformed(ActionEvent e)
273 public void fitToWindow_actionPerformed(ActionEvent e)
277 public void writeTreeImage(TYPE imageType)
281 public void saveAsNewick_actionPerformed(ActionEvent e)
285 public void placeholdersMenu_actionPerformed(ActionEvent e)
289 public void textbox_actionPerformed(ActionEvent e)
293 public void fullid_actionPerformed(ActionEvent e)
298 public void originalSeqData_actionPerformed(ActionEvent e)
303 public void viewMenu_menuSelected()
307 public void sortByTree_actionPerformed()