formatting
[jalview.git] / src / jalview / renderer / AnnotationRenderer.java
index e527c10..b207f94 100644 (file)
@@ -213,6 +213,7 @@ public class AnnotationRenderer
 
   /**
    * Render the annotation rows associated with an alignment.
+   * 
    * @param annotPanel
    *          container frame
    * @param av
@@ -225,12 +226,14 @@ public class AnnotationRenderer
    *          first column that will be drawn
    * @param endRes
    *          last column that will be drawn
-   * @return true if the fadedImage was used for any alignment annotation rows currently being calculated
+   * @return true if the fadedImage was used for any alignment annotation rows
+   *         currently being calculated
    */
-  public boolean drawComponent(AwtRenderPanelI annotPanel, AlignViewportI av,
-          Graphics g, int activeRow, int startRes, int endRes)
+  public boolean drawComponent(AwtRenderPanelI annotPanel,
+          AlignViewportI av, Graphics g, int activeRow, int startRes,
+          int endRes)
   {
-    boolean usedFaded=false;
+    boolean usedFaded = false;
     // NOTES:
     // AnnotationPanel needs to implement: ImageObserver, access to
     // AlignViewport
@@ -258,7 +261,7 @@ public class AnnotationRenderer
     for (int i = 0; i < aa.length; i++)
     {
       AlignmentAnnotation row = aa[i];
-      Annotation[] row_annotations=row.annotations;
+      Annotation[] row_annotations = row.annotations;
       if (!row.visible)
       {
         continue;
@@ -297,7 +300,7 @@ public class AnnotationRenderer
       if (row.autoCalculated && av.isCalculationInProgress(row))
       {
         y += charHeight;
-        usedFaded=true;
+        usedFaded = true;
         g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
                 - row.height, imgWidth, y, annotationPanel);
         g.setColor(Color.black);
@@ -309,22 +312,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
@@ -456,19 +459,19 @@ public class AnnotationRenderer
               switch (lastSS)
               {
               case 'H':
-                drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
-                        column, validRes, validEnd);
+                drawHelixAnnot(g, row_annotations, lastSSX, x, y,
+                        iconOffset, startRes, column, validRes, validEnd);
                 break;
 
               case 'E':
-                drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
-                        column, validRes, validEnd);
+                drawSheetAnnot(g, row_annotations, lastSSX, x, y,
+                        iconOffset, startRes, column, validRes, validEnd);
                 break;
 
               case 'S': // Stem case for RNA secondary structure
               case 's': // and opposite direction
-                drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
-                        column, validRes, validEnd);
+                drawStemAnnot(g, row_annotations, lastSSX, x, y,
+                        iconOffset, startRes, column, validRes, validEnd);
                 break;
 
               default:
@@ -522,22 +525,22 @@ public class AnnotationRenderer
         switch (lastSS)
         {
         case 'H':
-          drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
-                  column, validRes, validEnd);
+          drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
+                  startRes, column, validRes, validEnd);
           break;
 
         case 'E':
-          drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
-                  column, validRes, validEnd);
+          drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
+                  startRes, column, validRes, validEnd);
           break;
         case 's':
         case 'S': // Stem case for RNA secondary structure
-          drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
-                  column, validRes, validEnd);
+          drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset,
+                  startRes, column, validRes, validEnd);
           break;
         default:
-          drawGlyphLine(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
-                  column, validRes, validEnd);
+          drawGlyphLine(g, row_annotations, lastSSX, x, y, iconOffset,
+                  startRes, column, validRes, validEnd);
           break;
         }
       }
@@ -574,8 +577,8 @@ public class AnnotationRenderer
             {
               if (aa[gg].graphGroup == row.graphGroup)
               {
-                drawLineGraph(g, aa[gg], aa[gg].annotations, startRes, endRes, y, groupmin,
-                        groupmax, row.graphHeight);
+                drawLineGraph(g, aa[gg], aa[gg].annotations, startRes,
+                        endRes, y, groupmin, groupmax, row.graphHeight);
               }
             }
 
@@ -583,14 +586,14 @@ public class AnnotationRenderer
           }
           else
           {
-            drawLineGraph(g, row, row_annotations, startRes, endRes, y, row.graphMin,
-                    row.graphMax, row.graphHeight);
+            drawLineGraph(g, row, row_annotations, startRes, endRes, y,
+                    row.graphMin, row.graphMax, row.graphHeight);
           }
         }
         else if (row.graph == AlignmentAnnotation.BAR_GRAPH)
         {
-          drawBarGraph(g, row, row_annotations, startRes, endRes, row.graphMin,
-                  row.graphMax, y);
+          drawBarGraph(g, row, row_annotations, startRes, endRes,
+                  row.graphMin, row.graphMax, y);
         }
       }
 
@@ -615,21 +618,21 @@ public class AnnotationRenderer
 
   private final Color STEM_COLOUR = Color.blue;
 
-  public void drawGlyphLine(Graphics g, Annotation[] row,
-          int lastSSX, int x, int y, int iconOffset, int startRes,
-          int column, boolean validRes, boolean validEnd)
+  public void drawGlyphLine(Graphics g, Annotation[] row, int lastSSX,
+          int x, int y, int iconOffset, int startRes, int column,
+          boolean validRes, boolean validEnd)
   {
     g.setColor(GLYPHLINE_COLOR);
     g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth) - lastSSX, 2);
   }
 
-  public void drawSheetAnnot(Graphics g, Annotation[] row,
-          int lastSSX, int x, int y, int iconOffset, int startRes,
-          int column, boolean validRes, boolean validEnd)
+  public void drawSheetAnnot(Graphics g, Annotation[] row, int lastSSX,
+          int x, int y, int iconOffset, int startRes, int column,
+          boolean validRes, boolean validEnd)
   {
     g.setColor(SHEET_COLOUR);
 
-    if (!validEnd || !validRes || row==null || row[column] == null
+    if (!validEnd || !validRes || row == null || row[column] == null
             || row[column].secondaryStructure != 'E')
     {
       g.fillRect(lastSSX, y + 4 + iconOffset,
@@ -648,9 +651,9 @@ public class AnnotationRenderer
 
   }
 
-  public void drawHelixAnnot(Graphics g, Annotation[] row,
-          int lastSSX, int x, int y, int iconOffset, int startRes,
-          int column, boolean validRes, boolean validEnd)
+  public void drawHelixAnnot(Graphics g, Annotation[] row, int lastSSX,
+          int x, int y, int iconOffset, int startRes, int column,
+          boolean validRes, boolean validEnd)
   {
     g.setColor(HELIX_COLOUR);
 
@@ -708,8 +711,9 @@ public class AnnotationRenderer
     g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
   }
 
-  public void drawLineGraph(Graphics g, AlignmentAnnotation _aa, Annotation[] aa_annotations, int sRes,
-          int eRes, int y, float min, float max, int graphHeight)
+  public void drawLineGraph(Graphics g, AlignmentAnnotation _aa,
+          Annotation[] aa_annotations, int sRes, int eRes, int y,
+          float min, float max, int graphHeight)
   {
     if (sRes > aa_annotations.length)
     {
@@ -797,8 +801,9 @@ public class AnnotationRenderer
     }
   }
 
-  public void drawBarGraph(Graphics g, AlignmentAnnotation _aa, Annotation[] aa_annotations, int sRes,
-          int eRes, float min, float max, int y)
+  public void drawBarGraph(Graphics g, AlignmentAnnotation _aa,
+          Annotation[] aa_annotations, int sRes, int eRes, float min,
+          float max, int y)
   {
     if (sRes > aa_annotations.length)
     {
@@ -934,7 +939,7 @@ public class AnnotationRenderer
               // g.drawRect(x*av.charWidth, (int)ht, av.charWidth,
               // (int)(scl));
               // g.setColor(profcolour.findColour(dc[0]).darker());
-              g.setColor(profcolour.findColour(dc[0], column,null));
+              g.setColor(profcolour.findColour(dc[0], column, null));
 
               hght = (ht + (scl - lm.getDescent() - lm.getBaselineOffsets()[lm
                       .getBaselineIndex()]));
@@ -955,15 +960,16 @@ public class AnnotationRenderer
               BasicStroke.JOIN_ROUND, 3f, new float[]
               { 5f, 3f }, 0f));
 
-      y2 = (int) (y - ((_aa.threshold.value - min) / range) * _aa.graphHeight);
+      y2 = (int) (y - ((_aa.threshold.value - min) / range)
+              * _aa.graphHeight);
       g.drawLine(0, y2, (eRes - sRes) * charWidth, y2);
       g2.setStroke(new BasicStroke());
     }
   }
 
   // used by overview window
-  public void drawGraph(Graphics g, AlignmentAnnotation _aa, Annotation[] aa_annotations, int width,
-          int y, int sRes, int eRes)
+  public void drawGraph(Graphics g, AlignmentAnnotation _aa,
+          Annotation[] aa_annotations, int width, int y, int sRes, int eRes)
   {
     eRes = Math.min(eRes, aa_annotations.length);
     g.setColor(Color.white);