Clover icon

Coverage Report

  1. Project Clover database Thu Aug 13 2020 12:04:21 BST
  2. Package jalview.gui

File AppJmolBinding.java

 

Coverage histogram

../../img/srcFileCovDistChart6.png
33% of files have more coverage

Code metrics

12
29
17
1
192
138
25
0.86
1.71
17
1.47

Classes

Class Line # Actions
AppJmolBinding 44 29 25
0.534482853.4%
 

Contributing tests

This file is covered by 8 tests. .

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 jalview.gui;
22   
23    import java.awt.Container;
24    import java.io.File;
25    import java.util.List;
26    import java.util.Map;
27   
28    import javax.swing.JComponent;
29   
30    import org.jmol.api.JmolAppConsoleInterface;
31    import org.openscience.jmol.app.jmolpanel.console.AppConsole;
32   
33    import jalview.api.AlignmentViewPanel;
34    import jalview.api.structures.JalviewStructureDisplayI;
35    import jalview.bin.Cache;
36    import jalview.datamodel.PDBEntry;
37    import jalview.datamodel.SequenceI;
38    import jalview.ext.jmol.JalviewJmolBinding;
39    import jalview.io.DataSourceType;
40    import jalview.structure.StructureSelectionManager;
41    import jalview.util.Platform;
42    import javajs.util.BS;
43   
 
44    public class AppJmolBinding extends JalviewJmolBinding
45    {
 
46  7 toggle public AppJmolBinding(AppJmol appJmol, StructureSelectionManager sSm,
47    PDBEntry[] pdbentry, SequenceI[][] sequenceIs,
48    DataSourceType protocol)
49    {
50  7 super(sSm, pdbentry, sequenceIs, protocol);
51  7 setViewer(appJmol);
52    }
53   
 
54  10 toggle @Override
55    public SequenceRenderer getSequenceRenderer(AlignmentViewPanel alignment)
56    {
57  10 return new SequenceRenderer(((AlignmentPanel) alignment).av);
58    }
59   
 
60  6 toggle @Override
61    public void sendConsoleEcho(String strEcho)
62    {
63  6 if (console != null)
64    {
65  6 console.sendConsoleEcho(strEcho);
66    }
67    }
68   
 
69  0 toggle @Override
70    public void sendConsoleMessage(String strStatus)
71    {
72  0 if (console != null && strStatus != null)
73    // && !strStatus.equals("Script completed"))
74    // should we squash the script completed string ?
75    {
76  0 console.sendConsoleMessage(strStatus);
77    }
78    }
79   
 
80  0 toggle @Override
81    public void showUrl(String url, String target)
82    {
83  0 try
84    {
85  0 jalview.util.BrowserLauncher.openURL(url);
86    } catch (Exception e)
87    {
88  0 Cache.log.error("Failed to launch Jmol-associated url " + url, e);
89    // TODO: 2.6 : warn user if browser was not configured.
90    }
91    }
92   
 
93  25 toggle @Override
94    public void refreshGUI()
95    {
96  25 if (getMappedStructureCount() == 0)
97    {
98    // too soon!
99  19 return;
100    }
101    // appJmolWindow.repaint();
102  6 javax.swing.SwingUtilities.invokeLater(new Runnable()
103    {
 
104  6 toggle @Override
105    public void run()
106    {
107  6 JalviewStructureDisplayI theViewer = getViewer();
108    // invokes colourbySequence() via seqColour_ActionPerformed()
109  6 theViewer.updateTitleAndMenus();
110  6 ((JComponent) theViewer).revalidate();
111    }
112    });
113    }
114   
 
115  4 toggle @Override
116    public void notifyScriptTermination(String strStatus, int msWalltime)
117    {
118    // todo - script termination doesn't happen ?
119    // if (console != null)
120    // console.notifyScriptTermination(strStatus,
121    // msWalltime);
122    }
123   
 
124  0 toggle @Override
125    public void showUrl(String url)
126    {
127  0 showUrl(url, "jmol");
128    }
129   
 
130  0 toggle public void newJmolPopup(String menuName)
131    {
132    // jmolpopup = new JmolAwtPopup();
133    // jmolpopup.jpiInitialize((viewer), menuName);
134    }
135   
 
136  0 toggle @Override
137    public void selectionChanged(BS arg0)
138    {
139    }
140   
 
141  0 toggle @Override
142    public void showConsole(boolean b)
143    {
144  0 getViewer().showConsole(b);
145    }
146   
 
147  7 toggle @Override
148    protected JmolAppConsoleInterface createJmolConsole(
149    Container consolePanel, String buttonsToShow)
150    {
151  7 jmolViewer.setJmolCallbackListener(this);
152    // BH comment: can't do this yet [for JS only, or generally?]
153  7 return Platform.isJS() ? null
154    : new AppConsole(jmolViewer, consolePanel, buttonsToShow);
155    }
156   
 
157  7 toggle @Override
158    protected void releaseUIResources()
159    {
160  7 setViewer(null);
161  7 closeConsole();
162    }
163   
 
164  36 toggle @Override
165    public void releaseReferences(Object svl)
166    {
167  36 if (svl instanceof SeqPanel)
168    {
169  36 getViewer().removeAlignmentPanel(((SeqPanel) svl).ap);
170    }
171    }
172   
 
173  0 toggle @Override
174    public Map<String, Object> getJSpecViewProperty(String arg0)
175    {
176    // TODO Auto-generated method stub
177  0 return null;
178    }
179   
 
180  0 toggle @SuppressWarnings("unused")
181    public void cacheFiles(List<File> files)
182    {
183  0 if (files == null)
184    {
185  0 return;
186    }
187  0 for (File f : files)
188    {
189  0 Platform.cacheFileData(f);
190    }
191    }
192    }