JAL-2089 patch broken merge to master for Release 2.10.0b1
[jalview.git] / src / jalview / io / JSONFile.java
index 8e87953..653c071 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
- * Copyright (C) 2015 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.
  * 
@@ -26,6 +26,7 @@ import jalview.api.AlignViewportI;
 import jalview.api.AlignmentViewPanel;
 import jalview.api.ComplexAlignFile;
 import jalview.api.FeatureRenderer;
+import jalview.api.FeatureSettingsModelI;
 import jalview.api.FeaturesDisplayedI;
 import jalview.bin.BuildDetails;
 import jalview.datamodel.AlignmentAnnotation;
@@ -709,6 +710,7 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
     }
   }
 
+  @Override
   public String getGlobalColourScheme()
   {
     return globalColourScheme;
@@ -730,8 +732,13 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
     this.displayedFeatures = displayedFeatures;
   }
 
+  @Override
   public void configureForView(AlignmentViewPanel avpanel)
   {
+    if (avpanel == null)
+    {
+      return;
+    }
     super.configureForView(avpanel);
     AlignViewportI viewport = avpanel.getAlignViewport();
     AlignmentI alignment = viewport.getAlignment();
@@ -741,11 +748,14 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
     fr = avpanel.cloneFeatureRenderer();
 
     // Add non auto calculated annotation to AlignFile
-    for (AlignmentAnnotation annot : annots)
+    if (annots != null)
     {
-      if (annot != null && !annot.autoCalculated)
+      for (AlignmentAnnotation annot : annots)
       {
-        annotations.add(annot);
+        if (annot != null && !annot.autoCalculated)
+        {
+          annotations.add(annot);
+        }
       }
     }
     globalColourScheme = ColourSchemeProperty.getColourName(viewport
@@ -755,6 +765,7 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
 
   }
 
+  @Override
   public boolean isShowSeqFeatures()
   {
     return showSeqFeatures;
@@ -775,6 +786,7 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
     return hiddenColumns;
   }
 
+  @Override
   public ColumnSelection getColumnSelection()
   {
     return columnSelection;
@@ -785,6 +797,7 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
     this.columnSelection = columnSelection;
   }
 
+  @Override
   public SequenceI[] getHiddenSequences()
   {
     if (hiddenSequences == null || hiddenSequences.isEmpty())
@@ -864,4 +877,19 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
       this.exportJalviewSettings = exportJalviewSettings;
     }
   }
+
+  /**
+   * Returns a descriptor for suitable feature display settings with
+   * <ul>
+   * <li>ResNums or insertions features visible</li>
+   * <li>insertions features coloured red</li>
+   * <li>ResNum features coloured by label</li>
+   * <li>Insertions displayed above (on top of) ResNums</li>
+   * </ul>
+   */
+  @Override
+  public FeatureSettingsModelI getFeatureColourScheme()
+  {
+    return new PDBFeatureSettings();
+  }
 }