JAL-1400 add codebase and caller allowable codebase
[jalview.git] / src / jalview / appletgui / AnnotationPanel.java
index 59cdb11..154652d 100755 (executable)
@@ -1,18 +1,18 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ * 
  * This file is part of Jalview.
- *
+ * 
  * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License 
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
  * PURPOSE.  See the GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
  */
 package jalview.appletgui;
@@ -21,7 +21,6 @@ import java.util.*;
 
 import java.awt.*;
 import java.awt.event.*;
-import java.awt.image.BufferedImage;
 
 import jalview.datamodel.*;
 import jalview.renderer.AnnotationRenderer;
@@ -254,10 +253,10 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI,
       }
     }
 
-    aa[activeRow].validateRangeAndDisplay();
+    av.getAlignment().validateAnnotation(aa[activeRow]);
 
-    adjustPanelHeight();
     ap.alignmentChanged();
+    adjustPanelHeight();
     repaint();
 
     return;
@@ -654,4 +653,16 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI,
   {
     return imgWidth;
   }
+  private int[] bounds = new int[2];
+  @Override
+  public int[] getVisibleVRange()
+  {
+    if (ap!=null && ap.alabels!=null)
+    {
+    int sOffset=-ap.alabels.scrollOffset;
+    int visHeight = sOffset+ap.annotationPanelHolder.getHeight();
+    bounds[0] = sOffset; bounds[1]=visHeight;
+    return bounds;
+    } else return null;
+  }
 }