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.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()
118 public void actionPerformed(ActionEvent actionEvent)
120 pdbFile_actionPerformed(actionEvent);
124 JMenuItem png = new JMenuItem();
126 png.addActionListener(new ActionListener()
129 public void actionPerformed(ActionEvent actionEvent)
131 png_actionPerformed(actionEvent);
135 JMenuItem eps = new JMenuItem();
137 eps.addActionListener(new ActionListener()
140 public void actionPerformed(ActionEvent actionEvent)
142 eps_actionPerformed(actionEvent);
146 JMenuItem viewMapping = new JMenuItem();
147 viewMapping.setText(MessageManager.getString("label.view_mapping"));
148 viewMapping.addActionListener(new ActionListener()
151 public void actionPerformed(ActionEvent actionEvent)
153 viewMapping_actionPerformed(actionEvent);
156 viewMenu.setText(MessageManager.getString("action.view"));
158 chainMenu.setText(MessageManager.getString("action.show_chain"));
160 fitToWindow.setText(MessageManager.getString("label.fit_to_window"));
161 fitToWindow.addActionListener(new ActionListener()
164 public void actionPerformed(ActionEvent actionEvent)
166 fitToWindow_actionPerformed();
170 JMenu colourMenu = new JMenu();
171 colourMenu.setText(MessageManager.getString("label.colours"));
173 JMenuItem backGround = new JMenuItem();
175 .setText(MessageManager.getString("action.background_colour"));
176 backGround.addActionListener(new ActionListener()
179 public void actionPerformed(ActionEvent actionEvent)
181 backGround_actionPerformed(actionEvent);
184 seqColour.setSelected(false);
185 seqColour.setText(MessageManager.getString("action.by_sequence"));
186 seqColour.addActionListener(new ActionListener()
189 public void actionPerformed(ActionEvent actionEvent)
191 seqColour_actionPerformed(actionEvent);
194 chainColour.setText(MessageManager.getString("action.by_chain"));
195 chainColour.addActionListener(new ActionListener()
198 public void actionPerformed(ActionEvent actionEvent)
200 chainColour_actionPerformed(actionEvent);
203 chargeColour.setText(MessageManager.getString("label.charge_cysteine"));
204 chargeColour.addActionListener(new ActionListener()
207 public void actionPerformed(ActionEvent actionEvent)
209 chargeColour_actionPerformed(actionEvent);
212 zappoColour.setText(MessageManager.getString("label.zappo"));
213 zappoColour.addActionListener(new ActionListener()
216 public void actionPerformed(ActionEvent actionEvent)
218 zappoColour_actionPerformed(actionEvent);
221 taylorColour.setText(MessageManager.getString("label.taylor"));
222 taylorColour.addActionListener(new ActionListener()
225 public void actionPerformed(ActionEvent actionEvent)
227 taylorColour_actionPerformed(actionEvent);
230 hydroColour.setText(MessageManager.getString("label.hydrophobicity"));
231 hydroColour.addActionListener(new ActionListener()
234 public void actionPerformed(ActionEvent actionEvent)
236 hydroColour_actionPerformed(actionEvent);
239 strandColour.setText(MessageManager
240 .getString("label.strand_propensity"));
241 strandColour.addActionListener(new ActionListener()
244 public void actionPerformed(ActionEvent actionEvent)
246 strandColour_actionPerformed(actionEvent);
249 helixColour.setText(MessageManager.getString("label.helix_propensity"));
250 helixColour.addActionListener(new ActionListener()
253 public void actionPerformed(ActionEvent actionEvent)
255 helixColour_actionPerformed(actionEvent);
258 turnColour.setText(MessageManager.getString("label.turn_propensity"));
259 turnColour.addActionListener(new ActionListener()
262 public void actionPerformed(ActionEvent actionEvent)
264 turnColour_actionPerformed(actionEvent);
267 buriedColour.setText(MessageManager.getString("label.buried_index"));
268 buriedColour.addActionListener(new ActionListener()
271 public void actionPerformed(ActionEvent actionEvent)
273 buriedColour_actionPerformed(actionEvent);
276 purinePyrimidineColour.setText(MessageManager
277 .getString("label.purine_pyrimidine"));
278 purinePyrimidineColour.addActionListener(new ActionListener()
281 public void actionPerformed(ActionEvent actionEvent)
283 purinePyrimidineColour_actionPerformed(actionEvent);
287 userColour.setText(MessageManager.getString("action.user_defined"));
288 userColour.addActionListener(new ActionListener()
291 public void actionPerformed(ActionEvent actionEvent)
293 userColour_actionPerformed(actionEvent);
296 viewerColour.setSelected(false);
298 .setText(MessageManager.getString("label.colour_with_jmol"));
299 viewerColour.setToolTipText(MessageManager
300 .getString("label.let_jmol_manage_structure_colours"));
301 viewerColour.addActionListener(new ActionListener()
304 public void actionPerformed(ActionEvent actionEvent)
306 viewerColour_actionPerformed(actionEvent);
310 JMenu helpMenu = new JMenu();
311 helpMenu.setText(MessageManager.getString("action.help"));
312 helpItem.setText(MessageManager.getString("label.jmol_help"));
313 helpItem.addActionListener(new ActionListener()
316 public void actionPerformed(ActionEvent actionEvent)
318 showHelp_actionPerformed(actionEvent);
322 .setText(MessageManager.getString("label.align_structures"));
323 alignStructs.addActionListener(new ActionListener()
326 public void actionPerformed(ActionEvent actionEvent)
328 alignStructs_actionPerformed(actionEvent);
331 viewerActionMenu.setText(MessageManager.getString("label.jmol"));
332 menuBar.add(fileMenu);
333 menuBar.add(viewMenu);
334 menuBar.add(colourMenu);
335 menuBar.add(viewerActionMenu);
336 viewerActionMenu.setVisible(false);
337 menuBar.add(helpMenu);
338 fileMenu.add(savemenu);
339 fileMenu.add(viewMapping);
340 savemenu.add(pdbFile);
343 viewMenu.add(chainMenu);
345 colourMenu.add(seqColour);
346 colourMenu.add(chainColour);
347 colourMenu.add(chargeColour);
348 colourMenu.add(zappoColour);
349 colourMenu.add(taylorColour);
350 colourMenu.add(hydroColour);
351 colourMenu.add(helixColour);
352 colourMenu.add(strandColour);
353 colourMenu.add(turnColour);
354 colourMenu.add(buriedColour);
355 colourMenu.add(purinePyrimidineColour);
356 colourMenu.add(userColour);
357 colourMenu.add(viewerColour);
358 colourMenu.add(backGround);
360 ButtonGroup colourButtons = new ButtonGroup();
362 colourButtons.add(seqColour);
363 colourButtons.add(chainColour);
364 colourButtons.add(chargeColour);
365 colourButtons.add(zappoColour);
366 colourButtons.add(taylorColour);
367 colourButtons.add(hydroColour);
368 colourButtons.add(helixColour);
369 colourButtons.add(strandColour);
370 colourButtons.add(turnColour);
371 colourButtons.add(buriedColour);
372 colourButtons.add(purinePyrimidineColour);
373 colourButtons.add(userColour);
374 colourButtons.add(viewerColour);
376 helpMenu.add(helpItem);
377 viewerActionMenu.add(alignStructs);
379 statusPanel.setLayout(new GridLayout());
380 this.getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH);
381 statusPanel.add(statusBar, null);
384 protected void fitToWindow_actionPerformed()
388 protected void highlightSelection_actionPerformed()
392 protected void viewerColour_actionPerformed(ActionEvent actionEvent)
396 protected void alignStructs_actionPerformed(ActionEvent actionEvent)
400 public void pdbFile_actionPerformed(ActionEvent actionEvent)
405 public void png_actionPerformed(ActionEvent actionEvent)
410 public void eps_actionPerformed(ActionEvent actionEvent)
415 public void viewMapping_actionPerformed(ActionEvent actionEvent)
420 public void seqColour_actionPerformed(ActionEvent actionEvent)
425 public void chainColour_actionPerformed(ActionEvent actionEvent)
430 public void chargeColour_actionPerformed(ActionEvent actionEvent)
435 public void zappoColour_actionPerformed(ActionEvent actionEvent)
440 public void taylorColour_actionPerformed(ActionEvent actionEvent)
445 public void hydroColour_actionPerformed(ActionEvent actionEvent)
450 public void helixColour_actionPerformed(ActionEvent actionEvent)
455 public void strandColour_actionPerformed(ActionEvent actionEvent)
460 public void turnColour_actionPerformed(ActionEvent actionEvent)
465 public void buriedColour_actionPerformed(ActionEvent actionEvent)
470 public void purinePyrimidineColour_actionPerformed(ActionEvent actionEvent)
475 public void userColour_actionPerformed(ActionEvent actionEvent)
480 public void backGround_actionPerformed(ActionEvent actionEvent)
485 public void showHelp_actionPerformed(ActionEvent actionEvent)
491 // return bindingModel;
494 // public void setBindingModel(AAStructureBindingModel bindingModel)
496 // this.bindingModel = bindingModel;