2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
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 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
21 import java.awt.event.*;
23 import jalview.appletgui.*;
24 import jalview.datamodel.*;
25 import jalview.schemes.*;
27 public class AppletPDBViewer extends EmbmenuFrame implements
28 ActionListener, ItemListener
30 AppletPDBCanvas pdbcanvas;
32 public AppletPDBViewer(PDBEntry pdbentry, SequenceI[] seq,
33 String[] chains, AlignmentPanel ap, String protocol)
38 } catch (Exception ex)
43 pdbcanvas = new AppletPDBCanvas(pdbentry, seq, chains, ap, protocol);
45 embedMenuIfNeeded(pdbcanvas);
46 add(pdbcanvas, BorderLayout.CENTER);
48 StringBuffer title = new StringBuffer(seq[0].getName() + ":"
49 + pdbcanvas.pdbentry.getFile());
51 jalview.bin.JalviewLite.addFrame(this, title.toString(), 400, 400);
55 public void actionPerformed(ActionEvent evt)
57 if (evt.getSource() == mapping)
59 jalview.appletgui.CutAndPasteTransfer cap = new jalview.appletgui.CutAndPasteTransfer(
61 Frame frame = new Frame();
63 jalview.bin.JalviewLite.addFrame(frame, "PDB - Sequence Mapping",
65 cap.setText(pdbcanvas.mappingDetails.toString());
68 else if (evt.getSource() == charge)
70 pdbcanvas.bysequence = false;
71 pdbcanvas.pdb.setChargeColours();
74 else if (evt.getSource() == chain)
76 pdbcanvas.bysequence = false;
77 pdbcanvas.pdb.setChainColours();
79 else if (evt.getSource() == seqButton)
81 pdbcanvas.bysequence = true;
82 pdbcanvas.colourBySequence();
85 else if (evt.getSource() == zappo)
87 pdbcanvas.setColours(new ZappoColourScheme());
89 else if (evt.getSource() == taylor)
91 pdbcanvas.setColours(new TaylorColourScheme());
93 else if (evt.getSource() == hydro)
95 pdbcanvas.setColours(new HydrophobicColourScheme());
97 else if (evt.getSource() == helix)
99 pdbcanvas.setColours(new HelixColourScheme());
101 else if (evt.getSource() == strand)
103 pdbcanvas.setColours(new StrandColourScheme());
105 else if (evt.getSource() == turn)
107 pdbcanvas.setColours(new TurnColourScheme());
109 else if (evt.getSource() == buried)
111 pdbcanvas.setColours(new BuriedColourScheme());
113 else if (evt.getSource() == user)
115 pdbcanvas.bysequence = false;
116 new jalview.appletgui.UserDefinedColours(pdbcanvas);
119 pdbcanvas.redrawneeded = true;
124 public void itemStateChanged(ItemEvent evt)
126 if (evt.getSource() == allchains)
128 pdbcanvas.setAllchainsVisible(allchains.getState());
130 else if (evt.getSource() == wire)
132 pdbcanvas.wire = !pdbcanvas.wire;
134 else if (evt.getSource() == depth)
136 pdbcanvas.depthcue = !pdbcanvas.depthcue;
138 else if (evt.getSource() == zbuffer)
140 pdbcanvas.zbuffer = !pdbcanvas.zbuffer;
142 pdbcanvas.redrawneeded = true;
146 private void jbInit() throws Exception
148 setMenuBar(jMenuBar1);
149 fileMenu.setLabel("File");
150 coloursMenu.setLabel("Colours");
151 mapping.setLabel("View Mapping");
152 mapping.addActionListener(this);
153 wire.setLabel("Wireframe");
154 wire.addItemListener(this);
155 depth.setState(true);
156 depth.setLabel("Depthcue");
157 depth.addItemListener(this);
158 zbuffer.setState(true);
159 zbuffer.setLabel("Z Buffering");
160 zbuffer.addItemListener(this);
161 charge.setLabel("Charge & Cysteine");
162 charge.addActionListener(this);
163 hydro.setLabel("Hydrophobicity");
164 hydro.addActionListener(this);
165 chain.setLabel("By Chain");
166 chain.addActionListener(this);
167 seqButton.setLabel("By Sequence");
168 seqButton.addActionListener(this);
169 allchains.setLabel("All Chains Visible");
170 allchains.addItemListener(this);
171 viewMenu.setLabel("View");
172 zappo.setLabel("Zappo");
173 zappo.addActionListener(this);
174 taylor.setLabel("Taylor");
175 taylor.addActionListener(this);
176 helix.setLabel("Helix Propensity");
177 helix.addActionListener(this);
178 strand.setLabel("Strand Propensity");
179 strand.addActionListener(this);
180 turn.setLabel("Turn Propensity");
181 turn.addActionListener(this);
182 buried.setLabel("Buried Index");
183 buried.addActionListener(this);
184 user.setLabel("User Defined...");
185 user.addActionListener(this);
186 jMenuBar1.add(fileMenu);
187 jMenuBar1.add(coloursMenu);
188 jMenuBar1.add(viewMenu);
189 fileMenu.add(mapping);
192 coloursMenu.add(seqButton);
193 coloursMenu.add(chain);
194 coloursMenu.add(charge);
195 coloursMenu.add(zappo);
196 coloursMenu.add(taylor);
197 coloursMenu.add(hydro);
198 coloursMenu.add(helix);
199 coloursMenu.add(strand);
200 coloursMenu.add(turn);
201 coloursMenu.add(buried);
202 coloursMenu.add(user);
205 viewMenu.add(zbuffer);
206 viewMenu.add(allchains);
207 allchains.setState(true);
210 MenuBar jMenuBar1 = new MenuBar();
212 Menu fileMenu = new Menu();
214 Menu coloursMenu = new Menu();
216 MenuItem mapping = new MenuItem();
218 CheckboxGroup bg = new CheckboxGroup();
220 CheckboxMenuItem wire = new CheckboxMenuItem();
222 CheckboxMenuItem depth = new CheckboxMenuItem();
224 CheckboxMenuItem zbuffer = new CheckboxMenuItem();
226 MenuItem charge = new MenuItem();
228 MenuItem hydro = new MenuItem();
230 MenuItem chain = new MenuItem();
232 MenuItem seqButton = new MenuItem();
234 CheckboxMenuItem allchains = new CheckboxMenuItem();
236 Menu viewMenu = new Menu();
238 MenuItem turn = new MenuItem();
240 MenuItem strand = new MenuItem();
242 MenuItem helix = new MenuItem();
244 MenuItem taylor = new MenuItem();
246 MenuItem zappo = new MenuItem();
248 MenuItem buried = new MenuItem();
250 MenuItem user = new MenuItem();
252 // End StructureListener
253 // //////////////////////////