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.GridLayout;
24 import java.awt.event.ActionEvent;
25 import java.awt.event.ActionListener;
27 import javax.swing.ButtonGroup;
28 import javax.swing.JInternalFrame;
29 import javax.swing.JLabel;
30 import javax.swing.JMenu;
31 import javax.swing.JMenuBar;
32 import javax.swing.JMenuItem;
33 import javax.swing.JPanel;
34 import javax.swing.JRadioButtonMenuItem;
36 import jalview.api.structures.JalviewStructureDisplayI;
37 import jalview.util.MessageManager;
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();
169 backGround.setText(MessageManager.getString("action.background_colour"));
170 backGround.addActionListener(new ActionListener()
172 public void actionPerformed(ActionEvent actionEvent)
174 backGround_actionPerformed(actionEvent);
177 seqColour.setSelected(false);
178 seqColour.setText(MessageManager.getString("action.by_sequence"));
179 seqColour.addActionListener(new ActionListener()
181 public void actionPerformed(ActionEvent actionEvent)
183 seqColour_actionPerformed(actionEvent);
186 chainColour.setText(MessageManager.getString("action.by_chain"));
187 chainColour.addActionListener(new ActionListener()
189 public void actionPerformed(ActionEvent actionEvent)
191 chainColour_actionPerformed(actionEvent);
194 chargeColour.setText(MessageManager.getString("label.charge_cysteine"));
195 chargeColour.addActionListener(new ActionListener()
197 public void actionPerformed(ActionEvent actionEvent)
199 chargeColour_actionPerformed(actionEvent);
202 zappoColour.setText(MessageManager.getString("label.zappo"));
203 zappoColour.addActionListener(new ActionListener()
205 public void actionPerformed(ActionEvent actionEvent)
207 zappoColour_actionPerformed(actionEvent);
210 taylorColour.setText(MessageManager.getString("label.taylor"));
211 taylorColour.addActionListener(new ActionListener()
213 public void actionPerformed(ActionEvent actionEvent)
215 taylorColour_actionPerformed(actionEvent);
218 hydroColour.setText(MessageManager.getString("label.hydrophobicity"));
219 hydroColour.addActionListener(new ActionListener()
221 public void actionPerformed(ActionEvent actionEvent)
223 hydroColour_actionPerformed(actionEvent);
226 strandColour.setText(MessageManager
227 .getString("label.strand_propensity"));
228 strandColour.addActionListener(new ActionListener()
230 public void actionPerformed(ActionEvent actionEvent)
232 strandColour_actionPerformed(actionEvent);
235 helixColour.setText(MessageManager.getString("label.helix_propensity"));
236 helixColour.addActionListener(new ActionListener()
238 public void actionPerformed(ActionEvent actionEvent)
240 helixColour_actionPerformed(actionEvent);
243 turnColour.setText(MessageManager.getString("label.turn_propensity"));
244 turnColour.addActionListener(new ActionListener()
246 public void actionPerformed(ActionEvent actionEvent)
248 turnColour_actionPerformed(actionEvent);
251 buriedColour.setText(MessageManager.getString("label.buried_index"));
252 buriedColour.addActionListener(new ActionListener()
254 public void actionPerformed(ActionEvent actionEvent)
256 buriedColour_actionPerformed(actionEvent);
259 purinePyrimidineColour.setText(MessageManager
260 .getString("label.purine_pyrimidine"));
261 purinePyrimidineColour.addActionListener(new ActionListener()
263 public void actionPerformed(ActionEvent actionEvent)
265 purinePyrimidineColour_actionPerformed(actionEvent);
269 userColour.setText(MessageManager.getString("action.user_defined"));
270 userColour.addActionListener(new ActionListener()
272 public void actionPerformed(ActionEvent actionEvent)
274 userColour_actionPerformed(actionEvent);
277 viewerColour.setSelected(false);
279 .setText(MessageManager.getString("label.colour_with_jmol"));
280 viewerColour.setToolTipText(MessageManager
281 .getString("label.let_jmol_manage_structure_colours"));
282 viewerColour.addActionListener(new ActionListener()
284 public void actionPerformed(ActionEvent actionEvent)
286 viewerColour_actionPerformed(actionEvent);
290 JMenu helpMenu = new JMenu();
291 helpMenu.setText(MessageManager.getString("action.help"));
292 helpItem.setText(MessageManager.getString("label.jmol_help"));
293 helpItem.addActionListener(new ActionListener()
295 public void actionPerformed(ActionEvent actionEvent)
297 showHelp_actionPerformed(actionEvent);
301 .setText(MessageManager.getString("label.align_structures"));
302 alignStructs.addActionListener(new ActionListener()
304 public void actionPerformed(ActionEvent actionEvent)
306 alignStructs_actionPerformed(actionEvent);
309 viewerActionMenu.setText(MessageManager.getString("label.jmol"));
310 menuBar.add(fileMenu);
311 menuBar.add(viewMenu);
312 menuBar.add(colourMenu);
313 menuBar.add(viewerActionMenu);
314 viewerActionMenu.setVisible(false);
315 menuBar.add(helpMenu);
316 fileMenu.add(savemenu);
317 fileMenu.add(viewMapping);
318 savemenu.add(pdbFile);
321 viewMenu.add(chainMenu);
323 colourMenu.add(seqColour);
324 colourMenu.add(chainColour);
325 colourMenu.add(chargeColour);
326 colourMenu.add(zappoColour);
327 colourMenu.add(taylorColour);
328 colourMenu.add(hydroColour);
329 colourMenu.add(helixColour);
330 colourMenu.add(strandColour);
331 colourMenu.add(turnColour);
332 colourMenu.add(buriedColour);
333 colourMenu.add(purinePyrimidineColour);
334 colourMenu.add(userColour);
335 colourMenu.add(viewerColour);
336 colourMenu.add(backGround);
338 ButtonGroup colourButtons = new ButtonGroup();
340 colourButtons.add(seqColour);
341 colourButtons.add(chainColour);
342 colourButtons.add(chargeColour);
343 colourButtons.add(zappoColour);
344 colourButtons.add(taylorColour);
345 colourButtons.add(hydroColour);
346 colourButtons.add(helixColour);
347 colourButtons.add(strandColour);
348 colourButtons.add(turnColour);
349 colourButtons.add(buriedColour);
350 colourButtons.add(purinePyrimidineColour);
351 colourButtons.add(userColour);
352 colourButtons.add(viewerColour);
354 helpMenu.add(helpItem);
355 viewerActionMenu.add(alignStructs);
357 statusPanel.setLayout(new GridLayout());
358 this.getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH);
359 statusPanel.add(statusBar, null);
362 protected void fitToWindow_actionPerformed()
366 protected void viewerColour_actionPerformed(ActionEvent actionEvent)
370 protected void alignStructs_actionPerformed(ActionEvent actionEvent)
374 public void pdbFile_actionPerformed(ActionEvent actionEvent)
379 public void png_actionPerformed(ActionEvent actionEvent)
384 public void eps_actionPerformed(ActionEvent actionEvent)
389 public void viewMapping_actionPerformed(ActionEvent actionEvent)
394 public void seqColour_actionPerformed(ActionEvent actionEvent)
399 public void chainColour_actionPerformed(ActionEvent actionEvent)
404 public void chargeColour_actionPerformed(ActionEvent actionEvent)
409 public void zappoColour_actionPerformed(ActionEvent actionEvent)
414 public void taylorColour_actionPerformed(ActionEvent actionEvent)
419 public void hydroColour_actionPerformed(ActionEvent actionEvent)
424 public void helixColour_actionPerformed(ActionEvent actionEvent)
429 public void strandColour_actionPerformed(ActionEvent actionEvent)
434 public void turnColour_actionPerformed(ActionEvent actionEvent)
439 public void buriedColour_actionPerformed(ActionEvent actionEvent)
444 public void purinePyrimidineColour_actionPerformed(ActionEvent actionEvent)
449 public void userColour_actionPerformed(ActionEvent actionEvent)
454 public void backGround_actionPerformed(ActionEvent actionEvent)
459 public void showHelp_actionPerformed(ActionEvent actionEvent)
465 // return bindingModel;
468 // public void setBindingModel(AAStructureBindingModel bindingModel)
470 // this.bindingModel = bindingModel;