JAL-1912 added documentation
[jalview.git] / src / jalview / io / JSONFile.java
index 7e7052f..9e94d91 100644 (file)
@@ -384,9 +384,10 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
       AnnotationDisplaySettingPojo annotSetting = new AnnotationDisplaySettingPojo();
       annotSetting.setBelowAlignment(annot.belowAlignment);
       annotSetting.setCentreColLabels(annot.centreColLabels);
-      annotSetting.setScaleColLabel(annot.centreColLabels);
+      annotSetting.setScaleColLabel(annot.scaleColLabel);
       annotSetting.setShowAllColLabels(annot.showAllColLabels);
       annotSetting.setVisible(annot.visible);
+      annotSetting.setHasIcon(annot.hasIcons);
       alignAnnotPojo.setAnnotationSettings(annotSetting);
       SequenceI refSeq = annot.sequenceRef;
       if (refSeq != null)
@@ -402,7 +403,10 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
           annotationPojo.setValue(annotation.value);
           annotationPojo
                   .setSecondaryStructure(annotation.secondaryStructure);
-          annotationPojo.setDisplayCharacter(annotation.displayCharacter);
+          String displayChar = annotation.displayCharacter == null ? null
+                  : annotation.displayCharacter;
+          // System.out.println("--------------------->[" + displayChar + "]");
+          annotationPojo.setDisplayCharacter(displayChar);
           if (annotation.colour != null)
           {
             annotationPojo.setColour(jalview.util.Format
@@ -554,11 +558,14 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
                     .get("secondaryStructure").toString().charAt(0);
             String displayChar = annot.get("displayCharacter") == null ? ""
                     : annot.get("displayCharacter").toString();
-            Color color = annot.get("colour") == null ? Color.white
-                    : UserColourScheme.getColourFromString(annot.get(
-                    "colour").toString());
-            annotations[count] = new Annotation(displayChar, desc, ss, val,
-                    color);
+
+            annotations[count] = new Annotation(displayChar, desc, ss, val);
+            if (annot.get("colour") != null)
+            {
+              Color color = UserColourScheme.getColourFromString(annot.get(
+                      "colour").toString());
+              annotations[count].colour = color;
+            }
           }
           ++count;
         }
@@ -592,6 +599,9 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
           alignAnnot.visible = (diplaySettings.get("visible") == null) ? true
                   : Boolean.valueOf(diplaySettings.get("visible")
                           .toString());
+          alignAnnot.hasIcons = (diplaySettings.get("hasIcon") == null) ? true
+                  : Boolean.valueOf(diplaySettings.get("hasIcon")
+                          .toString());
 
         }
         if (alAnnot.get("score") != null)
@@ -619,7 +629,9 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
             alignAnnot.adjustForAlignment();
           }
         }
+        alignAnnot.validateRangeAndDisplay();
         this.annotations.add(alignAnnot);
+
       }
     } catch (Exception e)
     {