Pad gaps method
authoramwaterhouse <Andrew Waterhouse>
Tue, 1 May 2007 16:33:57 +0000 (16:33 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 1 May 2007 16:33:57 +0000 (16:33 +0000)
src/jalview/datamodel/AlignmentAnnotation.java

index ae81a90..fe655c1 100755 (executable)
@@ -398,7 +398,7 @@ Loading...
   public boolean padAnnotation(int length) {
     if (annotations==null)
     {
-      return true; // annotation row is correct - null == not visible and undefined length 
+      return true; // annotation row is correct - null == not visible and undefined length
     }
     if (annotations.length<length)
     {
@@ -649,4 +649,20 @@ Loading...
     this(label, description, null);
     setScore(score);
   }
+
+  public void setPadGaps(boolean padgaps, char gapchar)
+  {
+    this.padGaps = padgaps;
+    if(padgaps)
+    {
+      hasText = true;
+      for(int i=0; i<annotations.length; i++)
+      {
+        if(annotations[i]==null)
+          annotations[i] = new Annotation(String.valueOf(gapchar),null,' ',0f);
+        else if(annotations[i].displayCharacter==null ||annotations[i].displayCharacter.equals(" "))
+          annotations[i].displayCharacter=String.valueOf(gapchar);
+      }
+    }
+  }
 }