X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FWebserviceInfo.java;h=c6137ccf3fb0e7268c385596564e04e55bb53e40;hb=8fa69554edf6aeb278b4a4afd8e2b60264fdccd8;hp=f530018b2c418766bd115e7e0679f70e9b9b488e;hpb=bd318fe40b8d07db486f47d788dcdc2df8cb9e9c;p=jalview.git diff --git a/src/jalview/gui/WebserviceInfo.java b/src/jalview/gui/WebserviceInfo.java index f530018..c6137cc 100644 --- a/src/jalview/gui/WebserviceInfo.java +++ b/src/jalview/gui/WebserviceInfo.java @@ -20,6 +20,10 @@ */ package jalview.gui; +import jalview.jbgui.GWebserviceInfo; +import jalview.util.MessageManager; +import jalview.ws.WSClientI; + import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; @@ -35,7 +39,6 @@ import java.util.Vector; import javax.swing.JComponent; import javax.swing.JEditorPane; import javax.swing.JInternalFrame; -import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; @@ -45,10 +48,6 @@ import javax.swing.event.HyperlinkListener; import javax.swing.text.html.HTMLEditorKit; import javax.swing.text.html.StyleSheet; -import jalview.jbgui.GWebserviceInfo; -import jalview.util.MessageManager; -import jalview.ws.WSClientI; - /** * Base class for web service client thread and gui TODO: create StAX parser to * extract html body content reliably when preparing html formatted job statuses @@ -56,8 +55,8 @@ import jalview.ws.WSClientI; * @author $author$ * @version $Revision$ */ -public class WebserviceInfo extends GWebserviceInfo implements - HyperlinkListener, IProgressIndicator +public class WebserviceInfo extends GWebserviceInfo + implements HyperlinkListener, IProgressIndicator { /** Job is Queued */ @@ -92,7 +91,7 @@ public class WebserviceInfo extends GWebserviceInfo implements JInternalFrame frame; - private ProgressBar progressBar; + private IProgressIndicator progressBar; @Override public void setVisible(boolean aFlag) @@ -328,8 +327,8 @@ public class WebserviceInfo extends GWebserviceInfo implements this.title = title; setInfoText(info); - java.net.URL url = getClass().getResource( - "/images/Jalview_Logo_small.png"); + java.net.URL url = getClass() + .getResource("/images/Jalview_Logo_small.png"); image = java.awt.Toolkit.getDefaultToolkit().createImage(url); MediaTracker mt = new MediaTracker(this); @@ -348,19 +347,21 @@ public class WebserviceInfo extends GWebserviceInfo implements Thread thread = new Thread(ap); thread.start(); final WebserviceInfo thisinfo = this; - frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() - { - public void internalFrameClosed( - javax.swing.event.InternalFrameEvent evt) - { - // System.out.println("Shutting down webservice client"); - WSClientI service = thisinfo.getthisService(); - if (service != null && service.isCancellable()) - { - service.cancelJob(); - } - }; - }); + frame.addInternalFrameListener( + new javax.swing.event.InternalFrameAdapter() + { + @Override + public void internalFrameClosed( + javax.swing.event.InternalFrameEvent evt) + { + // System.out.println("Shutting down webservice client"); + WSClientI service = thisinfo.getthisService(); + if (service != null && service.isCancellable()) + { + service.cancelJob(); + } + }; + }); frame.validate(); } @@ -386,7 +387,9 @@ public class WebserviceInfo extends GWebserviceInfo implements { if (jobpane < 0 || jobpane >= jobPanes.size()) { - throw new Error(MessageManager.formatMessage("error.setstatus_called_non_existent_job_pane", new String[]{Integer.valueOf(jobpane).toString()})); + throw new Error(MessageManager.formatMessage( + "error.setstatus_called_non_existent_job_pane", new String[] + { Integer.valueOf(jobpane).toString() })); } switch (status) { @@ -513,8 +516,8 @@ public class WebserviceInfo extends GWebserviceInfo implements int htmlpos = leaveFirst ? -1 : lowertxt.indexOf("", htmlpos), htmlende = lowertxt - .indexOf(">", htmlend); + int htmlpose = lowertxt.indexOf(">", htmlpos), + htmlende = lowertxt.indexOf(">", htmlend); if (htmlend == -1 && htmlpos == -1) { return text; @@ -561,8 +564,8 @@ public class WebserviceInfo extends GWebserviceInfo implements } if (text.indexOf(" -1) { - System.err.println("HTML COntent: \n" + text - + "<< END HTML CONTENT\n"); + System.err + .println("HTML COntent: \n" + text + "<< END HTML CONTENT\n"); } return text; @@ -584,11 +587,12 @@ public class WebserviceInfo extends GWebserviceInfo implements { String txt = getHtmlFragment( ((JEditorPane) ((JScrollPane) jobPanes.get(which)) - .getViewport().getComponent(0)).getText(), true, - false); + .getViewport().getComponent(0)).getText(), + true, false); ((JEditorPane) ((JScrollPane) jobPanes.get(which)).getViewport() - .getComponent(0)).setText(ensureHtmlTagged(txt - + getHtmlFragment(text, false, true))); + .getComponent(0)) + .setText(ensureHtmlTagged( + txt + getHtmlFragment(text, false, true))); } else { @@ -672,6 +676,7 @@ public class WebserviceInfo extends GWebserviceInfo implements * @param e * DOCUMENT ME! */ + @Override protected void cancel_actionPerformed(ActionEvent e) { if (!serviceIsCancellable) @@ -680,7 +685,9 @@ public class WebserviceInfo extends GWebserviceInfo implements // anyhow - it has to stop threads and clean up // JBPNote : TODO: Instead of a warning, we should have an optional 'Are // you sure?' prompt - warnUser(MessageManager.getString("warn.job_cannot_be_cancelled_close_window"), + warnUser( + MessageManager.getString( + "warn.job_cannot_be_cancelled_close_window"), MessageManager.getString("action.cancel_job")); } else @@ -701,10 +708,11 @@ public class WebserviceInfo extends GWebserviceInfo implements { javax.swing.SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { - JOptionPane.showInternalMessageDialog(Desktop.desktop, message, - title, JOptionPane.WARNING_MESSAGE); + JvOptionPane.showInternalMessageDialog(Desktop.desktop, message, + title, JvOptionPane.WARNING_MESSAGE); } }); @@ -750,6 +758,7 @@ public class WebserviceInfo extends GWebserviceInfo implements BufferedImage offscreen; + @Override public void run() { startTime = System.currentTimeMillis(); @@ -760,7 +769,8 @@ public class WebserviceInfo extends GWebserviceInfo implements { Thread.sleep(50); - int units = (int) ((System.currentTimeMillis() - startTime) / 10f); + int units = (int) ((System.currentTimeMillis() - startTime) + / 10f); angle += units; angle %= 360; startTime = System.currentTimeMillis(); @@ -824,8 +834,8 @@ public class WebserviceInfo extends GWebserviceInfo implements case STATE_CANCELLED_OK: g.drawString( - title.concat(" - ").concat( - MessageManager + title.concat(" - ") + .concat(MessageManager .getString("label.state_job_cancelled")), 60, 30); @@ -841,8 +851,8 @@ public class WebserviceInfo extends GWebserviceInfo implements case STATE_STOPPED_SERVERERROR: g.drawString( - title.concat(" - ").concat( - MessageManager + title.concat(" - ") + .concat(MessageManager .getString("label.server_error_try_later")), 60, 30); @@ -858,6 +868,7 @@ public class WebserviceInfo extends GWebserviceInfo implements } } + @Override public void paintComponent(Graphics g1) { drawPanel(); @@ -873,6 +884,7 @@ public class WebserviceInfo extends GWebserviceInfo implements renderAsHtml = b; } + @Override public void hyperlinkUpdate(HyperlinkEvent e) { Desktop.hyperlinkUpdate(e);