JAL-3485 (enum) constants for Auto-annotation label and preference key
[jalview.git] / src / jalview / project / Jalview2XML.java
index b58b01c..59275cd 100644 (file)
@@ -92,6 +92,7 @@ import jalview.util.StringUtils;
 import jalview.util.jarInputStreamProvider;
 import jalview.util.matcher.Condition;
 import jalview.viewmodel.AlignmentViewport;
+import jalview.viewmodel.AlignmentViewport.AutoAnnotation;
 import jalview.viewmodel.PCAModel;
 import jalview.viewmodel.ViewportRanges;
 import jalview.viewmodel.seqfeatures.FeatureRendererSettings;
@@ -210,6 +211,10 @@ import javax.xml.stream.XMLStreamReader;
  */
 public class Jalview2XML
 {
+  private static final String TRUE = "true";
+
+  private static final String FALSE = "false";
+
   private static final String VIEWER_PREFIX = "viewer_";
 
   private static final String RNA_PREFIX = "rna_";
@@ -3642,17 +3647,14 @@ public class Jalview2XML
          * test if annotation is automatically calculated for this view only
          */
         boolean autoForView = false;
-        if (annotation.getLabel().equals("Quality")
-                || annotation.getLabel().equals("Conservation")
-                || annotation.getLabel().equals("Consensus"))
+        if (annotation.getLabel().equals(AutoAnnotation.QUALITY.label)
+                || annotation.getLabel()
+                        .equals(AutoAnnotation.CONSERVATION.label)
+                || annotation.getLabel()
+                        .equals(AutoAnnotation.CONSENSUS.label))
         {
           // Kludge for pre 2.5 projects which lacked the autocalculated flag
           autoForView = true;
-          // JAXB has no has() test; schema defaults value to false
-          // if (!annotation.hasAutoCalculated())
-          // {
-          // annotation.setAutoCalculated(true);
-          // }
         }
         if (autoForView || annotation.isAutoCalculated())
         {
@@ -4589,7 +4591,7 @@ public class Jalview2XML
       {
         if (val.contains("e")) // eh? what can it be?
         {
-          if (val.trim().equals("true"))
+          if (val.trim().equals(TRUE))
           {
             val = "1";
           }