package jalview.gui; import java.awt.*; import java.awt.event.*; import javax.swing.*; import jalview.jbgui.GWebserviceInfo; public class WebserviceInfo extends GWebserviceInfo { public static final int STATE_QUEUING = 0; public static final int STATE_RUNNING = 1; public static final int STATE_STOPPED_OK = 2; public static final int STATE_CANCELLED_OK = 3; public static final int STATE_STOPPED_ERROR = 4; int currentStatus = STATE_QUEUING; Image image; int angle = 0; String title=""; jalview.ws.WSClientI thisService; boolean serviceIsCancellable; public jalview.ws.WSClientI getthisService() { return thisService; } public void setthisService(jalview.ws.WSClientI newservice) { thisService = newservice; serviceIsCancellable = newservice.isCancellable(); } public WebserviceInfo(String title, String info) { init(title, info, 520, 500); } public WebserviceInfo(String title, String info, int width, int height) { init(title, info, width, height); } void init(String title, String info, int width, int height) { JInternalFrame frame = new JInternalFrame(); frame.setContentPane(this); Desktop.addInternalFrame(frame, title, width, height); this.title = title; setInfoText(info); java.net.URL url = getClass().getResource("/images/logo.gif"); image = java.awt.Toolkit.getDefaultToolkit().createImage(url); MediaTracker mt = new MediaTracker(this); mt.addImage(image, 0); try { mt.waitForID(0); } catch (Exception ex) {} AnimatedPanel ap = new AnimatedPanel(); titlePanel.add(ap, BorderLayout.CENTER); Thread thread = new Thread(ap); thread.start(); } public void setStatus(int status) { currentStatus = status; } public String getInfoText() { return infoText.getText(); } public void setInfoText(String text) { infoText.setText(text); } public void appendInfoText(String text) { infoText.append(text); } public String getProgressText() { return progressText.getText(); } public void setProgressText(String text) { progressText.setText(text); } public void appendProgressText(String text) { progressText.append(text); } protected void cancel_actionPerformed(ActionEvent e) { if (!serviceIsCancellable) JOptionPane.showInternalMessageDialog(Desktop.desktop, "This job cannot be cancelled." , "Cancel job" ,JOptionPane.WARNING_MESSAGE); else thisService.cancelJob(); } class AnimatedPanel extends JPanel implements Runnable { long startTime=0; public void run() { startTime = System.currentTimeMillis(); while(currentStatus