merge
[jalview.git] / src / jalview / gui / Jalview2XML.java
index 8beb26f..f56e531 100644 (file)
  */
 package jalview.gui;
 
-import java.awt.Rectangle;
-import java.io.BufferedReader;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.IdentityHashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.Vector;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-import java.util.jar.JarOutputStream;
-
-import javax.swing.JInternalFrame;
-import javax.swing.JOptionPane;
-import javax.swing.SwingUtilities;
-
-import org.exolab.castor.xml.Unmarshaller;
-
 import jalview.api.structures.JalviewStructureDisplayI;
 import jalview.bin.Cache;
 import jalview.datamodel.AlignedCodonFrame;
@@ -121,6 +83,44 @@ import jalview.ws.params.ArgumentI;
 import jalview.ws.params.AutoCalcSetting;
 import jalview.ws.params.WsParamSetI;
 
+import java.awt.Rectangle;
+import java.io.BufferedReader;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.Vector;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+import java.util.jar.JarOutputStream;
+
+import javax.swing.JInternalFrame;
+import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
+
+import org.exolab.castor.xml.Unmarshaller;
+
 /**
  * Write out the current jalview desktop state as a Jalview XML stream.
  * 
@@ -1133,7 +1133,7 @@ public class Jalview2XML
       view.setShowGroupConservation(av.isShowGroupConservation());
       view.setShowNPfeatureTooltip(av.isShowNPFeats());
       view.setShowDbRefTooltip(av.isShowDBRefs());
-      view.setFollowHighlight(av.followHighlight);
+      view.setFollowHighlight(av.isFollowHighlight());
       view.setFollowSelection(av.followSelection);
       view.setIgnoreGapsinConsensus(av.isIgnoreGapsConsensus());
       if (av.getFeaturesDisplayed() != null)
@@ -2263,6 +2263,13 @@ public class Jalview2XML
     int height = (int) (dnaFrame.getBounds().getHeight()
             + proteinFrame.getBounds().getHeight() + 50);
     Desktop.addInternalFrame(splitFrame, title, width, height);
+
+    /*
+     * And compute cDNA consensus (couldn't do earlier with consensus as
+     * mappings were not yet present)
+     */
+    proteinFrame.viewport.alignmentChanged(proteinFrame.alignPanel);
+
     return splitFrame;
   }
 
@@ -2537,7 +2544,17 @@ public class Jalview2XML
           {
             jalview.datamodel.PDBEntry entry = new jalview.datamodel.PDBEntry();
             entry.setId(ids[p].getId());
-            entry.setType(ids[p].getType());
+            if (ids[p].getType() != null)
+            {
+              if (ids[p].getType().equalsIgnoreCase("PDB"))
+              {
+                entry.setType(PDBEntry.Type.PDB);
+              }
+              else
+              {
+                entry.setType(PDBEntry.Type.FILE);
+              }
+            }
             if (ids[p].getFile() != null)
             {
               if (!pdbloaded.containsKey(ids[p].getFile()))
@@ -3303,7 +3320,8 @@ public class Jalview2XML
       {
         String filePath = pdb.getValue().getFilePath();
         String pdbId = pdb.getValue().getPdbId();
-        pdbs.add(new PDBEntry(filePath, pdbId));
+        // pdbs.add(new PDBEntry(filePath, pdbId));
+        pdbs.add(new PDBEntry(pdbId, null, PDBEntry.Type.PDB, filePath));
         final List<SequenceI> seqList = pdb.getValue().getSeqList();
         SequenceI[] seqs = seqList.toArray(new SequenceI[seqList.size()]);
         allseqs.add(seqs);
@@ -3452,7 +3470,7 @@ public class Jalview2XML
                       (OutOfMemoryError) ex.getCause());
               if (sview != null && sview.isVisible())
               {
-                sview.closeViewer();
+                sview.closeViewer(false);
                 sview.setVisible(false);
                 sview.dispose();
               }
@@ -3837,7 +3855,7 @@ public class Jalview2XML
     }
     if (view.hasFollowHighlight())
     {
-      af.viewport.followHighlight = view.getFollowHighlight();
+      af.viewport.setFollowHighlight(view.getFollowHighlight());
     }
     if (view.hasFollowSelection())
     {