Merge branch 'releases/Release_2_10_Branch' into task/JAL-2196pdbeProperties task/JAL-2196pdbeProperties
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 14 Oct 2016 10:12:00 +0000 (11:12 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 14 Oct 2016 10:12:00 +0000 (11:12 +0100)
1  2 
src/jalview/appletgui/AppletJmol.java
src/jalview/gui/Jalview2XML.java
src/jalview/structures/models/AAStructureBindingModel.java

@@@ -60,11 -60,10 +60,9 @@@ import java.awt.event.KeyListener
  import java.awt.event.WindowAdapter;
  import java.awt.event.WindowEvent;
  import java.util.ArrayList;
  import java.util.List;
  import java.util.Vector;
  
- import org.jmol.util.Logger;
  public class AppletJmol extends EmbmenuFrame implements
  // StructureListener,
          KeyListener, ActionListener, ItemListener
        jmb.allocateViewer(renderPanel, true, ap.av.applet.getName()
                + "_jmol_", ap.av.applet.getDocumentBase(),
                ap.av.applet.getCodeBase(), "-applet", scriptWindow, null);
-       Logger.setLogLevel(Logger.LEVEL_WARN);
      } catch (Exception e)
      {
        System.err
          closeViewer();
        }
      });
 -    if (pdbentry.getProperty() == null)
 -    {
 -      pdbentry.setProperty(new Hashtable());
 -      pdbentry.getProperty().put("protocol", protocol);
 -    }
 +    pdbentry.setProperty("protocol", protocol);
 +
      if (pdbentry.getFile() != null)
      {
        // import structure data from pdbentry.getFile based on given protocol
@@@ -992,16 -992,17 +992,16 @@@ public class Jalview2XM
              }
            }
  
 -          if (entry.getProperty() != null && !entry.getProperty().isEmpty())
 +          Enumeration<String> props = entry.getProperties();
 +          if (props.hasMoreElements())
            {
              PdbentryItem item = new PdbentryItem();
 -            Hashtable properties = entry.getProperty();
 -            Enumeration en2 = properties.keys();
 -            while (en2.hasMoreElements())
 +            while (props.hasMoreElements())
              {
                Property prop = new Property();
 -              String key = en2.nextElement().toString();
 +              String key = props.nextElement();
                prop.setName(key);
 -              prop.setValue(properties.get(key).toString());
 +              prop.setValue(entry.getProperty(key).toString());
                item.addProperty(prop);
              }
              pdb.addPdbentryItem(item);
                  entry.setType(PDBEntry.Type.FILE);
                }
              }
-             if (ids[p].getFile() != null)
+             // jprovider is null when executing 'New View'
+             if (ids[p].getFile() != null && jprovider != null)
              {
                if (!pdbloaded.containsKey(ids[p].getFile()))
                {
              }
              if (ids[p].getPdbentryItem() != null)
              {
 -              entry.setProperty(new Hashtable());
                for (PdbentryItem item : ids[p].getPdbentryItem())
                {
                  for (Property pr : item.getProperty())
                  {
 -                  entry.getProperty().put(pr.getName(), pr.getValue());
 +                  entry.setProperty(pr.getName(), pr.getValue());
                  }
                }
              }
@@@ -51,6 -51,10 +51,10 @@@ public abstract class AAStructureBindin
  
    private StructureSelectionManager ssm;
  
+   /*
+    * distinct PDB entries (pdb files) associated
+    * with sequences
+    */
    private PDBEntry[] pdbEntry;
  
    /*
    private boolean finishedInit = false;
  
    /**
+    * current set of model filenames loaded in the Jmol instance
+    */
+   protected String[] modelFileNames = null;
+   /**
     * Data bean class to simplify parameterisation in superposeStructures
     */
    protected class SuperposeData
      // TODO: give a more informative title when multiple structures are
      // displayed.
      StringBuilder title = new StringBuilder(64);
 -    final PDBEntry pdbEntry = getPdbEntry(0);
 +    final PDBEntry pdbe = getPdbEntry(0);
      title.append(viewerName + " view for " + getSequence()[0][0].getName()
 -            + ":" + pdbEntry.getId());
 +            + ":" + pdbe.getId());
  
      if (verbose)
      {
 -      if (pdbEntry.getProperty() != null)
 +      String method = (String) pdbe.getProperty("method");
 +      if (method != null)
        {
 -        if (pdbEntry.getProperty().get("method") != null)
 -        {
 -          title.append(" Method: ");
 -          title.append(pdbEntry.getProperty().get("method"));
 -        }
 -        if (pdbEntry.getProperty().get("chains") != null)
 -        {
 -          title.append(" Chain:");
 -          title.append(pdbEntry.getProperty().get("chains"));
 -        }
 +        title.append(" Method: ").append(method);
 +      }
 +      String chain = (String) pdbe.getProperty("chains");
 +      if (chain != null)
 +      {
 +        title.append(" Chain:").append(chain);
        }
      }
      return title.toString();
    {
      int refStructure = -1;
      String[] files = getPdbFile();
+     if (files == null)
+     {
+       return -1;
+     }
      for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
      {
        StructureMapping[] mappings = getSsm().getMapping(files[pdbfnum]);
              }
              structures[pdbfnum].pdbId = mapping.getPdbId();
              structures[pdbfnum].isRna = theSequence.getRNA() != null;
-             // move on to next pdb file
+             /*
+              * move on to next pdb file (ignore sequences for other chains
+              * for the same structure)
+              */
              s = seqCountForPdbFile;
              break;
            }