JAL-3333 Title text now appears instantly. Altering speed of rotating logo depending...
authorBen Soares <bsoares@dundee.ac.uk>
Sat, 29 Jun 2019 00:52:43 +0000 (01:52 +0100)
committerBen Soares <bsoares@dundee.ac.uk>
Sat, 29 Jun 2019 00:52:43 +0000 (01:52 +0100)
src/jalview/gui/WebserviceInfo.java

index 801e3da..2b85141 100644 (file)
@@ -346,6 +346,7 @@ public class WebserviceInfo extends GWebserviceInfo
     ap.setPreferredSize(new Dimension(60, 60));
     titlePanel.add(ap, BorderLayout.WEST);
     titlePanel.add(titleText, BorderLayout.CENTER);
+    setStatus(currentStatus);
 
     Thread thread = new Thread(ap);
     thread.start();
@@ -792,24 +793,34 @@ protected void cancel_actionPerformed(ActionEvent e)
     BufferedImage offscreen;
 
     @Override
-       public void run()
+    public void run()
     {
       startTime = System.currentTimeMillis();
 
+      float invSpeed = 30f;
       while (currentStatus < STATE_STOPPED_OK)
       {
+        if (currentStatus == STATE_QUEUING)
+        {
+          invSpeed = 25f;
+        }
+        else if (currentStatus == STATE_RUNNING)
+        {
+          invSpeed = 10f;
+        }
         try
         {
           Thread.sleep(50);
 
           int units = (int) ((System.currentTimeMillis() - startTime)
-                  / 10f);
+                  / invSpeed);
           angle += units;
           angle %= 360;
           startTime = System.currentTimeMillis();
 
           if (currentStatus >= STATE_STOPPED_OK)
           {
+            park();
             angle = 0;
           }
 
@@ -822,6 +833,34 @@ protected void cancel_actionPerformed(ActionEvent e)
       cancel.setEnabled(false);
     }
 
+    public void park()
+    {
+      startTime = System.currentTimeMillis();
+
+      while (angle < 360)
+      {
+        try
+        {
+          Thread.sleep(25);
+
+          int units = (int) ((System.currentTimeMillis() - startTime)
+                  / 5f);
+          angle += units;
+          startTime = System.currentTimeMillis();
+
+          if (angle >= 360)
+          {
+            angle = 360;
+          }
+
+          repaint();
+        } catch (Exception ex)
+        {
+        }
+      }
+
+    }
+
     void drawPanel()
     {
       if (offscreen == null || offscreen.getWidth(this) != getWidth()