From: Jim Procter Date: Tue, 22 Nov 2016 17:14:38 +0000 (+0000) Subject: Merge branch 'features/JAL-2177_update_jmol_to_14.6.4_2016.10.26' into develop X-Git-Tag: Release_2_10_1~10^2~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=4d22ba3918844213aaf4c3f58da43f93146159d4;hp=-c;p=jalview.git Merge branch 'features/JAL-2177_update_jmol_to_14.6.4_2016.10.26' into develop --- 4d22ba3918844213aaf4c3f58da43f93146159d4 diff --combined THIRDPARTYLIBS index 85aa587,38d5b93..e0be904 --- a/THIRDPARTYLIBS +++ b/THIRDPARTYLIBS @@@ -6,14 -6,11 +6,14 @@@ A number of sources have also been adap ext.edu.ucsf.rbvi.strucviz2 includes sources originally developed by Scooter Morris and Nadezhda Doncheva for the Cytoscape StructureViz2 plugin. It is released under the Berkley license and we hereby acknowledge its original copyright is held by the UCSF Computer Graphics Laboratory and the software was developed with support by the NIH National Center for Research Resources, grant P41-RR01081. + + jalview.ext.android includes code taken from the Android Open Source Project (https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/util). + The Apache 2.0 Licence (http://www.apache.org/licenses/LICENSE-2.0) is acknowledged in the source code. -Licencing information for each library is given below: +Licensing information for each library is given below: JGoogleAnalytics_0.3.jar APL 2.0 License - http://code.google.com/p/jgoogleanalytics/ - Jmol-14.2.14_2015.06.11.jar GPL/LGPLv2 http://sourceforge.net/projects/jmol/files/ + Jmol-14.6.4_2016.10.26.jar GPL/LGPLv2 http://sourceforge.net/projects/jmol/files/ VARNAv3-93.jar GPL licenced software by K�vin Darty, Alain Denise and Yann Ponty. http://varna.lri.fr activation.jar apache-mime4j-0.6.jar @@@ -61,5 -58,4 +61,5 @@@ Additional dependencie examples/javascript/deployJava.js : http://java.com/js/deployJava.js examples/javascript/jquery*.js : BSD license examples/javascript/jshashtable-2.1.js : Apache License +examples/javascript/facebox-1.3.js : MTI License - http://www.opensource.org/licenses/mit-license.php diff --combined src/jalview/appletgui/APopupMenu.java index 160224b,2037ca0..0c80c37 --- a/src/jalview/appletgui/APopupMenu.java +++ b/src/jalview/appletgui/APopupMenu.java @@@ -29,6 -29,7 +29,6 @@@ import jalview.commands.EditCommand import jalview.commands.EditCommand.Action; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; -import jalview.datamodel.DBRefEntry; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceGroup; @@@ -58,7 -59,6 +58,7 @@@ import java.awt.event.ActionListener import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.Arrays; +import java.util.Collection; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; @@@ -253,9 -253,122 +253,9 @@@ public class APopupMenu extends java.aw if (links != null && links.size() > 0) { - Menu linkMenu = new Menu(MessageManager.getString("action.link")); - for (int i = 0; i < links.size(); i++) - { - String link = links.elementAt(i); - UrlLink urlLink = new UrlLink(link); - if (!urlLink.isValid()) - { - System.err.println(urlLink.getInvalidMessage()); - continue; - } - final String target = urlLink.getTarget(); // link.substring(0, - // link.indexOf("|")); - final String label = urlLink.getLabel(); - if (seq != null && urlLink.isDynamic()) - { - - // collect matching db-refs - DBRefEntry[] dbr = jalview.util.DBRefUtils.selectRefs( - seq.getDBRefs(), new String[] { target }); - // collect id string too - String id = seq.getName(); - String descr = seq.getDescription(); - if (descr != null && descr.length() < 1) - { - descr = null; - } - if (dbr != null) - { - for (int r = 0; r < dbr.length; r++) - { - if (id != null && dbr[r].getAccessionId().equals(id)) - { - // suppress duplicate link creation for the bare sequence ID - // string with this link - id = null; - } - // create Bare ID link for this RUL - String[] urls = urlLink.makeUrls(dbr[r].getAccessionId(), - true); - if (urls != null) - { - for (int u = 0; u < urls.length; u += 2) - { - addshowLink(linkMenu, label + "|" + urls[u], urls[u + 1]); - } - } - } - } - if (id != null) - { - // create Bare ID link for this RUL - String[] urls = urlLink.makeUrls(id, true); - if (urls != null) - { - for (int u = 0; u < urls.length; u += 2) - { - addshowLink(linkMenu, label, urls[u + 1]); - } - } - // addshowLink(linkMenu, target, url_pref + id + url_suff); - } - // Now construct URLs from description but only try to do it for regex - // URL links - if (descr != null && urlLink.getRegexReplace() != null) - { - // create link for this URL from description only if regex matches - String[] urls = urlLink.makeUrls(descr, true); - if (urls != null) - { - for (int u = 0; u < urls.length; u += 2) - { - addshowLink(linkMenu, label, urls[u + 1]); - } - } - } - } - else - { - addshowLink(linkMenu, target, urlLink.getUrl_prefix()); // link.substring(link.lastIndexOf("|")+1)); - } - /* - * final String url; - * - * if (link.indexOf("$SEQUENCE_ID$") > -1) { // Substitute SEQUENCE_ID - * string and any matching database reference accessions String url_pref - * = link.substring(link.indexOf("|") + 1, - * link.indexOf("$SEQUENCE_ID$")); - * - * String url_suff = link.substring(link.indexOf("$SEQUENCE_ID$") + 13); - * // collect matching db-refs DBRefEntry[] dbr = - * jalview.util.DBRefUtils.selectRefs(seq.getDBRef(), new - * String[]{target}); // collect id string too String id = - * seq.getName(); if (id.indexOf("|") > -1) { id = - * id.substring(id.lastIndexOf("|") + 1); } if (dbr!=null) { for (int - * r=0;r 0) - { - if (seq != null) - { - seqMenu.add(linkMenu); - } - else - { - add(linkMenu); - } - } + addFeatureLinks(seq, links); } + // TODO: add group link menu entry here if (seq != null) { @@@ -301,71 -414,6 +301,71 @@@ } /** + * Adds a 'Link' menu item with a sub-menu item for each hyperlink provided. + * + * @param seq + * @param links + */ + void addFeatureLinks(final SequenceI seq, List links) + { + Menu linkMenu = new Menu(MessageManager.getString("action.link")); + Map> linkset = new LinkedHashMap>(); + + for (String link : links) + { + UrlLink urlLink = null; + try + { + urlLink = new UrlLink(link); + } catch (Exception foo) + { + System.err.println("Exception for URLLink '" + link + "': " + + foo.getMessage()); + continue; + } + + if (!urlLink.isValid()) + { + System.err.println(urlLink.getInvalidMessage()); + continue; + } + + urlLink.createLinksFromSeq(seq, linkset); + } + + addshowLinks(linkMenu, linkset.values()); + + // disable link menu if there are no valid entries + if (linkMenu.getItemCount() > 0) + { + linkMenu.setEnabled(true); + } + else + { + linkMenu.setEnabled(false); + } + + if (seq != null) + { + seqMenu.add(linkMenu); + } + else + { + add(linkMenu); + } + + } + + private void addshowLinks(Menu linkMenu, Collection> linkset) + { + for (List linkstrset : linkset) + { + // split linkstr into label and url + addshowLink(linkMenu, linkstrset.get(1), linkstrset.get(3)); + } + } + + /** * Build menus for annotation types that may be shown or hidden, and for * 'reference annotations' that may be added to the alignment. */ @@@ -802,7 -850,7 +802,7 @@@ CutAndPasteTransfer cap = new CutAndPasteTransfer(false, ap.alignFrame); - StringBuffer contents = new StringBuffer(); + StringBuilder contents = new StringBuilder(128); for (SequenceI seq : sequences) { contents.append(MessageManager.formatMessage( @@@ -813,6 -861,7 +813,6 @@@ seq, true, true, - false, (ap.seqPanel.seqCanvas.fr != null) ? ap.seqPanel.seqCanvas.fr .getMinMax() : null); contents.append("

"); @@@ -843,9 -892,10 +843,10 @@@ void addPDB() { - if (seq.getAllPDBEntries() != null) + Vector pdbs = seq.getAllPDBEntries(); + if (pdbs != null&& !pdbs.isEmpty()) { - PDBEntry entry = seq.getAllPDBEntries().firstElement(); + PDBEntry entry = pdbs.firstElement(); if (ap.av.applet.jmolAvailable) { @@@ -1157,10 -1207,11 +1158,10 @@@ if (conservationMenuItem.getState()) { - - sg.cs.setConservation(Conservation.calculateConservation("Group", 3, - sg.getSequences(ap.av.getHiddenRepSequences()), 0, ap.av - .getAlignment().getWidth(), false, ap.av - .getConsPercGaps(), false)); + sg.cs.setConservation(Conservation.calculateConservation("Group", sg + .getSequences(ap.av.getHiddenRepSequences()), 0, ap.av + .getAlignment().getWidth(), false, ap.av.getConsPercGaps(), + false)); SliderPanel.setConservationSlider(ap, sg.cs, sg.getName()); SliderPanel.showConservationSlider(); } diff --combined src/jalview/appletgui/AppletJmolBinding.java index 3a36ed5,ea3d3fa..684d357 --- a/src/jalview/appletgui/AppletJmolBinding.java +++ b/src/jalview/appletgui/AppletJmolBinding.java @@@ -29,8 -29,6 +29,6 @@@ import jalview.structure.StructureSelec import java.awt.Container; import java.util.Map; - import javajs.awt.Dimension; - import org.jmol.api.JmolAppConsoleInterface; import org.jmol.console.AppletConsole; import org.jmol.java.BS; @@@ -45,9 -43,9 +43,9 @@@ class AppletJmolBinding extends Jalview public AppletJmolBinding(AppletJmol appletJmol, StructureSelectionManager sSm, PDBEntry[] pdbentry, - SequenceI[][] seq, String[][] chains, String protocol) + SequenceI[][] seq, String protocol) { - super(sSm, pdbentry, seq, chains, protocol); + super(sSm, pdbentry, seq, protocol); appletJmolBinding = appletJmol; } @@@ -186,7 -184,7 +184,7 @@@ } @Override - public Dimension resizeInnerPanel(String data) + public int[] resizeInnerPanel(String data) { // TODO Auto-generated method stub return null; diff --combined src/jalview/ext/jmol/JalviewJmolBinding.java index 56287a9,9ee0777..7a394f7 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@@ -49,8 -49,6 +49,6 @@@ import java.util.List import java.util.Map; import java.util.Vector; - import javajs.awt.Dimension; - import org.jmol.adapter.smarter.SmarterJmolAdapter; import org.jmol.api.JmolAppConsoleInterface; import org.jmol.api.JmolSelectionListener; @@@ -74,7 -72,7 +72,7 @@@ public abstract class JalviewJmolBindin Vector atomsPicked = new Vector(); - public Vector chainNames; + private List chainNames; Hashtable chainFile; @@@ -99,10 -97,10 +97,10 @@@ public Viewer viewer; public JalviewJmolBinding(StructureSelectionManager ssm, - PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains, + PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String protocol) { - super(ssm, pdbentry, sequenceIs, chains, protocol); + super(ssm, pdbentry, sequenceIs, protocol); /* * viewer = JmolViewer.allocateViewer(renderPanel, new SmarterJmolAdapter(), * "jalviewJmol", ap.av.applet .getDocumentBase(), @@@ -1083,7 -1081,7 +1081,7 @@@ fileLoadingError = null; String[] oldmodels = modelFileNames; modelFileNames = null; - chainNames = new Vector(); + chainNames = new ArrayList(); chainFile = new Hashtable(); boolean notifyLoaded = false; String[] modelfilenames = getPdbFile(); @@@ -1143,7 -1141,6 +1141,7 @@@ for (int pe = 0; pe < getPdbCount(); pe++) { boolean matches = false; + addSequence(pe, getSequence()[pe]); if (fileName == null) { if (false) @@@ -1195,7 -1192,7 +1193,7 @@@ String chid = new String(pdb.getId() + ":" + pdb.getChains().elementAt(i).id); chainFile.put(chid, fileName); - chainNames.addElement(chid); + chainNames.add(chid); } notifyLoaded = true; } @@@ -1243,12 -1240,6 +1241,12 @@@ setLoadingFromArchive(false); } + @Override + public List getChainNames() + { + return chainNames; + } + public void notifyNewPickingModeMeasurement(int iatom, String strMeasure) { notifyAtomPicked(iatom, strMeasure, null); @@@ -1411,7 -1402,7 +1409,7 @@@ } @Override - public Dimension resizeInnerPanel(String data) + public int[] resizeInnerPanel(String data) { // Jalview doesn't honour resize panel requests return null;