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.gui.ColourMenuHelper.ColourChangeListener;
25 import jalview.util.MessageManager;
27 import java.awt.BorderLayout;
28 import java.awt.GridLayout;
29 import java.awt.event.ActionEvent;
30 import java.awt.event.ActionListener;
32 import javax.swing.JCheckBoxMenuItem;
33 import javax.swing.JInternalFrame;
34 import javax.swing.JLabel;
35 import javax.swing.JMenu;
36 import javax.swing.JMenuBar;
37 import javax.swing.JMenuItem;
38 import javax.swing.JPanel;
39 import javax.swing.JRadioButtonMenuItem;
41 public abstract class GStructureViewer extends JInternalFrame
42 implements JalviewStructureDisplayI, ColourChangeListener
44 // private AAStructureBindingModel bindingModel;
46 protected JMenu savemenu;
48 protected JMenu viewMenu;
50 protected JMenu colourMenu;
52 protected JMenu chainMenu;
54 protected JMenu viewerActionMenu;
56 protected JMenuItem alignStructs;
58 protected JCheckBoxMenuItem showAlignmentOnly;
60 protected JMenuItem fitToWindow;
62 protected JRadioButtonMenuItem seqColour;
64 protected JRadioButtonMenuItem chainColour;
66 protected JRadioButtonMenuItem chargeColour;
68 protected JRadioButtonMenuItem viewerColour;
70 protected JMenuItem helpItem;
72 protected JLabel statusBar;
74 protected JPanel statusPanel;
79 public GStructureViewer()
84 } catch (Exception ex)
90 private void jbInit() throws Exception
92 JMenuBar menuBar = new JMenuBar();
93 this.setJMenuBar(menuBar);
95 JMenu fileMenu = new JMenu();
96 fileMenu.setText(MessageManager.getString("action.file"));
98 savemenu = new JMenu();
99 savemenu.setActionCommand(
100 MessageManager.getString("action.save_image"));
101 savemenu.setText(MessageManager.getString("action.save_as"));
103 JMenuItem pdbFile = new JMenuItem();
104 pdbFile.setText(MessageManager.getString("label.pdb_file"));
105 pdbFile.addActionListener(new ActionListener()
108 public void actionPerformed(ActionEvent actionEvent)
110 pdbFile_actionPerformed(actionEvent);
114 JMenuItem png = new JMenuItem();
116 png.addActionListener(new ActionListener()
119 public void actionPerformed(ActionEvent actionEvent)
121 png_actionPerformed(actionEvent);
125 JMenuItem eps = new JMenuItem();
127 eps.addActionListener(new ActionListener()
130 public void actionPerformed(ActionEvent actionEvent)
132 eps_actionPerformed(actionEvent);
136 JMenuItem viewMapping = new JMenuItem();
137 viewMapping.setText(MessageManager.getString("label.view_mapping"));
138 viewMapping.addActionListener(new ActionListener()
141 public void actionPerformed(ActionEvent actionEvent)
143 viewMapping_actionPerformed(actionEvent);
147 viewMenu = new JMenu();
148 viewMenu.setText(MessageManager.getString("action.view"));
150 chainMenu = new JMenu();
151 chainMenu.setText(MessageManager.getString("action.show_chain"));
153 fitToWindow = new JMenuItem();
154 fitToWindow.setText(MessageManager.getString("label.fit_to_window"));
155 fitToWindow.addActionListener(new ActionListener()
158 public void actionPerformed(ActionEvent actionEvent)
160 fitToWindow_actionPerformed();
164 JMenu helpMenu = new JMenu();
165 helpMenu.setText(MessageManager.getString("action.help"));
166 helpItem = new JMenuItem();
167 helpItem.setText(MessageManager.getString("label.jmol_help"));
168 helpItem.addActionListener(new ActionListener()
171 public void actionPerformed(ActionEvent actionEvent)
173 showHelp_actionPerformed(actionEvent);
176 alignStructs = new JMenuItem();
177 alignStructs.setText(
178 MessageManager.getString("label.superpose_structures"));
179 alignStructs.addActionListener(new ActionListener()
182 public void actionPerformed(ActionEvent actionEvent)
184 alignStructs_actionPerformed(actionEvent);
188 viewerActionMenu = new JMenu(); // text set in sub-classes
189 viewerActionMenu.setVisible(false);
190 viewerActionMenu.add(alignStructs);
191 colourMenu = new JMenu();
192 colourMenu.setText(MessageManager.getString("label.colours"));
193 fileMenu.add(savemenu);
194 fileMenu.add(viewMapping);
195 savemenu.add(pdbFile);
198 viewMenu.add(chainMenu);
199 helpMenu.add(helpItem);
201 menuBar.add(fileMenu);
202 menuBar.add(viewMenu);
203 menuBar.add(colourMenu);
204 menuBar.add(viewerActionMenu);
205 menuBar.add(helpMenu);
207 statusPanel = new JPanel();
208 statusPanel.setLayout(new GridLayout());
209 this.getContentPane().add(statusPanel, BorderLayout.SOUTH);
210 statusBar = new JLabel();
211 statusPanel.add(statusBar, null);
214 protected void fitToWindow_actionPerformed()
218 protected void highlightSelection_actionPerformed()
222 protected void viewerColour_actionPerformed(ActionEvent actionEvent)
226 protected abstract String alignStructs_actionPerformed(
227 ActionEvent actionEvent);
229 public void pdbFile_actionPerformed(ActionEvent actionEvent)
234 public void png_actionPerformed(ActionEvent actionEvent)
239 public void eps_actionPerformed(ActionEvent actionEvent)
244 public void viewMapping_actionPerformed(ActionEvent actionEvent)
249 public void seqColour_actionPerformed(ActionEvent actionEvent)
254 public void chainColour_actionPerformed(ActionEvent actionEvent)
259 public void chargeColour_actionPerformed(ActionEvent actionEvent)
264 public void background_actionPerformed(ActionEvent actionEvent)
269 public void showHelp_actionPerformed(ActionEvent actionEvent)