javadoc
[jalview.git] / src / jalview / gui / AnnotationPanel.java
index 03fbf28..df29464 100755 (executable)
@@ -27,8 +27,7 @@ import jalview.renderer.AnnotationRenderer;
 import jalview.renderer.AwtRenderPanelI;
 
 /**
- * DOCUMENT ME!
- *
+ * AnnotationPanel displays visible portion of annotation rows below unwrapped alignment 
  * @author $author$
  * @version $Revision$
  */
@@ -146,7 +145,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
    */
   public int adjustPanelHeight()
   {
-    int height = calcPanelHeight();
+    int height = av.calcPanelHeight();
     this.setPreferredSize(new Dimension(1, height));
     if (ap != null)
     {
@@ -158,65 +157,6 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
   }
 
   /**
-   * calculate the height for visible annotation, revalidating bounds where
-   * necessary ABSTRACT GUI METHOD
-   *
-   * @return total height of annotation
-   */
-  public int calcPanelHeight()
-  {
-    // setHeight of panels
-    AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
-    int height = 0;
-
-    if (aa != 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;
-        }
-
-        aa[i].height = 0;
-
-        if (aa[i].hasText)
-        {
-          aa[i].height += av.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;
-  }
-
-  /**
    * DOCUMENT ME!
    *
    * @param evt
@@ -363,6 +303,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
     aa[activeRow].validateRangeAndDisplay();
 
     adjustPanelHeight();
+    ap.alignmentChanged();
     repaint();
 
     return;