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
41 implements 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(
97 MessageManager.getString("action.save_image"));
98 savemenu.setText(MessageManager.getString("action.save_as"));
100 JMenuItem pdbFile = new JMenuItem();
101 pdbFile.setText(MessageManager.getString("label.pdb_file"));
102 pdbFile.addActionListener(new ActionListener()
105 public void actionPerformed(ActionEvent actionEvent)
107 pdbFile_actionPerformed(actionEvent);
111 JMenuItem png = new JMenuItem();
113 png.addActionListener(new ActionListener()
116 public void actionPerformed(ActionEvent actionEvent)
118 png_actionPerformed(actionEvent);
122 JMenuItem eps = new JMenuItem();
124 eps.addActionListener(new ActionListener()
127 public void actionPerformed(ActionEvent actionEvent)
129 eps_actionPerformed(actionEvent);
133 JMenuItem viewMapping = new JMenuItem();
134 viewMapping.setText(MessageManager.getString("label.view_mapping"));
135 viewMapping.addActionListener(new ActionListener()
138 public void actionPerformed(ActionEvent actionEvent)
140 viewMapping_actionPerformed(actionEvent);
144 viewMenu = new JMenu();
145 viewMenu.setText(MessageManager.getString("action.view"));
147 chainMenu = new JMenu();
148 chainMenu.setText(MessageManager.getString("action.show_chain"));
150 fitToWindow = new JMenuItem();
151 fitToWindow.setText(MessageManager.getString("label.fit_to_window"));
152 fitToWindow.addActionListener(new ActionListener()
155 public void actionPerformed(ActionEvent actionEvent)
157 fitToWindow_actionPerformed();
161 JMenu helpMenu = new JMenu();
162 helpMenu.setText(MessageManager.getString("action.help"));
163 helpItem = new JMenuItem();
164 helpItem.setText(MessageManager.getString("label.jmol_help"));
165 helpItem.addActionListener(new ActionListener()
168 public void actionPerformed(ActionEvent actionEvent)
170 showHelp_actionPerformed(actionEvent);
173 alignStructs = new JMenuItem();
174 alignStructs.setText(
175 MessageManager.getString("label.superpose_structures"));
176 alignStructs.addActionListener(new ActionListener()
179 public void actionPerformed(ActionEvent actionEvent)
181 alignStructs_actionPerformed(actionEvent);
185 viewerActionMenu = new JMenu(); // text set in sub-classes
186 viewerActionMenu.setVisible(false);
187 viewerActionMenu.add(alignStructs);
188 colourMenu = new JMenu();
189 colourMenu.setText(MessageManager.getString("label.colours"));
190 fileMenu.add(savemenu);
191 fileMenu.add(viewMapping);
192 savemenu.add(pdbFile);
195 viewMenu.add(chainMenu);
196 helpMenu.add(helpItem);
198 menuBar.add(fileMenu);
199 menuBar.add(viewMenu);
200 menuBar.add(colourMenu);
201 menuBar.add(viewerActionMenu);
202 menuBar.add(helpMenu);
204 statusPanel = new JPanel();
205 statusPanel.setLayout(new GridLayout());
206 this.getContentPane().add(statusPanel, BorderLayout.SOUTH);
207 statusBar = new JLabel();
208 statusPanel.add(statusBar, null);
211 protected void fitToWindow_actionPerformed()
215 protected void highlightSelection_actionPerformed()
219 protected void viewerColour_actionPerformed(ActionEvent actionEvent)
223 protected abstract String alignStructs_actionPerformed(
224 ActionEvent actionEvent);
226 public void pdbFile_actionPerformed(ActionEvent actionEvent)
231 public void png_actionPerformed(ActionEvent actionEvent)
236 public void eps_actionPerformed(ActionEvent actionEvent)
241 public void viewMapping_actionPerformed(ActionEvent actionEvent)
246 public void seqColour_actionPerformed(ActionEvent actionEvent)
251 public void chainColour_actionPerformed(ActionEvent actionEvent)
256 public void chargeColour_actionPerformed(ActionEvent actionEvent)
261 public void background_actionPerformed(ActionEvent actionEvent)
266 public void showHelp_actionPerformed(ActionEvent actionEvent)