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.JInternalFrame;
33 import javax.swing.JLabel;
34 import javax.swing.JMenu;
35 import javax.swing.JMenuBar;
36 import javax.swing.JMenuItem;
37 import javax.swing.JPanel;
38 import javax.swing.JRadioButtonMenuItem;
40 public abstract class GStructureViewer extends JInternalFrame implements
41 JalviewStructureDisplayI, ColourChangeListener
43 // private AAStructureBindingModel bindingModel;
45 protected JMenu savemenu;
47 protected JMenu viewMenu;
49 protected JMenu colourMenu;
51 protected JMenu chainMenu;
53 protected JMenu viewerActionMenu;
55 protected JMenuItem alignStructs;
57 protected JMenuItem fitToWindow;
59 protected JRadioButtonMenuItem seqColour;
61 protected JRadioButtonMenuItem chainColour;
63 protected JRadioButtonMenuItem chargeColour;
65 protected JRadioButtonMenuItem viewerColour;
67 protected JMenuItem helpItem;
69 protected JLabel statusBar;
71 protected JPanel statusPanel;
76 public GStructureViewer()
81 } catch (Exception ex)
87 private void jbInit() throws Exception
89 JMenuBar menuBar = new JMenuBar();
90 this.setJMenuBar(menuBar);
92 JMenu fileMenu = new JMenu();
93 fileMenu.setText(MessageManager.getString("action.file"));
95 savemenu = new JMenu();
96 savemenu.setActionCommand(MessageManager.getString("action.save_image"));
97 savemenu.setText(MessageManager.getString("action.save_as"));
99 JMenuItem pdbFile = new JMenuItem();
100 pdbFile.setText(MessageManager.getString("label.pdb_file"));
101 pdbFile.addActionListener(new ActionListener()
104 public void actionPerformed(ActionEvent actionEvent)
106 pdbFile_actionPerformed(actionEvent);
110 JMenuItem png = new JMenuItem();
112 png.addActionListener(new ActionListener()
115 public void actionPerformed(ActionEvent actionEvent)
117 png_actionPerformed(actionEvent);
121 JMenuItem eps = new JMenuItem();
123 eps.addActionListener(new ActionListener()
126 public void actionPerformed(ActionEvent actionEvent)
128 eps_actionPerformed(actionEvent);
132 JMenuItem viewMapping = new JMenuItem();
133 viewMapping.setText(MessageManager.getString("label.view_mapping"));
134 viewMapping.addActionListener(new ActionListener()
137 public void actionPerformed(ActionEvent actionEvent)
139 viewMapping_actionPerformed(actionEvent);
143 viewMenu = new JMenu();
144 viewMenu.setText(MessageManager.getString("action.view"));
146 chainMenu = new JMenu();
147 chainMenu.setText(MessageManager.getString("action.show_chain"));
149 fitToWindow = new JMenuItem();
150 fitToWindow.setText(MessageManager.getString("label.fit_to_window"));
151 fitToWindow.addActionListener(new ActionListener()
154 public void actionPerformed(ActionEvent actionEvent)
156 fitToWindow_actionPerformed();
160 JMenu helpMenu = new JMenu();
161 helpMenu.setText(MessageManager.getString("action.help"));
162 helpItem = new JMenuItem();
163 helpItem.setText(MessageManager.getString("label.jmol_help"));
164 helpItem.addActionListener(new ActionListener()
167 public void actionPerformed(ActionEvent actionEvent)
169 showHelp_actionPerformed(actionEvent);
172 alignStructs = new JMenuItem();
173 alignStructs.setText(MessageManager
174 .getString("label.superpose_structures"));
175 alignStructs.addActionListener(new ActionListener()
178 public void actionPerformed(ActionEvent actionEvent)
180 alignStructs_actionPerformed(actionEvent);
184 viewerActionMenu = new JMenu(); // text set in sub-classes
185 viewerActionMenu.setVisible(false);
186 viewerActionMenu.add(alignStructs);
187 colourMenu = new JMenu();
188 colourMenu.setText(MessageManager.getString("label.colours"));
189 fileMenu.add(savemenu);
190 fileMenu.add(viewMapping);
191 savemenu.add(pdbFile);
194 viewMenu.add(chainMenu);
195 helpMenu.add(helpItem);
197 menuBar.add(fileMenu);
198 menuBar.add(viewMenu);
199 menuBar.add(colourMenu);
200 menuBar.add(viewerActionMenu);
201 menuBar.add(helpMenu);
203 statusPanel = new JPanel();
204 statusPanel.setLayout(new GridLayout());
205 this.getContentPane().add(statusPanel, BorderLayout.SOUTH);
206 statusBar = new JLabel();
207 statusPanel.add(statusBar, null);
210 protected void fitToWindow_actionPerformed()
214 protected void highlightSelection_actionPerformed()
218 protected void viewerColour_actionPerformed(ActionEvent actionEvent)
222 protected abstract String alignStructs_actionPerformed(
223 ActionEvent actionEvent);
225 public void pdbFile_actionPerformed(ActionEvent actionEvent)
230 public void png_actionPerformed(ActionEvent actionEvent)
235 public void eps_actionPerformed(ActionEvent actionEvent)
240 public void viewMapping_actionPerformed(ActionEvent actionEvent)
245 public void seqColour_actionPerformed(ActionEvent actionEvent)
250 public void chainColour_actionPerformed(ActionEvent actionEvent)
255 public void chargeColour_actionPerformed(ActionEvent actionEvent)
260 public void background_actionPerformed(ActionEvent actionEvent)
265 public void showHelp_actionPerformed(ActionEvent actionEvent)