2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3 * Copyright (C) 2014 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.event.ActionEvent;
27 import java.awt.event.ActionListener;
29 import javax.swing.ButtonGroup;
30 import javax.swing.JInternalFrame;
31 import javax.swing.JMenu;
32 import javax.swing.JMenuBar;
33 import javax.swing.JMenuItem;
34 import javax.swing.JRadioButtonMenuItem;
36 public abstract class GStructureViewer extends JInternalFrame implements
37 JalviewStructureDisplayI
39 // private AAStructureBindingModel bindingModel;
41 protected JMenu savemenu = new JMenu();
43 protected JMenu viewMenu = new JMenu();
45 protected JMenu chainMenu = new JMenu();
47 protected JMenu viewerActionMenu = new JMenu();
49 protected JMenuItem alignStructs = new JMenuItem();
51 protected JRadioButtonMenuItem seqColour = new JRadioButtonMenuItem();
53 protected JRadioButtonMenuItem chainColour = new JRadioButtonMenuItem();
55 protected JRadioButtonMenuItem chargeColour = new JRadioButtonMenuItem();
57 protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem();
59 protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem();
61 protected JRadioButtonMenuItem hydroColour = new JRadioButtonMenuItem();
63 protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem();
65 protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem();
67 protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();
69 protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem();
71 protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
73 protected JRadioButtonMenuItem userColour = new JRadioButtonMenuItem();
75 protected JRadioButtonMenuItem viewerColour = new JRadioButtonMenuItem();
77 protected JMenuItem helpItem = new JMenuItem();
82 public GStructureViewer()
87 } catch (Exception ex)
93 private void jbInit() throws Exception
95 JMenuBar menuBar = new JMenuBar();
96 this.setJMenuBar(menuBar);
98 JMenu fileMenu = new JMenu();
99 fileMenu.setText(MessageManager.getString("action.file"));
101 savemenu.setActionCommand(MessageManager.getString("action.save_image"));
102 savemenu.setText(MessageManager.getString("action.save_as"));
104 JMenuItem pdbFile = new JMenuItem();
105 pdbFile.setText(MessageManager.getString("label.pdb_file"));
106 pdbFile.addActionListener(new ActionListener()
108 public void actionPerformed(ActionEvent actionEvent)
110 pdbFile_actionPerformed(actionEvent);
114 JMenuItem png = new JMenuItem();
116 png.addActionListener(new ActionListener()
118 public void actionPerformed(ActionEvent actionEvent)
120 png_actionPerformed(actionEvent);
124 JMenuItem eps = new JMenuItem();
126 eps.addActionListener(new ActionListener()
128 public void actionPerformed(ActionEvent actionEvent)
130 eps_actionPerformed(actionEvent);
134 JMenuItem viewMapping = new JMenuItem();
135 viewMapping.setText(MessageManager.getString("label.view_mapping"));
136 viewMapping.addActionListener(new ActionListener()
138 public void actionPerformed(ActionEvent actionEvent)
140 viewMapping_actionPerformed(actionEvent);
143 viewMenu.setText(MessageManager.getString("action.view"));
144 chainMenu.setText(MessageManager.getString("action.show_chain"));
146 JMenu colourMenu = new JMenu();
147 colourMenu.setText(MessageManager.getString("label.colours"));
149 JMenuItem backGround = new JMenuItem();
150 backGround.setText(MessageManager.getString("label.background_colour")
152 backGround.addActionListener(new ActionListener()
154 public void actionPerformed(ActionEvent actionEvent)
156 backGround_actionPerformed(actionEvent);
159 seqColour.setSelected(false);
160 seqColour.setText(MessageManager.getString("action.by_sequence"));
161 seqColour.addActionListener(new ActionListener()
163 public void actionPerformed(ActionEvent actionEvent)
165 seqColour_actionPerformed(actionEvent);
168 chainColour.setText(MessageManager.getString("action.by_chain"));
169 chainColour.addActionListener(new ActionListener()
171 public void actionPerformed(ActionEvent actionEvent)
173 chainColour_actionPerformed(actionEvent);
176 chargeColour.setText(MessageManager.getString("label.charge_cysteine"));
177 chargeColour.addActionListener(new ActionListener()
179 public void actionPerformed(ActionEvent actionEvent)
181 chargeColour_actionPerformed(actionEvent);
184 zappoColour.setText(MessageManager.getString("label.zappo"));
185 zappoColour.addActionListener(new ActionListener()
187 public void actionPerformed(ActionEvent actionEvent)
189 zappoColour_actionPerformed(actionEvent);
192 taylorColour.setText(MessageManager.getString("label.taylor"));
193 taylorColour.addActionListener(new ActionListener()
195 public void actionPerformed(ActionEvent actionEvent)
197 taylorColour_actionPerformed(actionEvent);
200 hydroColour.setText(MessageManager.getString("label.hydrophobicity"));
201 hydroColour.addActionListener(new ActionListener()
203 public void actionPerformed(ActionEvent actionEvent)
205 hydroColour_actionPerformed(actionEvent);
208 strandColour.setText(MessageManager
209 .getString("label.strand_propensity"));
210 strandColour.addActionListener(new ActionListener()
212 public void actionPerformed(ActionEvent actionEvent)
214 strandColour_actionPerformed(actionEvent);
217 helixColour.setText(MessageManager.getString("label.helix_propensity"));
218 helixColour.addActionListener(new ActionListener()
220 public void actionPerformed(ActionEvent actionEvent)
222 helixColour_actionPerformed(actionEvent);
225 turnColour.setText(MessageManager.getString("label.turn_propensity"));
226 turnColour.addActionListener(new ActionListener()
228 public void actionPerformed(ActionEvent actionEvent)
230 turnColour_actionPerformed(actionEvent);
233 buriedColour.setText(MessageManager.getString("label.buried_index"));
234 buriedColour.addActionListener(new ActionListener()
236 public void actionPerformed(ActionEvent actionEvent)
238 buriedColour_actionPerformed(actionEvent);
241 purinePyrimidineColour.setText(MessageManager
242 .getString("label.purine_pyrimidine"));
243 purinePyrimidineColour.addActionListener(new ActionListener()
245 public void actionPerformed(ActionEvent actionEvent)
247 purinePyrimidineColour_actionPerformed(actionEvent);
251 userColour.setText(MessageManager.getString("action.user_defined"));
252 userColour.addActionListener(new ActionListener()
254 public void actionPerformed(ActionEvent actionEvent)
256 userColour_actionPerformed(actionEvent);
259 viewerColour.setSelected(false);
261 .setText(MessageManager.getString("label.colour_with_jmol"));
262 viewerColour.setToolTipText(MessageManager
263 .getString("label.let_jmol_manage_structure_colours"));
264 viewerColour.addActionListener(new ActionListener()
266 public void actionPerformed(ActionEvent actionEvent)
268 viewerColour_actionPerformed(actionEvent);
272 JMenu helpMenu = new JMenu();
273 helpMenu.setText(MessageManager.getString("action.help"));
274 helpItem.setText(MessageManager.getString("label.jmol_help"));
275 helpItem.addActionListener(new ActionListener()
277 public void actionPerformed(ActionEvent actionEvent)
279 showHelp_actionPerformed(actionEvent);
283 .setText(MessageManager.getString("label.align_structures"));
284 alignStructs.addActionListener(new ActionListener()
286 public void actionPerformed(ActionEvent actionEvent)
288 alignStructs_actionPerformed(actionEvent);
291 viewerActionMenu.setText(MessageManager.getString("label.jmol"));
292 menuBar.add(fileMenu);
293 menuBar.add(viewMenu);
294 menuBar.add(colourMenu);
295 menuBar.add(viewerActionMenu);
296 viewerActionMenu.setVisible(false);
297 menuBar.add(helpMenu);
298 fileMenu.add(savemenu);
299 fileMenu.add(viewMapping);
300 savemenu.add(pdbFile);
303 viewMenu.add(chainMenu);
305 colourMenu.add(seqColour);
306 colourMenu.add(chainColour);
307 colourMenu.add(chargeColour);
308 colourMenu.add(zappoColour);
309 colourMenu.add(taylorColour);
310 colourMenu.add(hydroColour);
311 colourMenu.add(helixColour);
312 colourMenu.add(strandColour);
313 colourMenu.add(turnColour);
314 colourMenu.add(buriedColour);
315 colourMenu.add(purinePyrimidineColour);
316 colourMenu.add(userColour);
317 colourMenu.add(viewerColour);
318 colourMenu.add(backGround);
320 ButtonGroup colourButtons = new ButtonGroup();
322 colourButtons.add(seqColour);
323 colourButtons.add(chainColour);
324 colourButtons.add(chargeColour);
325 colourButtons.add(zappoColour);
326 colourButtons.add(taylorColour);
327 colourButtons.add(hydroColour);
328 colourButtons.add(helixColour);
329 colourButtons.add(strandColour);
330 colourButtons.add(turnColour);
331 colourButtons.add(buriedColour);
332 colourButtons.add(userColour);
333 colourButtons.add(viewerColour);
335 helpMenu.add(helpItem);
336 viewerActionMenu.add(alignStructs);
339 protected void viewerColour_actionPerformed(ActionEvent actionEvent)
343 protected void alignStructs_actionPerformed(ActionEvent actionEvent)
347 public void pdbFile_actionPerformed(ActionEvent actionEvent)
352 public void png_actionPerformed(ActionEvent actionEvent)
357 public void eps_actionPerformed(ActionEvent actionEvent)
362 public void viewMapping_actionPerformed(ActionEvent actionEvent)
367 public void seqColour_actionPerformed(ActionEvent actionEvent)
372 public void chainColour_actionPerformed(ActionEvent actionEvent)
377 public void chargeColour_actionPerformed(ActionEvent actionEvent)
382 public void zappoColour_actionPerformed(ActionEvent actionEvent)
387 public void taylorColour_actionPerformed(ActionEvent actionEvent)
392 public void hydroColour_actionPerformed(ActionEvent actionEvent)
397 public void helixColour_actionPerformed(ActionEvent actionEvent)
402 public void strandColour_actionPerformed(ActionEvent actionEvent)
407 public void turnColour_actionPerformed(ActionEvent actionEvent)
412 public void buriedColour_actionPerformed(ActionEvent actionEvent)
417 public void purinePyrimidineColour_actionPerformed(ActionEvent actionEvent)
422 public void userColour_actionPerformed(ActionEvent actionEvent)
427 public void backGround_actionPerformed(ActionEvent actionEvent)
432 public void showHelp_actionPerformed(ActionEvent actionEvent)
438 // return bindingModel;
441 // public void setBindingModel(AAStructureBindingModel bindingModel)
443 // this.bindingModel = bindingModel;