JAL-1760 JAL-1641 Serialisation of Hidden Seqs and Cols in JSON output. Added ability...
[jalview.git] / src / jalview / io / FileLoader.java
index 833f590..a27777f 100755 (executable)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
@@ -30,7 +30,6 @@ import jalview.gui.Jalview2XML;
 import jalview.structure.StructureSelectionManager;
 import jalview.util.MessageManager;
 
-import java.util.List;
 import java.util.StringTokenizer;
 import java.util.Vector;
 
@@ -277,7 +276,7 @@ public class FileLoader implements Runnable
                   .println("IMPLEMENTATION ERROR: Cannot read consecutive Jalview XML projects from a stream.");
           // We read the data anyway - it might make sense.
         }
-        alignFrame = new Jalview2XML(raiseGUI).LoadJalviewAlign(file);
+        alignFrame = new Jalview2XML(raiseGUI).loadJalviewAlign(file);
       }
       else
       {
@@ -297,7 +296,7 @@ public class FileLoader implements Runnable
               // open a new source and read from it
               FormatAdapter fa = new FormatAdapter();
               al = fa.readFile(file, protocol, format);
-              source = fa.afile; // keep reference for later if necessary.
+              source = fa.getAlignFile(); // keep reference for later if necessary.
             }
           } catch (java.io.IOException ex)
           {
@@ -323,7 +322,7 @@ public class FileLoader implements Runnable
             }
             if (sq.getPDBId() != null)
             {
-              for (PDBEntry pdbe : (List<PDBEntry>) sq.getPDBId())
+              for (PDBEntry pdbe : sq.getPDBId())
               {
                 StructureSelectionManager.getStructureSelectionManager(
                         Desktop.instance).registerPDBEntry(pdbe);
@@ -332,13 +331,7 @@ public class FileLoader implements Runnable
           }
           if (viewport != null)
           {
-            // TODO: create undo object for this JAL-1101
-            for (int i = 0; i < al.getHeight(); i++)
-            {
-              viewport.getAlignment().addSequence(al.getSequenceAt(i));
-            }
-            viewport.firePropertyChange("alignment", null, viewport
-                    .getAlignment().getSequences());
+            viewport.addAlignment(al, title);
           }
           else
           {
@@ -355,9 +348,13 @@ public class FileLoader implements Runnable
             }
             if (source instanceof HtmlFile)
             {
-              ((HtmlFile) source).LoadAlignmentFeatures(alignFrame);
-
+              ((HtmlFile) source).applySettingsToAlignmentView(alignFrame);
             }
+            else if (source instanceof JSONFile)
+            {
+              ((JSONFile) source).applySettingsToAlignmentView(alignFrame);
+            }
+
             if (raiseGUI)
             {
               // add the window to the GUI