2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.ws.jws1;
20 import jalview.gui.AlignFrame;
21 import jalview.gui.WebserviceInfo;
22 import jalview.ws.WSClient;
23 import jalview.ws.WSMenuEntryProviderI;
25 import javax.swing.JMenu;
27 import ext.vamsas.ServiceHandle;
30 * JWS1 Specific UI attributes and methods
35 public abstract class WS1Client extends WSClient implements
40 * original service handle that this client was derived from
42 ServiceHandle serviceHandle = null;
53 * initialise WSClient service information attributes from the service handle
56 * @return the service instance information GUI for this client and job.
58 protected WebserviceInfo setWebService(ServiceHandle sh)
60 return setWebService(sh, false);
64 * initialise WSClient service information attributes from the service handle
68 * true implies no GUI objects will be created.
69 * @return the service instance information GUI for this client and job.
71 protected WebserviceInfo setWebService(ServiceHandle sh, boolean headless)
73 WebServiceName = sh.getName();
74 if (ServiceActions.containsKey(sh.getAbstractName()))
76 WebServiceJobTitle = sh.getName(); // TODO: control sh.Name specification
78 // add this for short names. +(String)
79 // ServiceActions.get(sh.getAbstractName());
83 WebServiceJobTitle = sh.getAbstractName() + " using " + sh.getName();
86 WebServiceReference = sh.getDescription();
87 WsURL = sh.getEndpointURL();
88 WebserviceInfo wsInfo = null;
91 wsInfo = new WebserviceInfo(WebServiceJobTitle, WebServiceReference);
97 * convenience method to pass the serviceHandle reference that instantiated
98 * this service on to the menu entry constructor
101 * the menu to which any menu entries/sub menus are to be attached
103 * the alignFrame instance that provides input data for the service
105 public void attachWSMenuEntry(JMenu wsmenu, final AlignFrame alignFrame)
107 if (serviceHandle == null)
110 "IMPLEMENTATION ERROR: cannot attach WS Menu Entry without service handle reference!");
112 attachWSMenuEntry(wsmenu, serviceHandle, alignFrame);
116 * method implemented by each concrete WS1Client implementation that creates
117 * menu entries that enact their service using data from alignFrame.
120 * where new menu entries (and submenus) are to be attached
121 * @param serviceHandle
122 * the serviceHandle document for the service that entries are
126 public abstract void attachWSMenuEntry(JMenu wsmenu,
127 final ServiceHandle serviceHandle, final AlignFrame alignFrame);