JAL-2491 Renamed comp scrolling flag for consistency; small tweaks
[jalview.git] / src / jalview / gui / AlignmentPanel.java
index 673c008..769dc86 100644 (file)
@@ -104,9 +104,9 @@ public class AlignmentPanel extends GAlignmentPanel implements
 
   /*
    * Flag set while scrolling to follow complementary cDNA/protein scroll. When
-   * true, suppresses invoking the same method recursively.
+   * false, suppresses invoking the same method recursively.
    */
-  private boolean dontScrollComplement = false;
+  private boolean scrollComplementaryPanel = true;
 
   private PropertyChangeListener propertyChangeListener;
 
@@ -769,7 +769,16 @@ public class AlignmentPanel extends GAlignmentPanel implements
           @Override
           public void run()
         {
-            setScrollValues(vpRanges.getStartRes(), vpRanges.getStartSeq());
+            // When updating scrolling to use ViewportChange events, this code
+            // could not be validated and it is not clear if it is now being
+            // called. Log warning here in case it is called and unforeseen
+            // problems occur
+            Cache.log
+                    .warn("Unexpected path through code: Wrapped jar file opened with wrap alignment set in preferences");
+
+            // scroll to start of panel
+            vpRanges.setStartRes(0);
+            vpRanges.setStartSeq(0);
           }
         });
       }
@@ -1827,14 +1836,14 @@ public class AlignmentPanel extends GAlignmentPanel implements
    * 
    * @param b
    */
-  protected void setDontScrollComplement(boolean b)
+  protected void setToScrollComplementPanel(boolean b)
   {
-    this.dontScrollComplement = b;
+    this.scrollComplementaryPanel = b;
   }
 
-  protected boolean isDontScrollComplement()
+  protected boolean isSetToScrollComplementPanel()
   {
-    return this.dontScrollComplement;
+    return this.scrollComplementaryPanel;
   }
 
   /**
@@ -1873,11 +1882,11 @@ public class AlignmentPanel extends GAlignmentPanel implements
 
     // now update any complementary alignment (its viewport ranges object
     // is different so does not get automatically updated)
-    if (!isDontScrollComplement())
+    if (isSetToScrollComplementPanel())
     {
-      setDontScrollComplement(true);
+      setToScrollComplementPanel(false);
       av.scrollComplementaryAlignment();
-      setDontScrollComplement(false);
+      setToScrollComplementPanel(true);
     }
   }
 }