(JAL-969) refactored alignmentViewport base class to own package and pulled up most...
[jalview.git] / src / jalview / gui / AnnotationPanel.java
index eb0189e..e77fbed 100755 (executable)
@@ -169,7 +169,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
   public int calcPanelHeight()
   {
     // setHeight of panels
-    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+    AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
     int height = 0;
 
     if (aa != null)
@@ -227,7 +227,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
    */
   public void actionPerformed(ActionEvent evt)
   {
-    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+    AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
     if (aa == null)
     {
       return;
@@ -269,7 +269,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
       {
         int index = av.getColumnSelection().columnAt(i);
 
-        if (!av.colSel.isVisible(index))
+        if (!av.getColumnSelection().isVisible(index))
           continue;
 
         if (anot[index] == null)
@@ -294,7 +294,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
       {
         int index = av.getColumnSelection().columnAt(i);
 
-        if (!av.colSel.isVisible(index))
+        if (!av.getColumnSelection().isVisible(index))
           continue;
 
         if (anot[index] == null)
@@ -350,7 +350,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
       {
         int index = av.getColumnSelection().columnAt(i);
 
-        if (!av.colSel.isVisible(index))
+        if (!av.getColumnSelection().isVisible(index))
           continue;
 
         if (anot[index] == null)
@@ -374,11 +374,12 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
   {
     String collatedInput = "";
     String last = "";
+    // TODO: refactor and save av.getColumnSelection for efficiency
     for (int i = 0; i < columnSelection.size(); i++)
     {
       int index = columnSelection.columnAt(i);
       // always check for current display state - just in case
-      if (!av.colSel.isVisible(index))
+      if (!av.getColumnSelection().isVisible(index))
         continue;
       String tlabel = null;
       if (anot[index] != null)
@@ -422,7 +423,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
   public void mousePressed(MouseEvent evt)
   {
 
-    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+    AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
     if (aa == null)
     {
       return;
@@ -467,7 +468,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
       /*
        * Just display the needed structure options
        */
-      if (av.alignment.isNucleotide() == true)
+      if (av.getAlignment().isNucleotide() == true)
       {
         item = new JMenuItem(STEM);
         item.addActionListener(this);
@@ -551,11 +552,11 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
   {
     if (graphStretch > -1)
     {
-      av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY
+      av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY
               - evt.getY();
-      if (av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight < 0)
+      if (av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight < 0)
       {
-        av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight = 0;
+        av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight = 0;
       }
       graphStretchY = evt.getY();
       adjustPanelHeight();
@@ -575,7 +576,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
    */
   public void mouseMoved(MouseEvent evt)
   {
-    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+    AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
 
     if (aa == null)
     {
@@ -609,7 +610,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
 
     int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
 
-    if (av.hasHiddenColumns)
+    if (av.hasHiddenColumns())
     {
       res = av.getColumnSelection().adjustForHiddenColumns(res);
     }
@@ -676,7 +677,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
   {
     if (activeRow != -1)
     {
-      AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+      AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
       AlignmentAnnotation anot = aa[activeRow];
 
       if (anot.description.equals("secondary structure"))
@@ -765,9 +766,9 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
   {
 
     if ((horizontal == 0) || gg == null
-            || av.alignment.getAlignmentAnnotation() == null
-            || av.alignment.getAlignmentAnnotation().length < 1
-            || av.updatingConsensus || av.updatingConservation)
+            || av.getAlignment().getAlignmentAnnotation() == null
+            || av.getAlignment().getAlignmentAnnotation().length < 1
+            || av.isCalcInProgress())
     {
       repaint();
       return;
@@ -811,7 +812,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
    */
   public void drawComponent(Graphics g, int startRes, int endRes)
   {
-    if (av.updatingConsensus || av.updatingConservation)
+    if (av.isCalcInProgress())
     {
       if (image == null)
       {
@@ -852,8 +853,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
       fm = g.getFontMetrics();
     }
 
-    if ((av.alignment.getAlignmentAnnotation() == null)
-            || (av.alignment.getAlignmentAnnotation().length < 1))
+    if ((av.getAlignment().getAlignmentAnnotation() == null)
+            || (av.getAlignment().getAlignmentAnnotation().length < 1))
     {
       g.setColor(Color.white);
       g.fillRect(0, 0, getWidth(), getHeight());