minor changes
[jalview.git] / src / jalview / gui / AlignmentPanel.java
index d305183..c62b2a7 100644 (file)
@@ -70,7 +70,14 @@ import java.util.List;
 import javax.swing.SwingUtilities;
 
 /**
- * DOCUMENT ME!
+ * The main panel of an AlignFrame, containing holders for the IdPanel,
+ * SeqPanel, AnnotationLabels (a JPanel), and AnnotationPanel.
+ * 
+ * Additional holders contain an IdPanelWidthAdjuster space above the idPanel,
+ * AnnotationScroller (JScrollPane for AnnotationPanel), and vertical and
+ * horizontal scrollbars.
+ * 
+ * 
  * 
  * @author $author$
  * @version $Revision: 1.161 $
@@ -585,7 +592,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
    */
   public void updateLayout()
   {
-    fontChanged();
+    fontChanged(); // fires repaint
     setAnnotationVisible(av.isShowAnnotation());
     boolean wrap = av.getWrapAlignment();
     ViewportRanges ranges = av.getRanges();
@@ -835,7 +842,6 @@ public class AlignmentPanel extends GAlignmentPanel implements
     }
     if (updateOverview)
     {
-
       if (overviewPanel != null)
       {
         overviewPanel.updateOverviewImage();
@@ -852,6 +858,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
   @Override
   public void paintComponent(Graphics g)
   {
+
     invalidate(); // needed so that the id width adjuster works correctly
 
     Dimension d = getIdPanel().getIdCanvas().getPreferredSize();
@@ -865,7 +872,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
      * though I still think this call should be elsewhere.
      */
     ViewportRanges ranges = av.getRanges();
-    setScrollValues(ranges.getStartRes(), ranges.getStartSeq());
+    // setScrollValues(ranges.getStartRes(), ranges.getStartSeq());
     super.paintComponent(g);
   }
 
@@ -1846,4 +1853,85 @@ public class AlignmentPanel extends GAlignmentPanel implements
     overviewPanel.canvas.finalizeDraw(miniMe);
   }
 
+
+  private boolean holdRepaint = false;
+
+  /**
+   * Checked by SeqCanvas when painting
+   * 
+   * @return
+   */
+  public boolean getHoldRepaint()
+  {
+    return holdRepaint;
+  }
+
+  /**
+   * Called specifically by Jalview2xml when loading a JPV file
+   * 
+   * @param b
+   */
+  public void setHoldRepaint(boolean b)
+  {
+    if (holdRepaint == b)
+    {
+      return;
+    }
+    holdRepaint = b;
+    if (!b)
+    {
+      repaint();
+    }
+  }
+
+  @Override
+  public void repaint()
+  {
+    if (holdRepaint)
+    {
+      // System.out.println("AP repaint holding");
+      // Platform.stackTrace();
+      return;
+    }
+    super.repaint();
+  }
+
+  public void selectAllSequences()
+  {
+    selectSequences(av.getAlignment().getSequences());
+  }
+
+  public void deselectAllSequences()
+  {
+    if (av.cursorMode)
+    {
+      getSeqPanel().keyboardNo1 = null;
+      getSeqPanel().keyboardNo2 = null;
+    }
+    av.setSelectionGroup(null);
+    av.getColumnSelection().clear();
+    av.setSelectionGroup(null);
+    getIdPanel().getIdCanvas().searchResults = null;
+    av.sendSelection();
+    // JAL-2034 - should delegate to
+    // alignPanel to decide if overview needs
+    // updating.
+    paintAlignment(false, false);
+    PaintRefresher.Refresh(this, av.getSequenceSetId());
+  }
+
+  public void selectSequences(List<SequenceI> seqs)
+  {
+    SequenceGroup sg = new SequenceGroup(seqs);
+    sg.setEndRes(av.getAlignment().getWidth() - 1);
+    av.setSelectionGroup(sg);
+    av.isSelectionGroupChanged(true);
+    av.sendSelection();
+    // JAL-2034 - should delegate to
+    // alignPanel to decide if overview needs
+    // updating.
+    paintAlignment(false, false);
+    PaintRefresher.Refresh(this, av.getSequenceSetId());
+  }
+
 }