Clover icon

Coverage Report

  1. Project Clover database Thu Nov 7 2024 17:01:39 GMT
  2. Package mc_view

File AppletPDBViewer.java

 

Coverage histogram

../img/srcFileCovDistChart0.png
0% of files have more coverage

Code metrics

32
111
4
1
286
223
21
0.19
27.75
4
5.25

Classes

Class Line # Actions
AppletPDBViewer 49 111 21
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
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.
11    *
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.
16    *
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.
20    */
21    package mc_view;
22   
23    import jalview.appletgui.AlignmentPanel;
24    import jalview.appletgui.EmbmenuFrame;
25    import jalview.datamodel.PDBEntry;
26    import jalview.datamodel.SequenceI;
27    import jalview.io.DataSourceType;
28    import jalview.schemes.BuriedColourScheme;
29    import jalview.schemes.HelixColourScheme;
30    import jalview.schemes.HydrophobicColourScheme;
31    import jalview.schemes.StrandColourScheme;
32    import jalview.schemes.TaylorColourScheme;
33    import jalview.schemes.TurnColourScheme;
34    import jalview.schemes.ZappoColourScheme;
35    import jalview.util.MessageManager;
36   
37    import java.awt.BorderLayout;
38    import java.awt.CheckboxGroup;
39    import java.awt.CheckboxMenuItem;
40    import java.awt.Frame;
41    import java.awt.Menu;
42    import java.awt.MenuBar;
43    import java.awt.MenuItem;
44    import java.awt.event.ActionEvent;
45    import java.awt.event.ActionListener;
46    import java.awt.event.ItemEvent;
47    import java.awt.event.ItemListener;
48   
 
49    public class AppletPDBViewer extends EmbmenuFrame
50    implements ActionListener, ItemListener
51    {
52    AppletPDBCanvas pdbcanvas;
53   
 
54  0 toggle public AppletPDBViewer(PDBEntry pdbentry, SequenceI[] seq,
55    String[] chains, AlignmentPanel ap, DataSourceType protocol)
56    {
57  0 try
58    {
59  0 jbInit();
60    } catch (Exception ex)
61    {
62  0 ex.printStackTrace();
63    }
64   
65  0 pdbcanvas = new AppletPDBCanvas(pdbentry, seq, chains, ap, protocol);
66   
67  0 embedMenuIfNeeded(pdbcanvas);
68  0 add(pdbcanvas, BorderLayout.CENTER);
69   
70  0 StringBuffer title = new StringBuffer(
71    seq[0].getName() + ":" + pdbcanvas.pdbentry.getFile());
72   
73  0 jalview.bin.JalviewLite.addFrame(this, title.toString(), 400, 400);
74   
75    }
76   
 
77  0 toggle @Override
78    public void actionPerformed(ActionEvent evt)
79    {
80  0 if (evt.getSource() == mapping)
81    {
82  0 jalview.appletgui.CutAndPasteTransfer cap = new jalview.appletgui.CutAndPasteTransfer(
83    false, null);
84  0 Frame frame = new Frame();
85  0 frame.add(cap);
86  0 jalview.bin.JalviewLite.addFrame(frame,
87    MessageManager.getString("label.pdb_sequence_mapping"), 500,
88    600);
89  0 cap.setText(pdbcanvas.mappingDetails.toString());
90   
91    }
92  0 else if (evt.getSource() == charge)
93    {
94  0 pdbcanvas.bysequence = false;
95  0 pdbcanvas.pdb.setChargeColours();
96    }
97   
98  0 else if (evt.getSource() == chain)
99    {
100  0 pdbcanvas.bysequence = false;
101  0 pdbcanvas.pdb.setChainColours();
102    }
103  0 else if (evt.getSource() == seqButton)
104    {
105  0 pdbcanvas.bysequence = true;
106  0 pdbcanvas.colourBySequence();
107   
108    }
109  0 else if (evt.getSource() == zappo)
110    {
111  0 pdbcanvas.setColours(new ZappoColourScheme());
112    }
113  0 else if (evt.getSource() == taylor)
114    {
115  0 pdbcanvas.setColours(new TaylorColourScheme());
116    }
117  0 else if (evt.getSource() == hydro)
118    {
119  0 pdbcanvas.setColours(new HydrophobicColourScheme());
120    }
121  0 else if (evt.getSource() == helix)
122    {
123  0 pdbcanvas.setColours(new HelixColourScheme());
124    }
125  0 else if (evt.getSource() == strand)
126    {
127  0 pdbcanvas.setColours(new StrandColourScheme());
128    }
129  0 else if (evt.getSource() == turn)
130    {
131  0 pdbcanvas.setColours(new TurnColourScheme());
132    }
133  0 else if (evt.getSource() == buried)
134    {
135  0 pdbcanvas.setColours(new BuriedColourScheme());
136    }
137  0 else if (evt.getSource() == user)
138    {
139  0 pdbcanvas.bysequence = false;
140  0 new jalview.appletgui.UserDefinedColours(pdbcanvas);
141    }
142   
143  0 pdbcanvas.redrawneeded = true;
144  0 pdbcanvas.repaint();
145   
146    }
147   
 
148  0 toggle @Override
149    public void itemStateChanged(ItemEvent evt)
150    {
151  0 if (evt.getSource() == allchains)
152    {
153  0 pdbcanvas.setAllchainsVisible(allchains.getState());
154    }
155  0 else if (evt.getSource() == wire)
156    {
157  0 pdbcanvas.wire = !pdbcanvas.wire;
158    }
159  0 else if (evt.getSource() == depth)
160    {
161  0 pdbcanvas.depthcue = !pdbcanvas.depthcue;
162    }
163  0 else if (evt.getSource() == zbuffer)
164    {
165  0 pdbcanvas.zbuffer = !pdbcanvas.zbuffer;
166    }
167  0 pdbcanvas.redrawneeded = true;
168  0 pdbcanvas.repaint();
169    }
170   
 
171  0 toggle private void jbInit() throws Exception
172    {
173  0 setMenuBar(jMenuBar1);
174  0 fileMenu.setLabel(MessageManager.getString("action.file"));
175  0 coloursMenu.setLabel(MessageManager.getString("label.colours"));
176  0 mapping.setLabel(MessageManager.getString("label.view_mapping"));
177  0 mapping.addActionListener(this);
178  0 wire.setLabel(MessageManager.getString("label.wireframe"));
179  0 wire.addItemListener(this);
180  0 depth.setState(true);
181  0 depth.setLabel(MessageManager.getString("label.depthcue"));
182  0 depth.addItemListener(this);
183  0 zbuffer.setState(true);
184  0 zbuffer.setLabel(MessageManager.getString("label.z_buffering"));
185  0 zbuffer.addItemListener(this);
186  0 charge.setLabel(MessageManager.getString("label.charge_cysteine"));
187  0 charge.addActionListener(this);
188  0 hydro.setLabel(
189    MessageManager.getString("label.colourScheme_hydrophobic"));
190  0 hydro.addActionListener(this);
191  0 chain.setLabel(MessageManager.getString("action.by_chain"));
192  0 chain.addActionListener(this);
193  0 seqButton.setLabel(MessageManager.getString("action.by_sequence"));
194  0 seqButton.addActionListener(this);
195  0 allchains
196    .setLabel(MessageManager.getString("label.all_chains_visible"));
197  0 allchains.addItemListener(this);
198  0 viewMenu.setLabel(MessageManager.getString("action.view"));
199  0 zappo.setLabel(MessageManager.getString("label.colourScheme_zappo"));
200  0 zappo.addActionListener(this);
201  0 taylor.setLabel(MessageManager.getString("label.colourScheme_taylor"));
202  0 taylor.addActionListener(this);
203  0 helix.setLabel(
204    MessageManager.getString("label.colourScheme_helixpropensity"));
205  0 helix.addActionListener(this);
206  0 strand.setLabel(MessageManager
207    .getString("label.colourScheme_strandpropensity"));
208  0 strand.addActionListener(this);
209  0 turn.setLabel(
210    MessageManager.getString("label.colourScheme_turnpropensity"));
211  0 turn.addActionListener(this);
212  0 buried.setLabel(
213    MessageManager.getString("label.colourScheme_buriedindex"));
214  0 buried.addActionListener(this);
215  0 user.setLabel(MessageManager.getString("action.user_defined"));
216  0 user.addActionListener(this);
217  0 jMenuBar1.add(fileMenu);
218  0 jMenuBar1.add(coloursMenu);
219  0 jMenuBar1.add(viewMenu);
220  0 fileMenu.add(mapping);
221  0 ;
222   
223  0 coloursMenu.add(seqButton);
224  0 coloursMenu.add(chain);
225  0 coloursMenu.add(charge);
226  0 coloursMenu.add(zappo);
227  0 coloursMenu.add(taylor);
228  0 coloursMenu.add(hydro);
229  0 coloursMenu.add(helix);
230  0 coloursMenu.add(strand);
231  0 coloursMenu.add(turn);
232  0 coloursMenu.add(buried);
233  0 coloursMenu.add(user);
234  0 viewMenu.add(wire);
235  0 viewMenu.add(depth);
236  0 viewMenu.add(zbuffer);
237  0 viewMenu.add(allchains);
238  0 allchains.setState(true);
239    }
240   
241    MenuBar jMenuBar1 = new MenuBar();
242   
243    Menu fileMenu = new Menu();
244   
245    Menu coloursMenu = new Menu();
246   
247    MenuItem mapping = new MenuItem();
248   
249    CheckboxGroup bg = new CheckboxGroup();
250   
251    CheckboxMenuItem wire = new CheckboxMenuItem();
252   
253    CheckboxMenuItem depth = new CheckboxMenuItem();
254   
255    CheckboxMenuItem zbuffer = new CheckboxMenuItem();
256   
257    MenuItem charge = new MenuItem();
258   
259    MenuItem hydro = new MenuItem();
260   
261    MenuItem chain = new MenuItem();
262   
263    MenuItem seqButton = new MenuItem();
264   
265    CheckboxMenuItem allchains = new CheckboxMenuItem();
266   
267    Menu viewMenu = new Menu();
268   
269    MenuItem turn = new MenuItem();
270   
271    MenuItem strand = new MenuItem();
272   
273    MenuItem helix = new MenuItem();
274   
275    MenuItem taylor = new MenuItem();
276   
277    MenuItem zappo = new MenuItem();
278   
279    MenuItem buried = new MenuItem();
280   
281    MenuItem user = new MenuItem();
282   
283    // End StructureListener
284    // //////////////////////////
285   
286    }