JAL-3383 JAL-3253-applet Java8 switches to clarify ViewportRanges
[jalview.git] / src / jalview / gui / IdCanvas.java
index 12f3971..e5a5946 100755 (executable)
@@ -152,6 +152,7 @@ public class IdCanvas extends JPanel implements ViewportListenerI
    */
   public void fastPaint(int vertical)
   {
+
     /*
      * for now, not attempting fast paint of wrapped ids...
      */
@@ -220,8 +221,6 @@ public class IdCanvas extends JPanel implements ViewportListenerI
   @Override
   public void paintComponent(Graphics g)
   {
-    //super.paintComponent(g);  // BH 2019
-
     g.setColor(Color.white);
     g.fillRect(0, 0, getWidth(), getHeight());
     
@@ -385,12 +384,6 @@ public class IdCanvas extends JPanel implements ViewportListenerI
     int alignmentWidth = alignViewport.getAlignment().getWidth();
     final int alheight = alignViewport.getAlignment().getHeight();
 
-    if (alignViewport.hasHiddenColumns())
-    {
-      alignmentWidth = alignViewport.getAlignment().getHiddenColumns()
-              .absoluteToVisibleColumn(alignmentWidth) - 1;
-    }
-
     int annotationHeight = 0;
 
     AnnotationLabels labels = null;
@@ -586,21 +579,45 @@ public class IdCanvas extends JPanel implements ViewportListenerI
   @Override
   public void propertyChange(PropertyChangeEvent evt)
   {
+    // BH just clarifying logic
     String propertyName = evt.getPropertyName();
-    if (propertyName.equals(ViewportRanges.STARTSEQ)
-            || (av.getWrapAlignment()
-                    && propertyName.equals(ViewportRanges.STARTRES)))
-    {
+    switch (propertyName) {
+    case ViewportRanges.STARTSEQ:
       fastPaint((int) evt.getNewValue() - (int) evt.getOldValue());
-    }
-    else if (propertyName.equals(ViewportRanges.STARTRESANDSEQ))
-    {
+      return;
+    case ViewportRanges.STARTRES:
+      if (av.getWrapAlignment())
+      {
+        fastPaint((int) evt.getNewValue() - (int) evt.getOldValue());
+      }
+      return;
+    case ViewportRanges.STARTRESANDSEQ:
       fastPaint(((int[]) evt.getNewValue())[1]
               - ((int[]) evt.getOldValue())[1]);
-    }
-    else if (propertyName.equals(ViewportRanges.MOVE_VIEWPORT))
-    {
+      return;
+    case ViewportRanges.MOVE_VIEWPORT:
       repaint();
+      return;
+    case ViewportRanges.ENDRES:
+    case ViewportRanges.ENDSEQ:
+      // ignore ??
+      return;
     }
+// BH 2019.07.27 was:
+//    if (propertyName.equals(ViewportRanges.STARTSEQ)
+//            || (av.getWrapAlignment()
+//                    && propertyName.equals(ViewportRanges.STARTRES)))
+//    {
+//      fastPaint((int) evt.getNewValue() - (int) evt.getOldValue());
+//    }
+//    else if (propertyName.equals(ViewportRanges.STARTRESANDSEQ))
+//    {
+//      fastPaint(((int[]) evt.getNewValue())[1]
+//              - ((int[]) evt.getOldValue())[1]);
+//    }
+//    else if (propertyName.equals(ViewportRanges.MOVE_VIEWPORT))
+//    {
+//      repaint();
+    // }
   }
 }