Fix for JAL-4427
authorRenia Correya <rcorreya001@dundee.ac.uk>
Fri, 30 Aug 2024 13:04:10 +0000 (18:34 +0530)
committerRenia Correya <rcorreya001@dundee.ac.uk>
Fri, 30 Aug 2024 13:04:10 +0000 (18:34 +0530)
Sequence ID text showing html code - protein disorder.

src/jalview/gui/AnnotationLabels.java

index 7c5afcd..27417f0 100755 (executable)
@@ -66,6 +66,7 @@ import jalview.io.FileFormat;
 import jalview.io.FormatAdapter;
 import jalview.util.Comparison;
 import jalview.util.MessageManager;
+import jalview.util.ParseHtmlBodyAndLinks;
 import jalview.util.Platform;
 
 /**
@@ -1348,6 +1349,7 @@ public class AnnotationLabels extends JPanel
     }
     SequenceI lastSeqRef = null;
     String lastLabel = null;
+    String lastDescription = null;
     AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
     int fontHeight = g != null ? g.getFont().getSize()
             : fm.getFont().getSize();
@@ -1435,10 +1437,24 @@ public class AnnotationLabels extends JPanel
           offset += fm.getDescent();
         }
         String label = aa[i].label;
+        ParseHtmlBodyAndLinks phbDecription = new ParseHtmlBodyAndLinks(
+                aa[i].description, true, "\n");
+        String description = phbDecription.getNonHtmlContent();
         boolean vertBar = false;
-        if ((lastLabel != null && lastLabel.equals(label)))
+        if (lastLabel != null && lastLabel.equals(label) && 
+                lastDescription != null && lastDescription.equals(description))
         {
-          label = aa[i].description;
+          //JAL-4427
+          label = aa[i].label; // No change in label
+        }
+        else if (lastLabel != null && lastLabel.equals(label))
+        {
+          //JAL-4427
+          if(!(lastDescription != null && lastDescription.equals(description))
+                  &&  (aa[i].sequenceRef == lastSeqRef)) {
+              label = description;
+              lastDescription = description;
+          }
         }
         else
         {
@@ -1447,11 +1463,18 @@ public class AnnotationLabels extends JPanel
           {
             lastLabel = label;
             // next label is the same as this label
-            label = aa[i].description;
+            //JAL-4427
+            if(!(lastDescription != null && lastDescription.equals(description))) {
+              if(aa[nexAA].sequenceRef == aa[i].sequenceRef) {
+                label = description;
+              }
+              lastDescription = description;
+            }
           }
           else
           {
             lastLabel = label;
+            lastDescription = description;
           }
         }
         if (aa[i].sequenceRef != null)