Merge branch 'JAL-3878_web_services_overhaul' into try-to-update-slivka-jar
[jalview.git] / src / jalview / viewmodel / AlignmentViewport.java
index 179bfa0..066be9b 100644 (file)
@@ -62,7 +62,7 @@ import jalview.workers.ComplementConsensusThread;
 import jalview.workers.ConsensusThread;
 import jalview.workers.InformationThread;
 import jalview.workers.StrucConsensusThread;
-import jalview.ws2.WebServiceExecutor;
+import jalview.ws2.PollingTaskExecutor;
 
 import java.awt.Color;
 import java.beans.PropertyChangeSupport;
@@ -88,7 +88,6 @@ public abstract class AlignmentViewport
 {
   public static final String PROPERTY_ALIGNMENT = "alignment";
   public static final String PROPERTY_SEQUENCE = "sequence";
-
   protected ViewportRanges ranges;
 
   protected ViewStyleI viewStyle = new ViewStyle();
@@ -617,6 +616,7 @@ public abstract class AlignmentViewport
    * alignment
    */
   protected boolean isDataset = false;
+
   
   public void setDataset(boolean b)
   {
@@ -655,11 +655,10 @@ public abstract class AlignmentViewport
   {
     autoCalculateStrucConsensus = b;
   }
-
-
   protected boolean ignoreGapsInConsensusCalculation = false;
 
   protected ResidueShaderI residueShading = new ResidueShader();
+
   
   @Override
   public void setGlobalColourScheme(ColourSchemeI cs)
@@ -734,6 +733,7 @@ public abstract class AlignmentViewport
   {
     return residueShading;
   }
+
   
   protected AlignmentAnnotation consensus;
 
@@ -768,6 +768,7 @@ public abstract class AlignmentViewport
   protected Hashtable<String, Object>[] hStrucConsensus = null;
 
   protected Conservation hconservation = null;
+
   
   @Override
   public void setConservation(Conservation cons)
@@ -953,7 +954,6 @@ public abstract class AlignmentViewport
       calculator.registerWorker(new InformationThread(this, ap));
     }
   }
-
   // --------START Structure Conservation
   public void updateStrucConsensus(final AlignmentViewPanel ap)
   {
@@ -996,9 +996,9 @@ public abstract class AlignmentViewport
     return false;
   }
 
-  private WebServiceExecutor wsExecutor = new WebServiceExecutor();
+  private PollingTaskExecutor wsExecutor = new PollingTaskExecutor();
 
-  public WebServiceExecutor getWSExecutor()
+  public PollingTaskExecutor getWSExecutor()
   {
     return wsExecutor;
   }
@@ -1039,6 +1039,7 @@ public abstract class AlignmentViewport
     ranges = null;
     currentTree = null;
     selectionGroup = null;
+    colSel = null;
     setAlignment(null);
   }
 
@@ -1149,7 +1150,6 @@ public abstract class AlignmentViewport
     }
     this.hmmShowSequenceLogo = showHMMSequenceLogo;
   }
-
   /**
    * @param showConsensusHistogram
    *          the showConsensusHistogram to set
@@ -1457,7 +1457,6 @@ public abstract class AlignmentViewport
   {
     return infoLetterHeight;
   }
-
   // property change stuff
   // JBPNote Prolly only need this in the applet version.
   private PropertyChangeSupport changeSupport = new PropertyChangeSupport(
@@ -1509,6 +1508,7 @@ public abstract class AlignmentViewport
     }
   }
 
+
   // common hide/show column stuff
 
   public void hideSelectedColumns()
@@ -1580,7 +1580,6 @@ public abstract class AlignmentViewport
     }
   }
 
-
   public void showSequence(int index)
   {
     int startSeq = ranges.getStartSeq();
@@ -1603,6 +1602,7 @@ public abstract class AlignmentViewport
       }
 
       ranges.setStartEndSeq(startSeq, endSeq + tmp.size());
+
       notifyAlignment();
       sendSelection();
     }
@@ -2088,7 +2088,6 @@ public abstract class AlignmentViewport
               MessageManager.getString("label.consensus_descr"),
               new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
       initConsensus(consensus);
-
       initGapCounts();
 
       initComplementConsensus();
@@ -3134,7 +3133,6 @@ public abstract class AlignmentViewport
     }
     return false;
   }
-
   @Override
   public void setCurrentTree(TreeModel tree)
   {
@@ -3261,6 +3259,24 @@ public abstract class AlignmentViewport
       codingComplement.setUpdateStructures(needToUpdateStructureViews);
     }
   }
+
+  @Override
+  public Iterator<int[]> getViewAsVisibleContigs(boolean selectedRegionOnly)
+  {
+    int start = 0;
+    int end = 0;
+    if (selectedRegionOnly && selectionGroup != null)
+    {
+      start = selectionGroup.getStartRes();
+      end = selectionGroup.getEndRes() + 1;
+    }
+    else
+    {
+      end = alignment.getWidth();
+    }
+    return (alignment.getHiddenColumns().getVisContigsIterator(start, end,
+            false));
+  }
   /**
    * Filters out sequences with an eValue higher than the specified value. The
    * filtered sequences are hidden or deleted. Sequences with no eValues are also