X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fjws1%2FMsaWSClient.java;h=dad314b16e9cb3bf07f64ea48d3b20417912ae3f;hb=5571d7868cad5493b52c9fc421c88c025e7c2d35;hp=f2f14195c4b618622667791c513d201db9d23be9;hpb=153dd62dc91da13ae732600e6ea55ddbe15eab39;p=jalview.git diff --git a/src/jalview/ws/jws1/MsaWSClient.java b/src/jalview/ws/jws1/MsaWSClient.java index f2f1419..dad314b 100644 --- a/src/jalview/ws/jws1/MsaWSClient.java +++ b/src/jalview/ws/jws1/MsaWSClient.java @@ -1,30 +1,44 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6) - * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.ws.jws1; +import java.util.Locale; + +import jalview.datamodel.AlignmentI; +import jalview.datamodel.AlignmentView; +import jalview.gui.AlignFrame; +import jalview.gui.Desktop; +import jalview.gui.JvOptionPane; +import jalview.gui.WebserviceInfo; +import jalview.util.MessageManager; + import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.*; +import javax.swing.JMenu; +import javax.swing.JMenuItem; -import ext.vamsas.*; -import jalview.datamodel.*; -import jalview.gui.*; +import ext.vamsas.MuscleWSServiceLocator; +import ext.vamsas.MuscleWSSoapBindingStub; +import ext.vamsas.ServiceHandle; /** * DOCUMENT ME! @@ -59,30 +73,31 @@ public class MsaWSClient extends WS1Client public MsaWSClient(ext.vamsas.ServiceHandle sh, String altitle, jalview.datamodel.AlignmentView msa, boolean submitGaps, - boolean preserveOrder, Alignment seqdataset, + boolean preserveOrder, AlignmentI seqdataset, AlignFrame _alignFrame) { super(); alignFrame = _alignFrame; if (!sh.getAbstractName().equals("MsaWS")) { - JOptionPane - .showMessageDialog( - Desktop.desktop, - "The Service called \n" - + sh.getName() - + "\nis not a \nMultiple Sequence Alignment Service !", - "Internal Jalview Error", JOptionPane.WARNING_MESSAGE); + JvOptionPane.showMessageDialog(Desktop.desktop, + MessageManager.formatMessage( + "label.service_called_is_not_msa_service", + new String[] + { sh.getName() }), + MessageManager.getString("label.internal_jalview_error"), + JvOptionPane.WARNING_MESSAGE); return; } if ((wsInfo = setWebService(sh)) == null) { - JOptionPane.showMessageDialog(Desktop.desktop, - "The Multiple Sequence Alignment Service named " - + sh.getName() + " is unknown", - "Internal Jalview Error", JOptionPane.WARNING_MESSAGE); + JvOptionPane.showMessageDialog(Desktop.desktop, MessageManager + .formatMessage("label.msa_service_is_unknown", new String[] + { sh.getName() }), + MessageManager.getString("label.internal_jalview_error"), + JvOptionPane.WARNING_MESSAGE); return; } @@ -97,7 +112,7 @@ public class MsaWSClient extends WS1Client } private void startMsaWSClient(String altitle, AlignmentView msa, - boolean submitGaps, boolean preserveOrder, Alignment seqdataset) + boolean submitGaps, boolean preserveOrder, AlignmentI seqdataset) { if (!locateWebService()) { @@ -106,12 +121,11 @@ public class MsaWSClient extends WS1Client wsInfo.setProgressText(((submitGaps) ? "Re-alignment" : "Alignment") + " of " + altitle + "\nJob details\n"); - String jobtitle = WebServiceName.toLowerCase(); + String jobtitle = WebServiceName.toLowerCase(Locale.ROOT); if (jobtitle.endsWith("alignment")) { - if (submitGaps - && (!jobtitle.endsWith("realignment") || jobtitle - .indexOf("profile") == -1)) + if (submitGaps && (!jobtitle.endsWith("realignment") + || jobtitle.indexOf("profile") == -1)) { int pos = jobtitle.indexOf("alignment"); jobtitle = WebServiceName.substring(0, pos) + "re-alignment of " @@ -147,7 +161,7 @@ public class MsaWSClient extends WS1Client try { - this.server = (MuscleWS) loc.getMuscleWS(new java.net.URL(WsURL)); + this.server = loc.getMuscleWS(new java.net.URL(WsURL)); ((MuscleWSSoapBindingStub) this.server).setTimeout(60000); // One minute // timeout } catch (Exception ex) @@ -189,6 +203,7 @@ public class MsaWSClient extends WS1Client return (WebServiceName.indexOf("lustal") > -1); // cheat! } + @Override public void attachWSMenuEntry(JMenu msawsmenu, final ServiceHandle serviceHandle, final AlignFrame alignFrame) { @@ -197,12 +212,14 @@ public class MsaWSClient extends WS1Client method.setToolTipText(WsURL); method.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { AlignmentView msa = alignFrame.gatherSequencesForAlignment(); - new jalview.ws.jws1.MsaWSClient(serviceHandle, alignFrame.getTitle(), - msa, false, true, alignFrame.getViewport().getAlignment() - .getDataset(), alignFrame); + new jalview.ws.jws1.MsaWSClient(serviceHandle, + alignFrame.getTitle(), msa, false, true, + alignFrame.getViewport().getAlignment().getDataset(), + alignFrame); } @@ -211,17 +228,19 @@ public class MsaWSClient extends WS1Client if (canSubmitGaps()) { // We know that ClustalWS can accept partial alignments for refinement. - final JMenuItem methodR = new JMenuItem(serviceHandle.getName() - + " Realign"); + final JMenuItem methodR = new JMenuItem( + serviceHandle.getName() + " Realign"); methodR.setToolTipText(WsURL); methodR.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { AlignmentView msa = alignFrame.gatherSequencesForAlignment(); - new jalview.ws.jws1.MsaWSClient(serviceHandle, alignFrame.getTitle(), - msa, true, true, alignFrame.getViewport().getAlignment() - .getDataset(), alignFrame); + new jalview.ws.jws1.MsaWSClient(serviceHandle, + alignFrame.getTitle(), msa, true, true, + alignFrame.getViewport().getAlignment().getDataset(), + alignFrame); }