Added checks for X mouse coordinate being >= 0 and a test for JAL-2750
[jalview.git] / src / jalview / datamodel / SequenceGroup.java
index 20b23a9..221b031 100755 (executable)
@@ -102,7 +102,7 @@ public class SequenceGroup implements AnnotatedCollectionI
   public ResidueShaderI cs;
 
   // start column (base 0)
-  int startRes = 0;
+  private int startRes = 0;
 
   // end column (base 0)
   int endRes = 0;
@@ -184,19 +184,7 @@ public class SequenceGroup implements AnnotatedCollectionI
     this.displayText = displayText;
     this.colourText = colourText;
     this.cs = new ResidueShader(scheme);
-    
-    if (start > 0) // sanity check for negative start column positions
-    {
-      startRes = start;
-    }
-    else
-    {
-      jalview.bin.Cache.log.warn(
-              "Negative start column index detected, resetting to default index: "
-                      + startRes);
-      // start = startRes;
-    }
-    
+    startRes = start;
     endRes = end;
     recalcConservation();
   }
@@ -221,19 +209,7 @@ public class SequenceGroup implements AnnotatedCollectionI
       displayText = seqsel.displayText;
       colourText = seqsel.colourText;
       
-      if (seqsel.startRes > 0) // sanity check for negative start column
-                               // positions
-      {
-        startRes = seqsel.startRes;
-      }
-      else
-      {
-        jalview.bin.Cache.log.warn(
-                "Negative start column index detected, resetting to default index: "
-                        + startRes);
-        // seqsel.startRes = startRes;
-      }
-  
+      startRes = seqsel.startRes;
       endRes = seqsel.endRes;
       cs = new ResidueShader((ResidueShader) seqsel.cs);
       if (seqsel.description != null)
@@ -778,11 +754,16 @@ public class SequenceGroup implements AnnotatedCollectionI
    * 
    * @param i
    */
-  public void setStartRes(int i)
+  public void setStartRes(int newStart)
   {
-    int before = startRes;
-    startRes = i;
-    changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, startRes);
+   newStart= Math.max(0,newStart); // sanity check for negative start column positions
+   int before = startRes;
+   startRes = newStart;
+
+   changeSupport.firePropertyChange(SEQ_GROUP_CHANGED, before, startRes);
+    
+
+
   }
 
   /**