2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
3 * Copyright (C) 2015 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.api.structures.JalviewStructureDisplayI;
24 import jalview.util.MessageManager;
26 import java.awt.GridLayout;
27 import java.awt.event.ActionEvent;
28 import java.awt.event.ActionListener;
30 import javax.swing.ButtonGroup;
31 import javax.swing.JInternalFrame;
32 import javax.swing.JLabel;
33 import javax.swing.JMenu;
34 import javax.swing.JMenuBar;
35 import javax.swing.JMenuItem;
36 import javax.swing.JPanel;
37 import javax.swing.JRadioButtonMenuItem;
39 public abstract class GStructureViewer extends JInternalFrame implements
40 JalviewStructureDisplayI
42 // private AAStructureBindingModel bindingModel;
44 protected JMenu savemenu = new JMenu();
46 protected JMenu viewMenu = new JMenu();
48 protected JMenu chainMenu = new JMenu();
50 protected JMenu viewerActionMenu = new JMenu();
52 protected JMenuItem alignStructs = new JMenuItem();
54 protected JMenuItem fitToWindow = new JMenuItem();
56 protected JRadioButtonMenuItem seqColour = new JRadioButtonMenuItem();
58 protected JRadioButtonMenuItem chainColour = new JRadioButtonMenuItem();
60 protected JRadioButtonMenuItem chargeColour = new JRadioButtonMenuItem();
62 protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem();
64 protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem();
66 protected JRadioButtonMenuItem hydroColour = new JRadioButtonMenuItem();
68 protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem();
70 protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem();
72 protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();
74 protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem();
76 protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
78 protected JRadioButtonMenuItem userColour = new JRadioButtonMenuItem();
80 protected JRadioButtonMenuItem viewerColour = new JRadioButtonMenuItem();
82 protected JMenuItem helpItem = new JMenuItem();
84 protected JLabel statusBar = new JLabel();
86 protected JPanel statusPanel = new JPanel();
91 public GStructureViewer()
96 } catch (Exception ex)
102 private void jbInit() throws Exception
104 JMenuBar menuBar = new JMenuBar();
105 this.setJMenuBar(menuBar);
107 JMenu fileMenu = new JMenu();
108 fileMenu.setText(MessageManager.getString("action.file"));
110 savemenu.setActionCommand(MessageManager.getString("action.save_image"));
111 savemenu.setText(MessageManager.getString("action.save_as"));
113 JMenuItem pdbFile = new JMenuItem();
114 pdbFile.setText(MessageManager.getString("label.pdb_file"));
115 pdbFile.addActionListener(new ActionListener()
117 public void actionPerformed(ActionEvent actionEvent)
119 pdbFile_actionPerformed(actionEvent);
123 JMenuItem png = new JMenuItem();
125 png.addActionListener(new ActionListener()
127 public void actionPerformed(ActionEvent actionEvent)
129 png_actionPerformed(actionEvent);
133 JMenuItem eps = new JMenuItem();
135 eps.addActionListener(new ActionListener()
137 public void actionPerformed(ActionEvent actionEvent)
139 eps_actionPerformed(actionEvent);
143 JMenuItem viewMapping = new JMenuItem();
144 viewMapping.setText(MessageManager.getString("label.view_mapping"));
145 viewMapping.addActionListener(new ActionListener()
147 public void actionPerformed(ActionEvent actionEvent)
149 viewMapping_actionPerformed(actionEvent);
152 viewMenu.setText(MessageManager.getString("action.view"));
154 chainMenu.setText(MessageManager.getString("action.show_chain"));
156 fitToWindow.setText(MessageManager.getString("label.fit_to_window"));
157 fitToWindow.addActionListener(new ActionListener()
159 public void actionPerformed(ActionEvent actionEvent)
161 fitToWindow_actionPerformed();
165 JMenu colourMenu = new JMenu();
166 colourMenu.setText(MessageManager.getString("label.colours"));
168 JMenuItem backGround = new JMenuItem();
170 .setText(MessageManager.getString("action.background_colour"));
171 backGround.addActionListener(new ActionListener()
173 public void actionPerformed(ActionEvent actionEvent)
175 backGround_actionPerformed(actionEvent);
178 seqColour.setSelected(false);
179 seqColour.setText(MessageManager.getString("action.by_sequence"));
180 seqColour.addActionListener(new ActionListener()
182 public void actionPerformed(ActionEvent actionEvent)
184 seqColour_actionPerformed(actionEvent);
187 chainColour.setText(MessageManager.getString("action.by_chain"));
188 chainColour.addActionListener(new ActionListener()
190 public void actionPerformed(ActionEvent actionEvent)
192 chainColour_actionPerformed(actionEvent);
195 chargeColour.setText(MessageManager.getString("label.charge_cysteine"));
196 chargeColour.addActionListener(new ActionListener()
198 public void actionPerformed(ActionEvent actionEvent)
200 chargeColour_actionPerformed(actionEvent);
203 zappoColour.setText(MessageManager.getString("label.zappo"));
204 zappoColour.addActionListener(new ActionListener()
206 public void actionPerformed(ActionEvent actionEvent)
208 zappoColour_actionPerformed(actionEvent);
211 taylorColour.setText(MessageManager.getString("label.taylor"));
212 taylorColour.addActionListener(new ActionListener()
214 public void actionPerformed(ActionEvent actionEvent)
216 taylorColour_actionPerformed(actionEvent);
219 hydroColour.setText(MessageManager.getString("label.hydrophobicity"));
220 hydroColour.addActionListener(new ActionListener()
222 public void actionPerformed(ActionEvent actionEvent)
224 hydroColour_actionPerformed(actionEvent);
227 strandColour.setText(MessageManager
228 .getString("label.strand_propensity"));
229 strandColour.addActionListener(new ActionListener()
231 public void actionPerformed(ActionEvent actionEvent)
233 strandColour_actionPerformed(actionEvent);
236 helixColour.setText(MessageManager.getString("label.helix_propensity"));
237 helixColour.addActionListener(new ActionListener()
239 public void actionPerformed(ActionEvent actionEvent)
241 helixColour_actionPerformed(actionEvent);
244 turnColour.setText(MessageManager.getString("label.turn_propensity"));
245 turnColour.addActionListener(new ActionListener()
247 public void actionPerformed(ActionEvent actionEvent)
249 turnColour_actionPerformed(actionEvent);
252 buriedColour.setText(MessageManager.getString("label.buried_index"));
253 buriedColour.addActionListener(new ActionListener()
255 public void actionPerformed(ActionEvent actionEvent)
257 buriedColour_actionPerformed(actionEvent);
260 purinePyrimidineColour.setText(MessageManager
261 .getString("label.purine_pyrimidine"));
262 purinePyrimidineColour.addActionListener(new ActionListener()
264 public void actionPerformed(ActionEvent actionEvent)
266 purinePyrimidineColour_actionPerformed(actionEvent);
270 userColour.setText(MessageManager.getString("action.user_defined"));
271 userColour.addActionListener(new ActionListener()
273 public void actionPerformed(ActionEvent actionEvent)
275 userColour_actionPerformed(actionEvent);
278 viewerColour.setSelected(false);
280 .setText(MessageManager.getString("label.colour_with_jmol"));
281 viewerColour.setToolTipText(MessageManager
282 .getString("label.let_jmol_manage_structure_colours"));
283 viewerColour.addActionListener(new ActionListener()
285 public void actionPerformed(ActionEvent actionEvent)
287 viewerColour_actionPerformed(actionEvent);
291 JMenu helpMenu = new JMenu();
292 helpMenu.setText(MessageManager.getString("action.help"));
293 helpItem.setText(MessageManager.getString("label.jmol_help"));
294 helpItem.addActionListener(new ActionListener()
296 public void actionPerformed(ActionEvent actionEvent)
298 showHelp_actionPerformed(actionEvent);
302 .setText(MessageManager.getString("label.align_structures"));
303 alignStructs.addActionListener(new ActionListener()
305 public void actionPerformed(ActionEvent actionEvent)
307 alignStructs_actionPerformed(actionEvent);
310 viewerActionMenu.setText(MessageManager.getString("label.jmol"));
311 menuBar.add(fileMenu);
312 menuBar.add(viewMenu);
313 menuBar.add(colourMenu);
314 menuBar.add(viewerActionMenu);
315 viewerActionMenu.setVisible(false);
316 menuBar.add(helpMenu);
317 fileMenu.add(savemenu);
318 fileMenu.add(viewMapping);
319 savemenu.add(pdbFile);
322 viewMenu.add(chainMenu);
324 colourMenu.add(seqColour);
325 colourMenu.add(chainColour);
326 colourMenu.add(chargeColour);
327 colourMenu.add(zappoColour);
328 colourMenu.add(taylorColour);
329 colourMenu.add(hydroColour);
330 colourMenu.add(helixColour);
331 colourMenu.add(strandColour);
332 colourMenu.add(turnColour);
333 colourMenu.add(buriedColour);
334 colourMenu.add(purinePyrimidineColour);
335 colourMenu.add(userColour);
336 colourMenu.add(viewerColour);
337 colourMenu.add(backGround);
339 ButtonGroup colourButtons = new ButtonGroup();
341 colourButtons.add(seqColour);
342 colourButtons.add(chainColour);
343 colourButtons.add(chargeColour);
344 colourButtons.add(zappoColour);
345 colourButtons.add(taylorColour);
346 colourButtons.add(hydroColour);
347 colourButtons.add(helixColour);
348 colourButtons.add(strandColour);
349 colourButtons.add(turnColour);
350 colourButtons.add(buriedColour);
351 colourButtons.add(purinePyrimidineColour);
352 colourButtons.add(userColour);
353 colourButtons.add(viewerColour);
355 helpMenu.add(helpItem);
356 viewerActionMenu.add(alignStructs);
358 statusPanel.setLayout(new GridLayout());
359 this.getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH);
360 statusPanel.add(statusBar, null);
363 protected void fitToWindow_actionPerformed()
367 protected void viewerColour_actionPerformed(ActionEvent actionEvent)
371 protected void alignStructs_actionPerformed(ActionEvent actionEvent)
375 public void pdbFile_actionPerformed(ActionEvent actionEvent)
380 public void png_actionPerformed(ActionEvent actionEvent)
385 public void eps_actionPerformed(ActionEvent actionEvent)
390 public void viewMapping_actionPerformed(ActionEvent actionEvent)
395 public void seqColour_actionPerformed(ActionEvent actionEvent)
400 public void chainColour_actionPerformed(ActionEvent actionEvent)
405 public void chargeColour_actionPerformed(ActionEvent actionEvent)
410 public void zappoColour_actionPerformed(ActionEvent actionEvent)
415 public void taylorColour_actionPerformed(ActionEvent actionEvent)
420 public void hydroColour_actionPerformed(ActionEvent actionEvent)
425 public void helixColour_actionPerformed(ActionEvent actionEvent)
430 public void strandColour_actionPerformed(ActionEvent actionEvent)
435 public void turnColour_actionPerformed(ActionEvent actionEvent)
440 public void buriedColour_actionPerformed(ActionEvent actionEvent)
445 public void purinePyrimidineColour_actionPerformed(ActionEvent actionEvent)
450 public void userColour_actionPerformed(ActionEvent actionEvent)
455 public void backGround_actionPerformed(ActionEvent actionEvent)
460 public void showHelp_actionPerformed(ActionEvent actionEvent)
466 // return bindingModel;
469 // public void setBindingModel(AAStructureBindingModel bindingModel)
471 // this.bindingModel = bindingModel;