formatting
[jalview.git] / src / jalview / renderer / AnnotationRenderer.java
index cfdfdf6..e527c10 100644 (file)
@@ -91,7 +91,7 @@ public class AnnotationRenderer
 
   private FontMetrics fm;
 
-  private boolean MAC = new jalview.util.Platform().isAMac();
+  private final boolean MAC = new jalview.util.Platform().isAMac();
 
   boolean av_renderHistogram = true, av_renderProfile = true,
           av_normaliseProfile = false;
@@ -212,20 +212,25 @@ public class AnnotationRenderer
   }
 
   /**
-   * DOCUMENT ME!
-   * 
-   * @param annotationPanel
-   *          TODO
+   * Render the annotation rows associated with an alignment.
+   * @param annotPanel
+   *          container frame
+   * @param av
+   *          data and view settings to render
    * @param g
-   *          DOCUMENT ME!
+   *          destination for graphics
+   * @param activeRow
+   *          row where a mouse event occured (or -1)
    * @param startRes
-   *          DOCUMENT ME!
+   *          first column that will be drawn
    * @param endRes
-   *          DOCUMENT ME!
+   *          last column that will be drawn
+   * @return true if the fadedImage was used for any alignment annotation rows currently being calculated
    */
-  public void drawComponent(AwtRenderPanelI annotPanel, AlignViewportI av,
+  public boolean drawComponent(AwtRenderPanelI annotPanel, AlignViewportI av,
           Graphics g, int activeRow, int startRes, int endRes)
   {
+    boolean usedFaded=false;
     // NOTES:
     // AnnotationPanel needs to implement: ImageObserver, access to
     // AlignViewport
@@ -289,10 +294,10 @@ public class AnnotationRenderer
         iconOffset = 0;
       }
 
-      if (aa[i].autoCalculated && av.isCalculationInProgress(aa[i]))
+      if (row.autoCalculated && av.isCalculationInProgress(row))
       {
         y += charHeight;
-
+        usedFaded=true;
         g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
                 - row.height, imgWidth, y, annotationPanel);
         g.setColor(Color.black);
@@ -304,22 +309,22 @@ public class AnnotationRenderer
       /*
        * else if (annotationPanel.av.updatingConservation &&
        * aa[i].label.equals("Conservation")) {
-       * 
+       *
        * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y -
        * row.height, annotationPanel.imgWidth, y, 0, y - row.height,
        * annotationPanel.imgWidth, y, annotationPanel);
-       * 
+       *
        * g.setColor(Color.black); //
        * g.drawString("Calculating Conservation.....",20, y-row.height/2);
-       * 
+       *
        * continue; } else if (annotationPanel.av.updatingConservation &&
        * aa[i].label.equals("Quality")) {
-       * 
+       *
        * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y -
        * row.height, annotationPanel.imgWidth, y, 0, y - row.height,
        * annotationPanel.imgWidth, y, annotationPanel); g.setColor(Color.black);
        * // / g.drawString("Calculating Quality....",20, y-row.height/2);
-       * 
+       *
        * continue; }
        */
       // first pass sets up state for drawing continuation from left-hand column
@@ -555,7 +560,6 @@ public class AnnotationRenderer
               {
                 aa[gg].visible = false;
               }
-
               if (aa[gg].graphMax > groupmax)
               {
                 groupmax = aa[gg].graphMax;
@@ -600,15 +604,16 @@ public class AnnotationRenderer
         y += aa[i].height;
       }
     }
+    return !usedFaded;
   }
 
-  private Color GLYPHLINE_COLOR = Color.gray;
+  private final Color GLYPHLINE_COLOR = Color.gray;
 
-  private Color SHEET_COLOUR = Color.green;
+  private final Color SHEET_COLOUR = Color.green;
 
-  private Color HELIX_COLOUR = Color.red;
+  private final Color HELIX_COLOUR = Color.red;
 
-  private Color STEM_COLOUR = Color.blue;
+  private final Color STEM_COLOUR = Color.blue;
 
   public void drawGlyphLine(Graphics g, Annotation[] row,
           int lastSSX, int x, int y, int iconOffset, int startRes,