JAL-1402 conditional logic to ensure annotation & label panel/canvas components not...
authorJim Procter <jprocter@dundee.ac.uk>
Tue, 27 May 2014 15:02:12 +0000 (16:02 +0100)
committerJim Procter <jprocter@dundee.ac.uk>
Tue, 27 May 2014 15:02:12 +0000 (16:02 +0100)
src/jalview/appletgui/AlignmentPanel.java
src/jalview/appletgui/AnnotationLabels.java
src/jalview/appletgui/AnnotationPanel.java

index 7f2a943..3214e70 100644 (file)
@@ -433,6 +433,9 @@ public class AlignmentPanel extends Panel implements AdjustmentListener,
     {
       annotationSpaceFillerHolder.setVisible(b);
       annotationPanelHolder.setVisible(b);
+    } else {
+      annotationSpaceFillerHolder.setVisible(false);
+      annotationPanelHolder.setVisible(false);
     }
     validate();
     repaint();
@@ -512,7 +515,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener,
     alabels.setSize(new Dimension(e.width, height));
     annotationSpaceFillerHolder.setSize(new Dimension(e.width, height));
     annotationPanelHolder.setSize(new Dimension(d.width, height));
-    seqPanelHolder.setSize(d.width, seqandannot - height);
+    // seqPanelHolder.setSize(d.width, seqandannot - height);
     seqPanel.seqCanvas
             .setSize(d.width, seqPanel.seqCanvas.getSize().height);
     int s = apvscroll.getValue();
@@ -521,8 +524,8 @@ public class AlignmentPanel extends Panel implements AdjustmentListener,
       s = 0;
     }
     apvscroll.setValues(s, height, 0, mheight);
-    annotationPanel.setScrollOffset(apvscroll.getValue());
-    alabels.setScrollOffset(apvscroll.getValue());
+    annotationPanel.setScrollOffset(apvscroll.getValue(), false);
+    alabels.setScrollOffset(apvscroll.getValue(), false);
   }
 
   public void setWrapAlignment(boolean wrap)
@@ -544,12 +547,13 @@ public class AlignmentPanel extends Panel implements AdjustmentListener,
       annotationPanelHolder.setVisible(true);
       annotationSpaceFillerHolder.setVisible(true);
     }
-
+    
     idSpaceFillerPanel1.setVisible(!wrap);
 
     fontChanged(); // This is so that the scalePanel is resized correctly
 
     validate();
+    sequenceHolderPanel.revalidate();
     repaint();
 
   }
@@ -686,8 +690,8 @@ public class AlignmentPanel extends Panel implements AdjustmentListener,
 
     if (evt == null || evt.getSource() == apvscroll)
     {
-      annotationPanel.setScrollOffset(apvscroll.getValue());
-      alabels.setScrollOffset(apvscroll.getValue());
+      annotationPanel.setScrollOffset(apvscroll.getValue(), false);
+      alabels.setScrollOffset(apvscroll.getValue(), false);
       // annotationPanel.image=null;
       // alabels.image=null;
       // alabels.repaint();
@@ -817,12 +821,18 @@ public class AlignmentPanel extends Panel implements AdjustmentListener,
       setScrollValues(av.getStartRes(), av.getStartSeq());
     }
 
-    alabels.repaint();
-
     seqPanel.seqCanvas.repaint();
-    scalePanel.repaint();
-    annotationPanel.repaint();
     idPanel.idCanvas.repaint();
+    if (!av.wrapAlignment) 
+    {
+      if (av.showAnnotation)
+      {
+        alabels.repaint();
+        annotationPanel.repaint();
+      }
+      scalePanel.repaint();
+    }
+    
   }
 
   protected Panel sequenceHolderPanel = new Panel();
index 7d4c38c..5900b67 100755 (executable)
@@ -93,10 +93,13 @@ public class AnnotationLabels extends Panel implements ActionListener,
     this.av = av;
   }
 
-  public void setScrollOffset(int y)
+  public void setScrollOffset(int y, boolean repaint)
   {
     scrollOffset = y;
-    repaint();
+    if (repaint)
+    {
+      repaint();
+    }
   }
 
   /**
index 2704306..a343bcf 100755 (executable)
@@ -636,10 +636,13 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI,
 
   int scrollOffset = 0;
 
-  public void setScrollOffset(int value)
+  public void setScrollOffset(int value, boolean repaint)
   {
     scrollOffset = value;
-    repaint();
+    if (repaint)
+    {
+      repaint();
+    }
   }
 
   @Override