From 077c19b2811c3ad56ee0705dcdd469218c42c583 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 14 Apr 2005 15:03:40 +0000 Subject: [PATCH] new class --- src/jalview/gui/WebserviceInfo.java | 141 ++++++++++++++++++++++++++++++++ src/jalview/jbgui/GWebserviceInfo.java | 81 ++++++++++++++++++ 2 files changed, 222 insertions(+) create mode 100755 src/jalview/gui/WebserviceInfo.java create mode 100755 src/jalview/jbgui/GWebserviceInfo.java diff --git a/src/jalview/gui/WebserviceInfo.java b/src/jalview/gui/WebserviceInfo.java new file mode 100755 index 0000000..82f8f1c --- /dev/null +++ b/src/jalview/gui/WebserviceInfo.java @@ -0,0 +1,141 @@ +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_STOPPED_ERROR = 3; + int currentStatus = STATE_QUEUING; + Image image; + int angle = 0; + + String title=""; + + 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); + frame.setLayer(JLayeredPane.PALETTE_LAYER); + + + 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) + { + JOptionPane.showInternalMessageDialog(Desktop.desktop, + "Cancel not implemented yet!!" , + "Cancel job" + ,JOptionPane.WARNING_MESSAGE); + } + + + class AnimatedPanel extends JPanel implements Runnable + { + public void run() + { + while(currentStatus