JAL-1683 replace year/version strings with tokens in source
[jalview.git] / src / jalview / gui / SeqCanvas.java
index be5c7ae..ff576ec 100755 (executable)
@@ -1,27 +1,42 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
  * Jalview is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License 
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
  * Jalview is distributed in the hope that it will be useful, but 
  * WITHOUT ANY WARRANTY; without even the implied warranty 
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
  * PURPOSE.  See the GNU General Public License for more details.
  * 
- * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
 package jalview.gui;
 
-import java.awt.*;
-import java.awt.image.*;
-import javax.swing.*;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+
+import java.awt.BasicStroke;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.Shape;
+import java.awt.image.BufferedImage;
+import java.util.List;
 
-import jalview.datamodel.*;
+import javax.swing.JComponent;
 
 /**
  * DOCUMENT ME!
@@ -244,16 +259,11 @@ public class SeqCanvas extends JComponent
    */
   public void fastPaint(int horizontal, int vertical)
   {
-    if (fastpainting)
+    if (fastpainting || gg == null)
     {
       return;
     }
     fastpainting = true;
-    if (gg == null)
-    {
-      return;
-    }
-
     fastPaint = true;
 
     gg.copyArea(horizontal * av.charWidth, vertical * av.charHeight,
@@ -564,7 +574,7 @@ public class SeqCanvas extends JComponent
 
       drawPanel(g, startRes, endx, 0, al.getHeight(), ypos);
 
-      if (av.showAnnotation)
+      if (av.isShowAnnotation())
       {
         g.translate(0, cHeight + ypos + 3);
         if (annotations == null)
@@ -572,7 +582,7 @@ public class SeqCanvas extends JComponent
           annotations = new AnnotationPanel(av);
         }
 
-        annotations.renderer.drawComponent(annotations, av, (Graphics2D) g,
+        annotations.renderer.drawComponent(annotations, av, g,
                 -1, startRes, endx + 1);
         g.translate(0, -cHeight - ypos - 3);
       }
@@ -589,7 +599,7 @@ public class SeqCanvas extends JComponent
 
   int getAnnotationHeight()
   {
-    if (!av.showAnnotation)
+    if (!av.isShowAnnotation())
     {
       return 0;
     }
@@ -618,7 +628,8 @@ public class SeqCanvas extends JComponent
    * @param offset
    *          DOCUMENT ME!
    */
-  void drawPanel(Graphics g1, int startRes, int endRes, int startSeq,
+  public void drawPanel(Graphics g1, int startRes, int endRes,
+          int startSeq,
           int endSeq, int offset)
   {
     if (!av.hasHiddenColumns())
@@ -627,7 +638,7 @@ public class SeqCanvas extends JComponent
     }
     else
     {
-      java.util.Vector regions = av.getColumnSelection().getHiddenColumns();
+      List<int[]> regions = av.getColumnSelection().getHiddenColumns();
 
       int screenY = 0;
       int blockStart = startRes;
@@ -635,7 +646,7 @@ public class SeqCanvas extends JComponent
 
       for (int i = 0; regions != null && i < regions.size(); i++)
       {
-        int[] region = (int[]) regions.elementAt(i);
+        int[] region = regions.get(i);
         int hideStart = region[0];
         int hideEnd = region[1];
 
@@ -701,7 +712,7 @@ public class SeqCanvas extends JComponent
       sr.drawSequence(nextSeq, av.getAlignment().findAllGroups(nextSeq),
               startRes, endRes, offset + ((i - startSeq) * av.charHeight));
 
-      if (av.showSequenceFeatures)
+      if (av.isShowSequenceFeatures())
       {
         fr.drawSequence(g, nextSeq, startRes, endRes, offset
                 + ((i - startSeq) * av.charHeight));
@@ -760,7 +771,7 @@ public class SeqCanvas extends JComponent
 
     if ((group == null) && (av.getAlignment().getGroups().size() > 0))
     {
-      group = (SequenceGroup) av.getAlignment().getGroups().get(0);
+      group = av.getAlignment().getGroups().get(0);
       groupIndex = 0;
     }
 
@@ -921,7 +932,7 @@ public class SeqCanvas extends JComponent
           break;
         }
 
-        group = (SequenceGroup) av.getAlignment().getGroups()
+        group = av.getAlignment().getGroups()
                 .get(groupIndex);
 
       } while (groupIndex < av.getAlignment().getGroups().size());