JAL-2228 java 1.7 compliance
[jalview.git] / src / jalview / workers / ColumnCounterSetWorker.java
index 6c5707d..2422748 100644 (file)
@@ -182,19 +182,19 @@ class ColumnCounterSetWorker extends AlignCalcWorker
     for (int anrow = 0; anrow < rows; anrow++)
     {
       Annotation[] anns = new Annotation[width];
+      long rmax = 0;
       /*
-       * add non-zero counts as annotations
+       * add counts as annotations. zeros are needed since select-by-annotation ignores empty annotation positions
        */
       for (int i = 0; i < counts.length; i++)
       {
         int count = counts[i][anrow];
-        if (count > 0)
-        {
-          Color color = ColorUtils.getGraduatedColour(count, 0, minColour,
-                  max[anrow], maxColour);
-          String str = String.valueOf(count);
-          anns[i] = new Annotation(str, str, '0', count, color);
-        }
+
+        Color color = ColorUtils.getGraduatedColour(count, 0, minColour,
+                max[anrow], maxColour);
+        String str = String.valueOf(count);
+        anns[i] = new Annotation(str, str, '0', count, color);
+        rmax = Math.max(count, rmax);
       }
 
       /*
@@ -212,7 +212,8 @@ class ColumnCounterSetWorker extends AlignCalcWorker
       ann.scaleColLabel = true;
       ann.graph = AlignmentAnnotation.BAR_GRAPH;
       ann.annotations = anns;
-      setGraphMinMax(ann, anns);
+      ann.graphMin = 0f; // minimum always zero count
+      ann.graphMax = rmax; // maximum count from loop over feature columns
       ann.validateRangeAndDisplay();
       if (!ourAnnots.contains(ann))
       {