2 * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
3 * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 import java.awt.event.*;
24 import jalview.appletgui.*;
25 import jalview.datamodel.*;
26 import jalview.schemes.*;
28 public class AppletPDBViewer extends EmbmenuFrame implements
29 ActionListener, ItemListener
31 AppletPDBCanvas pdbcanvas;
33 public AppletPDBViewer(PDBEntry pdbentry, SequenceI[] seq,
34 String[] chains, AlignmentPanel ap, String protocol)
39 } catch (Exception ex)
44 pdbcanvas = new AppletPDBCanvas(pdbentry, seq, chains, ap, protocol);
46 embedMenuIfNeeded(pdbcanvas);
47 add(pdbcanvas, BorderLayout.CENTER);
49 StringBuffer title = new StringBuffer(seq[0].getName() + ":"
50 + pdbcanvas.pdbentry.getFile());
52 jalview.bin.JalviewLite.addFrame(this, title.toString(), 400, 400);
56 public void actionPerformed(ActionEvent evt)
58 if (evt.getSource() == mapping)
60 jalview.appletgui.CutAndPasteTransfer cap = new jalview.appletgui.CutAndPasteTransfer(
62 Frame frame = new Frame();
64 jalview.bin.JalviewLite.addFrame(frame, "PDB - Sequence Mapping",
66 cap.setText(pdbcanvas.mappingDetails.toString());
69 else if (evt.getSource() == charge)
71 pdbcanvas.bysequence = false;
72 pdbcanvas.pdb.setChargeColours();
75 else if (evt.getSource() == chain)
77 pdbcanvas.bysequence = false;
78 pdbcanvas.pdb.setChainColours();
80 else if (evt.getSource() == seqButton)
82 pdbcanvas.bysequence = true;
83 pdbcanvas.colourBySequence();
86 else if (evt.getSource() == zappo)
88 pdbcanvas.setColours(new ZappoColourScheme());
90 else if (evt.getSource() == taylor)
92 pdbcanvas.setColours(new TaylorColourScheme());
94 else if (evt.getSource() == hydro)
96 pdbcanvas.setColours(new HydrophobicColourScheme());
98 else if (evt.getSource() == helix)
100 pdbcanvas.setColours(new HelixColourScheme());
102 else if (evt.getSource() == strand)
104 pdbcanvas.setColours(new StrandColourScheme());
106 else if (evt.getSource() == turn)
108 pdbcanvas.setColours(new TurnColourScheme());
110 else if (evt.getSource() == buried)
112 pdbcanvas.setColours(new BuriedColourScheme());
114 else if (evt.getSource() == user)
116 pdbcanvas.bysequence = false;
117 new jalview.appletgui.UserDefinedColours(pdbcanvas);
120 pdbcanvas.redrawneeded = true;
125 public void itemStateChanged(ItemEvent evt)
127 if (evt.getSource() == allchains)
129 pdbcanvas.setAllchainsVisible(allchains.getState());
131 else if (evt.getSource() == wire)
133 pdbcanvas.wire = !pdbcanvas.wire;
135 else if (evt.getSource() == depth)
137 pdbcanvas.depthcue = !pdbcanvas.depthcue;
139 else if (evt.getSource() == zbuffer)
141 pdbcanvas.zbuffer = !pdbcanvas.zbuffer;
143 pdbcanvas.redrawneeded = true;
147 private void jbInit() throws Exception
149 setMenuBar(jMenuBar1);
150 fileMenu.setLabel("File");
151 coloursMenu.setLabel("Colours");
152 mapping.setLabel("View Mapping");
153 mapping.addActionListener(this);
154 wire.setLabel("Wireframe");
155 wire.addItemListener(this);
156 depth.setState(true);
157 depth.setLabel("Depthcue");
158 depth.addItemListener(this);
159 zbuffer.setState(true);
160 zbuffer.setLabel("Z Buffering");
161 zbuffer.addItemListener(this);
162 charge.setLabel("Charge & Cysteine");
163 charge.addActionListener(this);
164 hydro.setLabel("Hydrophobicity");
165 hydro.addActionListener(this);
166 chain.setLabel("By Chain");
167 chain.addActionListener(this);
168 seqButton.setLabel("By Sequence");
169 seqButton.addActionListener(this);
170 allchains.setLabel("All Chains Visible");
171 allchains.addItemListener(this);
172 viewMenu.setLabel("View");
173 zappo.setLabel("Zappo");
174 zappo.addActionListener(this);
175 taylor.setLabel("Taylor");
176 taylor.addActionListener(this);
177 helix.setLabel("Helix Propensity");
178 helix.addActionListener(this);
179 strand.setLabel("Strand Propensity");
180 strand.addActionListener(this);
181 turn.setLabel("Turn Propensity");
182 turn.addActionListener(this);
183 buried.setLabel("Buried Index");
184 buried.addActionListener(this);
185 user.setLabel("User Defined...");
186 user.addActionListener(this);
187 jMenuBar1.add(fileMenu);
188 jMenuBar1.add(coloursMenu);
189 jMenuBar1.add(viewMenu);
190 fileMenu.add(mapping);
193 coloursMenu.add(seqButton);
194 coloursMenu.add(chain);
195 coloursMenu.add(charge);
196 coloursMenu.add(zappo);
197 coloursMenu.add(taylor);
198 coloursMenu.add(hydro);
199 coloursMenu.add(helix);
200 coloursMenu.add(strand);
201 coloursMenu.add(turn);
202 coloursMenu.add(buried);
203 coloursMenu.add(user);
206 viewMenu.add(zbuffer);
207 viewMenu.add(allchains);
208 allchains.setState(true);
211 MenuBar jMenuBar1 = new MenuBar();
213 Menu fileMenu = new Menu();
215 Menu coloursMenu = new Menu();
217 MenuItem mapping = new MenuItem();
219 CheckboxGroup bg = new CheckboxGroup();
221 CheckboxMenuItem wire = new CheckboxMenuItem();
223 CheckboxMenuItem depth = new CheckboxMenuItem();
225 CheckboxMenuItem zbuffer = new CheckboxMenuItem();
227 MenuItem charge = new MenuItem();
229 MenuItem hydro = new MenuItem();
231 MenuItem chain = new MenuItem();
233 MenuItem seqButton = new MenuItem();
235 CheckboxMenuItem allchains = new CheckboxMenuItem();
237 Menu viewMenu = new Menu();
239 MenuItem turn = new MenuItem();
241 MenuItem strand = new MenuItem();
243 MenuItem helix = new MenuItem();
245 MenuItem taylor = new MenuItem();
247 MenuItem zappo = new MenuItem();
249 MenuItem buried = new MenuItem();
251 MenuItem user = new MenuItem();
253 // End StructureListener
254 // //////////////////////////