JAL-958 store/recover normalised flag
[jalview.git] / src / jalview / viewmodel / AlignmentViewport.java
index 8c34f31..27af11e 100644 (file)
@@ -1374,4 +1374,75 @@ public abstract class AlignmentViewport implements AlignViewportI
     }
   }
 
+  /*
+   * (non-Javadoc)
+   * @see jalview.api.AlignViewportI#calcPanelHeight()
+   */
+  public int calcPanelHeight()
+  {
+    // setHeight of panels
+    AlignmentAnnotation[] aa = getAlignment().getAlignmentAnnotation();
+    int height = 0;
+    int charHeight=getCharHeight();
+    if (aa != null)
+    {
+      boolean graphgrp[] = null;
+      for (int i = 0; i < aa.length; i++)
+      {
+        if (aa[i] == null)
+        {
+          System.err.println("Null annotation row: ignoring.");
+          continue;
+        }
+        if (!aa[i].visible)
+        {
+          continue;
+        }
+        if (aa[i].graphGroup > -1)
+        {
+          if (graphgrp == null)
+          {
+            graphgrp = new boolean[aa.length];
+          }
+          if (graphgrp[aa[i].graphGroup])
+          {
+            continue;
+          }
+          else
+          {
+            graphgrp[aa[i].graphGroup] = true;
+          }
+        }
+        aa[i].height = 0;
+  
+        if (aa[i].hasText)
+        {
+          aa[i].height += charHeight;
+        }
+  
+        if (aa[i].hasIcons)
+        {
+          aa[i].height += 16;
+        }
+  
+        if (aa[i].graph > 0)
+        {
+          aa[i].height += aa[i].graphHeight;
+        }
+  
+        if (aa[i].height == 0)
+        {
+          aa[i].height = 20;
+        }
+  
+        height += aa[i].height;
+      }
+    }
+    if (height == 0)
+    {
+      // set minimum
+      height = 20;
+    }
+    return height;
+  }
 }