2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.ws.jws1;
23 import jalview.gui.AlignFrame;
24 import jalview.gui.Desktop;
25 import jalview.gui.WebserviceInfo;
26 import jalview.util.MessageManager;
27 import jalview.ws.WSClient;
28 import jalview.ws.WSMenuEntryProviderI;
30 import javax.swing.JMenu;
32 import ext.vamsas.ServiceHandle;
35 * JWS1 Specific UI attributes and methods
40 public abstract class WS1Client extends WSClient
41 implements WSMenuEntryProviderI
45 * original service handle that this client was derived from
47 ServiceHandle serviceHandle = null;
58 * initialise WSClient service information attributes from the service handle
61 * @return the service instance information GUI for this client and job.
63 protected WebserviceInfo setWebService(ServiceHandle sh)
65 return setWebService(sh, false);
69 * initialise WSClient service information attributes from the service handle
73 * true implies no GUI objects will be created.
74 * @return the service instance information GUI for this client and job.
76 protected WebserviceInfo setWebService(ServiceHandle sh, boolean headless)
78 WebServiceName = sh.getName();
79 if (ServiceActions.containsKey(sh.getAbstractName()))
81 WebServiceJobTitle = sh.getName(); // TODO: control sh.Name specification
83 // add this for short names. +(String)
84 // ServiceActions.get(sh.getAbstractName());
88 WebServiceJobTitle = sh.getAbstractName() + " using " + sh.getName();
91 WebServiceReference = sh.getDescription();
92 WsURL = sh.getEndpointURL();
93 WebserviceInfo wsInfo = null;
96 wsInfo = new WebserviceInfo(WebServiceJobTitle, WebServiceReference,
97 Desktop.FRAME_MAKE_VISIBLE);
103 * convenience method to pass the serviceHandle reference that instantiated
104 * this service on to the menu entry constructor
107 * the menu to which any menu entries/sub menus are to be attached
109 * the alignFrame instance that provides input data for the service
111 public void attachWSMenuEntry(JMenu wsmenu, final AlignFrame alignFrame)
113 if (serviceHandle == null)
115 throw new Error(MessageManager.getString(
116 "error.implementation_error_cannot_attach_ws_menu_entry"));
118 attachWSMenuEntry(wsmenu, serviceHandle, alignFrame);
122 * method implemented by each concrete WS1Client implementation that creates
123 * menu entries that enact their service using data from alignFrame.
126 * where new menu entries (and submenus) are to be attached
127 * @param serviceHandle
128 * the serviceHandle document for the service that entries are
132 public abstract void attachWSMenuEntry(JMenu wsmenu,
133 final ServiceHandle serviceHandle, final AlignFrame alignFrame);