From 6da8d6719f9cce1221134697277c3cdc7d560d0b Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Sat, 29 Jun 2019 01:52:43 +0100 Subject: [PATCH] JAL-3333 Title text now appears instantly. Altering speed of rotating logo depending on queuing or running status. Rotating logo now 'parks' rather than jumps at completion. --- src/jalview/gui/WebserviceInfo.java | 43 +++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/src/jalview/gui/WebserviceInfo.java b/src/jalview/gui/WebserviceInfo.java index 801e3da..2b85141 100644 --- a/src/jalview/gui/WebserviceInfo.java +++ b/src/jalview/gui/WebserviceInfo.java @@ -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() -- 1.7.10.2