From 621f426fa1cd84aa41ab94581fecf0b4b659da50 Mon Sep 17 00:00:00 2001 From: Renia Correya Date: Fri, 30 Aug 2024 18:34:10 +0530 Subject: [PATCH] Fix for JAL-4427 Sequence ID text showing html code - protein disorder. --- src/jalview/gui/AnnotationLabels.java | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 7c5afcd..27417f0 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -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) -- 1.7.10.2