moved to same place as in jalview.gui
[jalview.git] / src / jalview / appletgui / AlignmentPanel.java
index c466b86..e4b9b59 100755 (executable)
@@ -22,9 +22,10 @@ import java.awt.event.*;
 import java.util.Hashtable;
 import java.util.Vector;
 
+import jalview.api.AlignmentViewPanel;
 import jalview.datamodel.*;
 
-public class AlignmentPanel extends Panel implements AdjustmentListener
+public class AlignmentPanel extends Panel implements AdjustmentListener, AlignmentViewPanel
 {
 
   public AlignViewport av;
@@ -272,7 +273,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener
         return false;
       }
       SequenceI seq = av.alignment.getSequenceAt(seqIndex);
-      int[] r = results.getResults(seq, seq.getStart(), seq.getEnd());
+      int[] r = results.getResults(seq, 0,av.alignment.getWidth());
       if (r == null)
       {
         if (av.applet.debug) {// DEBUG
@@ -380,7 +381,64 @@ public class AlignmentPanel extends Panel implements AdjustmentListener
     validate();
     repaint();
   }
-
+  
+  /**
+   * automatically adjust annotation panel height for new annotation whilst
+   * ensuring the alignment is still visible.
+   */
+  public void adjustAnnotationHeight()
+  {
+    // TODO: display vertical annotation scrollbar if necessary
+    // this is called after loading new annotation onto alignment
+    if (alignFrame.getSize().height == 0)
+    {
+      System.out.println("NEEDS FIXING");
+    }
+    fontChanged();
+    validateAnnotationDimensions(true);
+    apvscroll.addNotify();
+    hscroll.addNotify();
+    validate();
+    addNotify();
+    repaint();
+  }
+  /**
+   * calculate the annotation dimensions and refresh slider values accordingly.
+   * need to do repaints/notifys afterwards. 
+   */
+  protected void validateAnnotationDimensions(boolean adjustPanelHeight) {
+    int height = annotationPanel.calcPanelHeight();
+    if (hscroll.isVisible())
+    {
+      height += hscroll.getPreferredSize().height;
+    }
+    int mheight = height;
+    // sets initial preferred height
+    if ((height+40) > getSize().height / 2)
+    {
+      height = getSize().height / 2;
+    }
+    if (!adjustPanelHeight)
+    {
+      // maintain same window layout whilst updating sliders
+      height=seqPanelHolder.getSize().height;
+    }
+    Dimension d=seqPanelHolder.getSize(),e=idPanel.getSize(); 
+    annotationPanel.setSize(new Dimension(d.width,height));
+    alabels.setSize(e.width,height);
+    annotationSpaceFillerHolder.setSize(new Dimension(e.width, height));
+    annotationPanelHolder.setSize(new Dimension(d.width, height));
+    seqPanelHolder.setSize(d.width,d.height-height);
+    int s=apvscroll.getValue();
+    if (s>mheight-height)
+    {
+      s = 0;
+    }
+    apvscroll.setValues(apvscroll.getValue(), height, 0, mheight);
+    annotationPanel.setScrollOffset(apvscroll.getValue());
+    alabels.setScrollOffset(apvscroll.getValue());
+  }
+  
   public void setWrapAlignment(boolean wrap)
   {
     av.startSeq = 0;
@@ -833,61 +891,10 @@ public class AlignmentPanel extends Panel implements AdjustmentListener
     adjustAnnotationHeight();
   }
 
-  /**
-   * automatically adjust annotation panel height for new annotation whilst
-   * ensuring the alignment is still visible.
-   */
-  public void adjustAnnotationHeight()
+  @Override
+  public AlignmentI getAlignment()
   {
-    // TODO: display vertical annotation scrollbar if necessary
-    // this is called after loading new annotation onto alignment
-    if (alignFrame.getSize().height == 0)
-    {
-      System.out.println("NEEDS FIXING");
-    }
-    fontChanged();
-    validateAnnotationDimensions(true);
-    apvscroll.addNotify();
-    hscroll.addNotify();
-    validate();
-    addNotify();
-    repaint();
-  }
-  /**
-   * calculate the annotation dimensions and refresh slider values accordingly.
-   * need to do repaints/notifys afterwards. 
-   */
-  protected void validateAnnotationDimensions(boolean adjustPanelHeight) {
-    int height = annotationPanel.calcPanelHeight();
-    if (hscroll.isVisible())
-    {
-      height += hscroll.getPreferredSize().height;
-    }
-    int mheight = height;
-    // sets initial preferred height
-    if ((height+40) > getSize().height / 2)
-    {
-      height = getSize().height / 2;
-    }
-    if (!adjustPanelHeight)
-    {
-      // maintain same window layout whilst updating sliders
-      height=seqPanelHolder.getSize().height;
-    }
-    Dimension d=seqPanelHolder.getSize(),e=idPanel.getSize(); 
-    annotationPanel.setSize(new Dimension(d.width,height));
-    alabels.setSize(e.width,height);
-    annotationSpaceFillerHolder.setSize(new Dimension(e.width, height));
-    annotationPanelHolder.setSize(new Dimension(d.width, height));
-    seqPanelHolder.setSize(d.width,d.height-height);
-    int s=apvscroll.getValue();
-    if (s>mheight-height)
-    {
-      s = 0;
-    }
-    apvscroll.setValues(apvscroll.getValue(), height, 0, mheight);
-    annotationPanel.setScrollOffset(apvscroll.getValue());
-    alabels.setScrollOffset(apvscroll.getValue());
+    return av.alignment;
   }
 
 }