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 JMenuItem highlightSelection = new JMenuItem();
58 protected JRadioButtonMenuItem seqColour = new JRadioButtonMenuItem();
60 protected JRadioButtonMenuItem chainColour = new JRadioButtonMenuItem();
62 protected JRadioButtonMenuItem chargeColour = new JRadioButtonMenuItem();
64 protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem();
66 protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem();
68 protected JRadioButtonMenuItem hydroColour = new JRadioButtonMenuItem();
70 protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem();
72 protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem();
74 protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();
76 protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem();
78 protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
80 protected JRadioButtonMenuItem userColour = new JRadioButtonMenuItem();
82 protected JRadioButtonMenuItem viewerColour = new JRadioButtonMenuItem();
84 protected JMenuItem helpItem = new JMenuItem();
86 protected JLabel statusBar = new JLabel();
88 protected JPanel statusPanel = new JPanel();
93 public GStructureViewer()
98 } catch (Exception ex)
100 ex.printStackTrace();
104 private void jbInit() throws Exception
106 JMenuBar menuBar = new JMenuBar();
107 this.setJMenuBar(menuBar);
109 JMenu fileMenu = new JMenu();
110 fileMenu.setText(MessageManager.getString("action.file"));
112 savemenu.setActionCommand(MessageManager.getString("action.save_image"));
113 savemenu.setText(MessageManager.getString("action.save_as"));
115 JMenuItem pdbFile = new JMenuItem();
116 pdbFile.setText(MessageManager.getString("label.pdb_file"));
117 pdbFile.addActionListener(new ActionListener()
120 public void actionPerformed(ActionEvent actionEvent)
122 pdbFile_actionPerformed(actionEvent);
126 JMenuItem png = new JMenuItem();
128 png.addActionListener(new ActionListener()
131 public void actionPerformed(ActionEvent actionEvent)
133 png_actionPerformed(actionEvent);
137 JMenuItem eps = new JMenuItem();
139 eps.addActionListener(new ActionListener()
142 public void actionPerformed(ActionEvent actionEvent)
144 eps_actionPerformed(actionEvent);
148 JMenuItem viewMapping = new JMenuItem();
149 viewMapping.setText(MessageManager.getString("label.view_mapping"));
150 viewMapping.addActionListener(new ActionListener()
153 public void actionPerformed(ActionEvent actionEvent)
155 viewMapping_actionPerformed(actionEvent);
158 viewMenu.setText(MessageManager.getString("action.view"));
160 chainMenu.setText(MessageManager.getString("action.show_chain"));
162 fitToWindow.setText(MessageManager.getString("label.fit_to_window"));
163 fitToWindow.addActionListener(new ActionListener()
166 public void actionPerformed(ActionEvent actionEvent)
168 fitToWindow_actionPerformed();
172 highlightSelection.setText(MessageManager
173 .getString("label.highlight_selection"));
174 highlightSelection.addActionListener(new ActionListener()
177 public void actionPerformed(ActionEvent actionEvent)
179 highlightSelection_actionPerformed();
183 JMenu colourMenu = new JMenu();
184 colourMenu.setText(MessageManager.getString("label.colours"));
186 JMenuItem backGround = new JMenuItem();
188 .setText(MessageManager.getString("action.background_colour"));
189 backGround.addActionListener(new ActionListener()
192 public void actionPerformed(ActionEvent actionEvent)
194 backGround_actionPerformed(actionEvent);
197 seqColour.setSelected(false);
198 seqColour.setText(MessageManager.getString("action.by_sequence"));
199 seqColour.addActionListener(new ActionListener()
202 public void actionPerformed(ActionEvent actionEvent)
204 seqColour_actionPerformed(actionEvent);
207 chainColour.setText(MessageManager.getString("action.by_chain"));
208 chainColour.addActionListener(new ActionListener()
211 public void actionPerformed(ActionEvent actionEvent)
213 chainColour_actionPerformed(actionEvent);
216 chargeColour.setText(MessageManager.getString("label.charge_cysteine"));
217 chargeColour.addActionListener(new ActionListener()
220 public void actionPerformed(ActionEvent actionEvent)
222 chargeColour_actionPerformed(actionEvent);
225 zappoColour.setText(MessageManager.getString("label.zappo"));
226 zappoColour.addActionListener(new ActionListener()
229 public void actionPerformed(ActionEvent actionEvent)
231 zappoColour_actionPerformed(actionEvent);
234 taylorColour.setText(MessageManager.getString("label.taylor"));
235 taylorColour.addActionListener(new ActionListener()
238 public void actionPerformed(ActionEvent actionEvent)
240 taylorColour_actionPerformed(actionEvent);
243 hydroColour.setText(MessageManager.getString("label.hydrophobicity"));
244 hydroColour.addActionListener(new ActionListener()
247 public void actionPerformed(ActionEvent actionEvent)
249 hydroColour_actionPerformed(actionEvent);
252 strandColour.setText(MessageManager
253 .getString("label.strand_propensity"));
254 strandColour.addActionListener(new ActionListener()
257 public void actionPerformed(ActionEvent actionEvent)
259 strandColour_actionPerformed(actionEvent);
262 helixColour.setText(MessageManager.getString("label.helix_propensity"));
263 helixColour.addActionListener(new ActionListener()
266 public void actionPerformed(ActionEvent actionEvent)
268 helixColour_actionPerformed(actionEvent);
271 turnColour.setText(MessageManager.getString("label.turn_propensity"));
272 turnColour.addActionListener(new ActionListener()
275 public void actionPerformed(ActionEvent actionEvent)
277 turnColour_actionPerformed(actionEvent);
280 buriedColour.setText(MessageManager.getString("label.buried_index"));
281 buriedColour.addActionListener(new ActionListener()
284 public void actionPerformed(ActionEvent actionEvent)
286 buriedColour_actionPerformed(actionEvent);
289 purinePyrimidineColour.setText(MessageManager
290 .getString("label.purine_pyrimidine"));
291 purinePyrimidineColour.addActionListener(new ActionListener()
294 public void actionPerformed(ActionEvent actionEvent)
296 purinePyrimidineColour_actionPerformed(actionEvent);
300 userColour.setText(MessageManager.getString("action.user_defined"));
301 userColour.addActionListener(new ActionListener()
304 public void actionPerformed(ActionEvent actionEvent)
306 userColour_actionPerformed(actionEvent);
309 viewerColour.setSelected(false);
311 .setText(MessageManager.getString("label.colour_with_jmol"));
312 viewerColour.setToolTipText(MessageManager
313 .getString("label.let_jmol_manage_structure_colours"));
314 viewerColour.addActionListener(new ActionListener()
317 public void actionPerformed(ActionEvent actionEvent)
319 viewerColour_actionPerformed(actionEvent);
323 JMenu helpMenu = new JMenu();
324 helpMenu.setText(MessageManager.getString("action.help"));
325 helpItem.setText(MessageManager.getString("label.jmol_help"));
326 helpItem.addActionListener(new ActionListener()
329 public void actionPerformed(ActionEvent actionEvent)
331 showHelp_actionPerformed(actionEvent);
335 .setText(MessageManager.getString("label.align_structures"));
336 alignStructs.addActionListener(new ActionListener()
339 public void actionPerformed(ActionEvent actionEvent)
341 alignStructs_actionPerformed(actionEvent);
344 viewerActionMenu.setText(MessageManager.getString("label.jmol"));
345 menuBar.add(fileMenu);
346 menuBar.add(viewMenu);
347 menuBar.add(colourMenu);
348 menuBar.add(viewerActionMenu);
349 viewerActionMenu.setVisible(false);
350 menuBar.add(helpMenu);
351 fileMenu.add(savemenu);
352 fileMenu.add(viewMapping);
353 savemenu.add(pdbFile);
356 viewMenu.add(chainMenu);
358 colourMenu.add(seqColour);
359 colourMenu.add(chainColour);
360 colourMenu.add(chargeColour);
361 colourMenu.add(zappoColour);
362 colourMenu.add(taylorColour);
363 colourMenu.add(hydroColour);
364 colourMenu.add(helixColour);
365 colourMenu.add(strandColour);
366 colourMenu.add(turnColour);
367 colourMenu.add(buriedColour);
368 colourMenu.add(purinePyrimidineColour);
369 colourMenu.add(userColour);
370 colourMenu.add(viewerColour);
371 colourMenu.add(backGround);
373 ButtonGroup colourButtons = new ButtonGroup();
375 colourButtons.add(seqColour);
376 colourButtons.add(chainColour);
377 colourButtons.add(chargeColour);
378 colourButtons.add(zappoColour);
379 colourButtons.add(taylorColour);
380 colourButtons.add(hydroColour);
381 colourButtons.add(helixColour);
382 colourButtons.add(strandColour);
383 colourButtons.add(turnColour);
384 colourButtons.add(buriedColour);
385 colourButtons.add(purinePyrimidineColour);
386 colourButtons.add(userColour);
387 colourButtons.add(viewerColour);
389 helpMenu.add(helpItem);
390 viewerActionMenu.add(alignStructs);
392 statusPanel.setLayout(new GridLayout());
393 this.getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH);
394 statusPanel.add(statusBar, null);
397 protected void fitToWindow_actionPerformed()
401 protected void highlightSelection_actionPerformed()
405 protected void viewerColour_actionPerformed(ActionEvent actionEvent)
409 protected void alignStructs_actionPerformed(ActionEvent actionEvent)
413 public void pdbFile_actionPerformed(ActionEvent actionEvent)
418 public void png_actionPerformed(ActionEvent actionEvent)
423 public void eps_actionPerformed(ActionEvent actionEvent)
428 public void viewMapping_actionPerformed(ActionEvent actionEvent)
433 public void seqColour_actionPerformed(ActionEvent actionEvent)
438 public void chainColour_actionPerformed(ActionEvent actionEvent)
443 public void chargeColour_actionPerformed(ActionEvent actionEvent)
448 public void zappoColour_actionPerformed(ActionEvent actionEvent)
453 public void taylorColour_actionPerformed(ActionEvent actionEvent)
458 public void hydroColour_actionPerformed(ActionEvent actionEvent)
463 public void helixColour_actionPerformed(ActionEvent actionEvent)
468 public void strandColour_actionPerformed(ActionEvent actionEvent)
473 public void turnColour_actionPerformed(ActionEvent actionEvent)
478 public void buriedColour_actionPerformed(ActionEvent actionEvent)
483 public void purinePyrimidineColour_actionPerformed(ActionEvent actionEvent)
488 public void userColour_actionPerformed(ActionEvent actionEvent)
493 public void backGround_actionPerformed(ActionEvent actionEvent)
498 public void showHelp_actionPerformed(ActionEvent actionEvent)
504 // return bindingModel;
507 // public void setBindingModel(AAStructureBindingModel bindingModel)
509 // this.bindingModel = bindingModel;